Skip to content

Commit

Permalink
Merge pull request #2581 from Memphiz/frodo_aefixes
Browse files Browse the repository at this point in the history
[CA/AE] - fixes
  • Loading branch information
davilla committed Apr 10, 2013
2 parents cf8a307 + c8061dc commit 5611708
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool CCoreAudioGraph::Open(ICoreAudioSource *pSource, AEAudioFormat &format,
delete m_mixMap;
m_mixMap = CCoreAudioMixMap::CreateMixMap(m_audioUnit, format, layoutTag);

if (m_mixMap || m_mixMap->IsValid())
if (m_mixMap && m_mixMap->IsValid())
{
// maximum input channel ber input bus
//fmt.mChannelsPerFrame = MAXIMUM_MIXER_CHANNELS;
Expand Down Expand Up @@ -152,7 +152,12 @@ bool CCoreAudioGraph::Open(ICoreAudioSource *pSource, AEAudioFormat &format,
if (!m_mixerUnit->SetInputBusFormat(MAX_CONNECTION_LIMIT, &fmt))
return false;

if (!m_mixerUnit->SetFormat(&fmt, kAudioUnitScope_Output, kOutputBus))
// Update format structure to reflect the desired format from the mixer
// The output format of the mixer is identical to the input format, except for the channel count
AudioStreamBasicDescription mixOutput(fmt);
mixOutput.mChannelsPerFrame = m_mixMap->GetOutputChannels();

if (!m_mixerUnit->SetFormat(&mixOutput, kAudioUnitScope_Output, kOutputBus))
return false;

ret = AUGraphConnectNodeInput(m_audioGraph, m_mixerUnit->GetNode(), 0, m_audioUnit->GetNode(), 0);
Expand Down Expand Up @@ -193,17 +198,13 @@ bool CCoreAudioGraph::Open(ICoreAudioSource *pSource, AEAudioFormat &format,
return false;
}

// Update format structure to reflect the desired format from the mixer
// The output format of the mixer is identical to the input format, except for the channel count
fmt.mChannelsPerFrame = m_mixMap->GetOutputChannels();

UInt32 inputNumber = m_inputUnit->GetBus();
int channelOffset = GetMixerChannelOffset(inputNumber);
if (!CCoreAudioMixMap::SetMixingMatrix(m_mixerUnit, m_mixMap, &inputFormat, &fmt, channelOffset))
if (!CCoreAudioMixMap::SetMixingMatrix(m_mixerUnit, m_mixMap, &fmt, &mixOutput, channelOffset))
return false;

// Regenerate audio format and copy format for the Output AU
outputFormat = fmt;
outputFormat = mixOutput;
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioMixMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,14 @@ bool CCoreAudioMixMap::SetMixingMatrix(CAUMatrixMixer *mixerUnit,
if(fmt->mChannelsPerFrame > dims[1])
{
CLog::Log(LOGERROR, "CCoreAudioMixMap::SetMixingMatrix - ouput format doesn't fit mixer size %u > %u"
, fmt->mChannelsPerFrame, dims[0]);
, fmt->mChannelsPerFrame, dims[1]);
return false;
}

if(fmt->mChannelsPerFrame < dims[1])
{
CLog::Log(LOGWARNING, "CCoreAudioMixMap::SetMixingMatrix - ouput format doesn't specify all outputs %u < %u"
, fmt->mChannelsPerFrame, dims[0]);
, fmt->mChannelsPerFrame, dims[1]);
}

// Configure the mixing matrix
Expand Down

0 comments on commit 5611708

Please sign in to comment.