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

Method discreteCopyFrom

src/core/AudioBus.cpp:492–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

490}
491
492void AudioBus::discreteCopyFrom(const AudioBus & sourceBus)
493{
494 const int numberOfSourceChannels = sourceBus.numberOfChannels();
495 const int numberOfDestinationChannels = numberOfChannels();
496
497 if (numberOfDestinationChannels < numberOfSourceChannels)
498 {
499 // Down-mix by copying channels and dropping the remaining.
500 for (int i = 0; i < numberOfDestinationChannels; ++i)
501 {
502 channel(i)->copyFrom(sourceBus.channel(i));
503 }
504 }
505 else if (numberOfDestinationChannels > numberOfSourceChannels)
506 {
507 // Up-mix by copying as many channels as we have, then zeroing remaining channels.
508 for (int i = 0; i < numberOfSourceChannels; ++i)
509 {
510 channel(i)->copyFrom(sourceBus.channel(i));
511 }
512
513 for (int i = numberOfSourceChannels; i < numberOfDestinationChannels; ++i)
514 {
515 channel(i)->zero();
516 }
517 }
518}
519
520void AudioBus::discreteSumFrom(const AudioBus & sourceBus)
521{

Callers

nothing calls this directly

Calls 4

channelMethod · 0.80
numberOfChannelsMethod · 0.45
copyFromMethod · 0.45
zeroMethod · 0.45

Tested by

no test coverage detected