Permalink
Browse files

CoreAE: make sure we zero out any left over output channels during mi…

…xing
  • Loading branch information...
1 parent 6fa41fd commit 310eec4615f3dd43531f5f345ae2adb2493169f6 @elupus elupus committed Feb 26, 2013
Showing with 8 additions and 1 deletion.
  1. +8 −1 xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioMixMap.cpp
@@ -235,11 +235,18 @@ bool CCoreAudioMixMap::SetMixingMatrix(CAUMatrixMixer *mixerUnit,
Float32* val = (Float32*)*mixMap;
for (UInt32 i = 0; i < inputFormat->mChannelsPerFrame; ++i)
{
- for (UInt32 j = 0; j < fmt->mChannelsPerFrame; ++j)
+ UInt32 j = 0;
+ for (; j < fmt->mChannelsPerFrame; ++j)
{
AudioUnitSetParameter(mixerUnit->GetUnit(),
kMatrixMixerParam_Volume, kAudioUnitScope_Global, ( (i + channelOffset) << 16 ) | j, *val++, 0);
}
+ // zero out additional outputs from this input
+ for (; j < dims[1]; ++j)
+ {
+ AudioUnitSetParameter(mixerUnit->GetUnit(),
+ kMatrixMixerParam_Volume, kAudioUnitScope_Global, ( (i + channelOffset) << 16 ) | j, 0.0f, 0);
+ }
}
CLog::Log(LOGDEBUG, "CCoreAudioGraph::Open: "

0 comments on commit 310eec4

Please sign in to comment.