summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/PulseAudioStream.cpp
diff options
context:
space:
mode:
authorLAGonauta <lagonauta@gmail.com>2017-08-09 16:59:37 -0300
committerLAGonauta <lagonauta@gmail.com>2019-02-13 22:52:40 -0200
commitfdfd9d69531fffdeff81ae04a1271d2e938a05bd (patch)
tree2972a5e2735bd0b0afac3331466f6d4352bfe8aa /Source/Core/AudioCommon/PulseAudioStream.cpp
parentdf631f0d75bd6422aca4b69854671ba1c561b077 (diff)
Cleaned up PulseAudio as we now use FreeSurround
Diffstat (limited to 'Source/Core/AudioCommon/PulseAudioStream.cpp')
-rw-r--r--Source/Core/AudioCommon/PulseAudioStream.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/Source/Core/AudioCommon/PulseAudioStream.cpp b/Source/Core/AudioCommon/PulseAudioStream.cpp
index e8d5090b25..05d08b1603 100644
--- a/Source/Core/AudioCommon/PulseAudioStream.cpp
+++ b/Source/Core/AudioCommon/PulseAudioStream.cpp
@@ -22,7 +22,7 @@ PulseAudio::PulseAudio() : m_thread(), m_run_thread()
bool PulseAudio::Init()
{
m_stereo = !SConfig::GetInstance().bDPL2Decoder;
- m_channels = m_stereo ? 2 : 5; // will tell PA we use a Stereo or 5.0 channel setup
+ m_channels = m_stereo ? 2 : 6; // will tell PA we use a Stereo or 5.0 channel setup
NOTICE_LOG(AUDIO, "PulseAudio backend using %d channels", m_channels);
@@ -96,12 +96,13 @@ bool PulseAudio::PulseInit()
m_bytespersample = sizeof(float);
channel_map_p = &channel_map; // explicit channel map:
- channel_map.channels = 5;
+ channel_map.channels = 6;
channel_map.map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
channel_map.map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;
channel_map.map[2] = PA_CHANNEL_POSITION_FRONT_CENTER;
- channel_map.map[3] = PA_CHANNEL_POSITION_REAR_LEFT;
- channel_map.map[4] = PA_CHANNEL_POSITION_REAR_RIGHT;
+ channel_map.map[3] = PA_CHANNEL_POSITION_LFE;
+ channel_map.map[4] = PA_CHANNEL_POSITION_REAR_LEFT;
+ channel_map.map[5] = PA_CHANNEL_POSITION_REAR_RIGHT;
}
ss.channels = m_channels;
ss.rate = m_mixer->GetSampleRate();
@@ -185,22 +186,9 @@ void PulseAudio::WriteCallback(pa_stream* s, size_t length)
}
else
{
- if (m_channels == 5) // Extract dpl2/5.0 Surround
+ if (m_channels == 6) // Extract dpl2/5.1 Surround
{
- float floatbuffer_6chan[frames * 6];
- m_mixer->MixSurround(floatbuffer_6chan, frames);
-
- // DPL2Decode output: LEFTFRONT, RIGHTFRONT, CENTREFRONT, (sub), LEFTREAR, RIGHTREAR
- // Discard the subwoofer channel - DPL2Decode generates a pretty
- // good 5.0 but not a good 5.1 output.
- const int dpl2_to_5chan[] = {0, 1, 2, 4, 5};
- for (int i = 0; i < frames; ++i)
- {
- for (int j = 0; j < m_channels; ++j)
- {
- ((float*)buffer)[m_channels * i + j] = floatbuffer_6chan[6 * i + dpl2_to_5chan[j]];
- }
- }
+ m_mixer->MixSurround((float*)buffer, frames);
}
else
{