Skip to content

Commit

Permalink
ActiveAE: add advanced setting for forcing multichannel layout and fi…
Browse files Browse the repository at this point in the history
…x fixed channel alignment (based upon pull xbmc#4967)
  • Loading branch information
AlwinEsch authored and AlwinEsch committed Jul 4, 2014
1 parent 9d4befb commit cf75331
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
17 changes: 10 additions & 7 deletions xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
Expand Up @@ -1454,16 +1454,18 @@ void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &sett
}
else
{
bool multichannelSource = format.m_channelLayout.Count() > 2;

format.m_dataFormat = AE_FMT_FLOAT;
// consider user channel layout for those cases
// 1. input stream is multichannel
// 2. stereo upmix is selected
// 3. audio dsp is used
// 4. fixed mode
if ((format.m_channelLayout.Count() > 2) ||
settings.stereoupmix ||
settings.dspaddonsenabled ||
(settings.config == AE_CONFIG_FIXED))
if (multichannelSource ||
settings.stereoupmix ||
settings.dspaddonsenabled ||
(settings.config == AE_CONFIG_FIXED))
{
AEStdChLayout stdChannelLayout;
switch (settings.channels)
Expand All @@ -1484,10 +1486,11 @@ void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &sett

CAEChannelInfo stdLayout(stdChannelLayout);

if (settings.dspaddonsenabled)
if (m_settings.config == AE_CONFIG_FIXED ||
settings.dspaddonsenabled ||
(settings.stereoupmix && !multichannelSource) ||
(g_advancedSettings.m_audioFixedMultichannelLayout && multichannelSource))
format.m_channelLayout = CActiveAEDSP::Get().GetDSPChannelLayout(stdChannelLayout);
else if (m_settings.config == AE_CONFIG_FIXED || (settings.stereoupmix && format.m_channelLayout.Count() <= 2))
format.m_channelLayout = stdLayout;
else if (m_extKeepConfig && (settings.config == AE_CONFIG_AUTO) && (oldMode != MODE_RAW))
format.m_channelLayout = m_internalFormat.m_channelLayout;
else
Expand Down
2 changes: 2 additions & 0 deletions xbmc/settings/AdvancedSettings.cpp
Expand Up @@ -108,6 +108,7 @@ void CAdvancedSettings::Initialize()
m_audioHeadRoom = 0;
m_ac3Gain = 12.0f;
m_audioApplyDrc = true;
m_audioFixedMultichannelLayout = false;
m_dvdplayerIgnoreDTSinWAV = false;

//default hold time of 25 ms, this allows a 20 hertz sine to pass undistorted
Expand Down Expand Up @@ -501,6 +502,7 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file)

XMLUtils::GetString(pElement, "audiohost", m_audioHost);
XMLUtils::GetBoolean(pElement, "applydrc", m_audioApplyDrc);
XMLUtils::GetBoolean(pElement, "fixedmultichannellayout", m_audioFixedMultichannelLayout);
XMLUtils::GetBoolean(pElement, "dvdplayerignoredtsinwav", m_dvdplayerIgnoreDTSinWAV);

XMLUtils::GetFloat(pElement, "limiterhold", m_limiterHold, 0.0f, 100.0f);
Expand Down
1 change: 1 addition & 0 deletions xbmc/settings/AdvancedSettings.h
Expand Up @@ -179,6 +179,7 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler
float m_videoIgnorePercentAtEnd;
CStdString m_audioHost;
bool m_audioApplyDrc;
bool m_audioFixedMultichannelLayout;

int m_videoVDPAUScaling;
float m_videoNonLinStretchRatio;
Expand Down

0 comments on commit cf75331

Please sign in to comment.