Skip to content

Commit

Permalink
[AE/CA] - on LPCM only set audio-midi-setup to 8 channels when needed…
Browse files Browse the repository at this point in the history
… based on the channelcount of the stream with the highest channelcount - else set it to 2 channels if stream is only 2.0. This allows amps to switch to stereo enhancing modes (e.x. DPII) when playing 2.0 over LPCM (e.x. AAC 2.0).
  • Loading branch information
Memphiz committed Apr 26, 2013
1 parent 555cf97 commit 44f0991
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp
Expand Up @@ -173,7 +173,7 @@ bool CCoreAudioAE::Initialize()
bool CCoreAudioAE::OpenCoreAudio(unsigned int sampleRate, bool forceRaw,
enum AEDataFormat rawDataFormat)
{

unsigned int maxChannelCountInStreams = 0;
// remove any deleted streams
CSingleLock streamLock(m_streamLock);
for (StreamList::iterator itt = m_streams.begin(); itt != m_streams.end();)
Expand All @@ -190,6 +190,10 @@ bool CCoreAudioAE::OpenCoreAudio(unsigned int sampleRate, bool forceRaw,
// close all converter
stream->CloseConverter();
}

if (stream->GetChannelCount() > maxChannelCountInStreams)
maxChannelCountInStreams = stream->GetChannelCount();

++itt;
}

Expand Down Expand Up @@ -263,7 +267,16 @@ bool CCoreAudioAE::OpenCoreAudio(unsigned int sampleRate, bool forceRaw,
m_format.m_dataFormat = AE_FMT_S16NE;
break;
case AE_FMT_LPCM:
m_format.m_channelLayout = CAEChannelInfo(AE_CH_LAYOUT_7_1);
// audio midi setup can be setup to 2.0 or 7.1
// if we have the number of max channels from streams we use that for
// selecting either 2.0 or 7.1 setup depending on that.
// This allows DPII modes on amps for enhancing stereo sound
// (when switching to 7.1 - all 8 channels will be pushed out preventing most amps
// to switch to DPII mode)
if (maxChannelCountInStreams == 1 || maxChannelCountInStreams == 2)
m_format.m_channelLayout = CAEChannelInfo(AE_CH_LAYOUT_2_0);
else
m_format.m_channelLayout = CAEChannelInfo(AE_CH_LAYOUT_7_1);
m_format.m_sampleRate = sampleRate;
m_format.m_dataFormat = AE_FMT_FLOAT;
break;
Expand Down

0 comments on commit 44f0991

Please sign in to comment.