Skip to content
This repository
Browse code

[AE/CA] - on LPCM only set audio-midi-setup to 8 channels when needed…

… 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...
commit 44f0991a2f2a8449e6f8fe1869304872e186269a 1 parent 555cf97
Memphiz authored April 26, 2013
17  xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp
@@ -173,7 +173,7 @@ bool CCoreAudioAE::Initialize()
173 173
 bool CCoreAudioAE::OpenCoreAudio(unsigned int sampleRate, bool forceRaw,
174 174
   enum AEDataFormat rawDataFormat)
175 175
 {
176  
-
  176
+  unsigned int maxChannelCountInStreams = 0;
177 177
   // remove any deleted streams
178 178
   CSingleLock streamLock(m_streamLock);
179 179
   for (StreamList::iterator itt = m_streams.begin(); itt != m_streams.end();)
@@ -190,6 +190,10 @@ bool CCoreAudioAE::OpenCoreAudio(unsigned int sampleRate, bool forceRaw,
190 190
       // close all converter
191 191
       stream->CloseConverter();
192 192
     }
  193
+
  194
+    if (stream->GetChannelCount() > maxChannelCountInStreams)
  195
+        maxChannelCountInStreams = stream->GetChannelCount();
  196
+
193 197
     ++itt;
194 198
   }
195 199
 
@@ -263,7 +267,16 @@ bool CCoreAudioAE::OpenCoreAudio(unsigned int sampleRate, bool forceRaw,
263 267
         m_format.m_dataFormat   = AE_FMT_S16NE;
264 268
         break;
265 269
       case AE_FMT_LPCM:
266  
-        m_format.m_channelLayout = CAEChannelInfo(AE_CH_LAYOUT_7_1);
  270
+        // audio midi setup can be setup to 2.0 or 7.1
  271
+        // if we have the number of max channels from streams we use that for
  272
+        // selecting either 2.0 or 7.1 setup depending on that.
  273
+        // This allows DPII modes on amps for enhancing stereo sound
  274
+        // (when switching to 7.1 - all 8 channels will be pushed out preventing most amps
  275
+        // to switch to DPII mode)
  276
+        if (maxChannelCountInStreams == 1 || maxChannelCountInStreams == 2)
  277
+          m_format.m_channelLayout = CAEChannelInfo(AE_CH_LAYOUT_2_0);
  278
+        else
  279
+          m_format.m_channelLayout = CAEChannelInfo(AE_CH_LAYOUT_7_1);
267 280
         m_format.m_sampleRate   = sampleRate;
268 281
         m_format.m_dataFormat   = AE_FMT_FLOAT;
269 282
         break;

0 notes on commit 44f0991

Please sign in to comment.
Something went wrong with that request. Please try again.