MCPcopy Create free account
hub / github.com/LabSound/LabSound / copyFrom

Method copyFrom

src/core/AudioBus.cpp:245–269  ·  view source on GitHub ↗

Just copies the samples from the source bus to this one. This is just a simple copy if the number of channels match, otherwise a mixup or mixdown is done. For now, we just support mixup from mono -> stereo and mixdown from stereo -> mono.

Source from the content-addressed store, hash-verified

243// This is just a simple copy if the number of channels match, otherwise a mixup or mixdown is done.
244// For now, we just support mixup from mono -> stereo and mixdown from stereo -> mono.
245void AudioBus::copyFrom(const AudioBus & sourceBus, ChannelInterpretation channelInterpretation)
246{
247 if (&sourceBus == this) return;
248
249 int numberOfSourceChannels = sourceBus.numberOfChannels();
250 int numberOfDestinationChannels = numberOfChannels();
251
252 if (numberOfDestinationChannels == numberOfSourceChannels)
253 {
254 for (int i = 0; i < numberOfSourceChannels; ++i)
255 {
256 channel(i)->copyFrom(sourceBus.channel(i));
257 }
258 }
259 else
260 {
261 switch (channelInterpretation)
262 {
263 case ChannelInterpretation::Speakers: speakersCopyFrom(sourceBus); break;
264 case ChannelInterpretation::Discrete: discreteCopyFrom(sourceBus); break;
265 default:
266 ASSERT_NOT_REACHED();
267 }
268 }
269}
270
271void AudioBus::sumFrom(const AudioBus & sourceBus, ChannelInterpretation channelInterpretation)
272{

Callers 12

processMethod · 0.45
processMethod · 0.45
processMethod · 0.45
processMethod · 0.45
processMethod · 0.45
processMethod · 0.45
processMethod · 0.45
speakersCopyFromMethod · 0.45
discreteCopyFromMethod · 0.45
pull_graphMethod · 0.45
setMethod · 0.45
provideInputMethod · 0.45

Calls 2

channelMethod · 0.80
numberOfChannelsMethod · 0.45

Tested by 1

processMethod · 0.36