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

Method discreteSumFrom

src/core/AudioBus.cpp:520–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

518}
519
520void AudioBus::discreteSumFrom(const AudioBus & sourceBus)
521{
522 const int numberOfSourceChannels = sourceBus.numberOfChannels();
523 const int numberOfDestinationChannels = numberOfChannels();
524
525 if (numberOfDestinationChannels < numberOfSourceChannels)
526 {
527 // Down-mix by summing channels and dropping the remaining.
528 for (int i = 0; i < numberOfDestinationChannels; ++i)
529 {
530 channel(i)->sumFrom(sourceBus.channel(i));
531 }
532 }
533 else if (numberOfDestinationChannels > numberOfSourceChannels)
534 {
535 // Up-mix by summing as many channels as we have.
536 for (int i = 0; i < numberOfSourceChannels; ++i)
537 {
538 channel(i)->sumFrom(sourceBus.channel(i));
539 }
540 }
541}
542
543void AudioBus::copyWithGainFrom(const AudioBus & sourceBus, float * lastMixGain, float targetGain)
544{

Callers

nothing calls this directly

Calls 3

channelMethod · 0.80
numberOfChannelsMethod · 0.45
sumFromMethod · 0.45

Tested by

no test coverage detected