mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 23:11:14 +01:00
Removed zeroing-out the LFE as it is not needed anymore.
Also removed minimum number of frames needed when decoding DPL2, and use std::numeric_limits to clamp the samples when needed. Clamping is still needed, but those samples are much rarer now and depend on the game.
This commit is contained in:
parent
fdfd9d6953
commit
f4cf1e4f49
@ -246,12 +246,6 @@ void OpenALStream::SoundLoop()
|
||||
frames_per_buffer = OAL_MAX_FRAMES;
|
||||
}
|
||||
|
||||
// DPL2 needs a minimum number of samples to work (FWRDURATION)
|
||||
if (use_surround && frames_per_buffer < 240)
|
||||
{
|
||||
frames_per_buffer = 240;
|
||||
}
|
||||
|
||||
INFO_LOG(AUDIO, "Using %d buffers, each with %d audio frames for a total of %d.", OAL_BUFFERS,
|
||||
frames_per_buffer, frames_per_buffer * OAL_BUFFERS);
|
||||
|
||||
@ -312,15 +306,6 @@ void OpenALStream::SoundLoop()
|
||||
if (rendered_frames < min_frames)
|
||||
continue;
|
||||
|
||||
// zero-out the subwoofer channel - DPL2Decode generates a pretty
|
||||
// good 5.0 but not a good 5.1 output. Sadly there is not a 5.0
|
||||
// AL_FORMAT_50CHN32 to make this super-explicit.
|
||||
// DPL2Decode output: LEFTFRONT, RIGHTFRONT, CENTREFRONT, (sub), LEFTREAR, RIGHTREAR
|
||||
for (u32 i = 0; i < rendered_frames; ++i)
|
||||
{
|
||||
dpl2[i * SURROUND_CHANNELS + 3 /*sub/lfe*/] = 0.0f;
|
||||
}
|
||||
|
||||
if (float32_capable)
|
||||
{
|
||||
palBufferData(m_buffers[next_buffer], AL_FORMAT_51CHN32, dpl2.data(),
|
||||
@ -332,14 +317,11 @@ void OpenALStream::SoundLoop()
|
||||
|
||||
for (u32 i = 0; i < rendered_frames * SURROUND_CHANNELS; ++i)
|
||||
{
|
||||
// For some reason the ffdshow's DPL2 decoder outputs samples bigger than 1.
|
||||
// Most are close to 2.5 and some go up to 8. Hard clamping here, we need to
|
||||
// fix the decoder or implement a limiter.
|
||||
dpl2[i] = dpl2[i] * (INT64_C(1) << 31);
|
||||
if (dpl2[i] > INT_MAX)
|
||||
surround_int32[i] = INT_MAX;
|
||||
else if (dpl2[i] < INT_MIN)
|
||||
surround_int32[i] = INT_MIN;
|
||||
dpl2[i] = dpl2[i] * std::numeric_limits<int>::max();
|
||||
if (dpl2[i] > std::numeric_limits<int>::max())
|
||||
surround_int32[i] = std::numeric_limits<int>::max();
|
||||
else if (dpl2[i] < std::numeric_limits<int>::min())
|
||||
surround_int32[i] = std::numeric_limits<int>::min();
|
||||
else
|
||||
surround_int32[i] = static_cast<int>(dpl2[i]);
|
||||
}
|
||||
@ -353,13 +335,13 @@ void OpenALStream::SoundLoop()
|
||||
|
||||
for (u32 i = 0; i < rendered_frames * SURROUND_CHANNELS; ++i)
|
||||
{
|
||||
dpl2[i] = dpl2[i] * (1 << 15);
|
||||
if (dpl2[i] > SHRT_MAX)
|
||||
surround_short[i] = SHRT_MAX;
|
||||
else if (dpl2[i] < SHRT_MIN)
|
||||
surround_short[i] = SHRT_MIN;
|
||||
dpl2[i] = dpl2[i] * std::numeric_limits<short>::max();
|
||||
if (dpl2[i] > std::numeric_limits<short>::max())
|
||||
surround_short[i] = std::numeric_limits<short>::max();
|
||||
else if (dpl2[i] < std::numeric_limits<short>::min())
|
||||
surround_short[i] = std::numeric_limits<short>::min();
|
||||
else
|
||||
surround_short[i] = static_cast<int>(dpl2[i]);
|
||||
surround_short[i] = static_cast<short>(dpl2[i]);
|
||||
}
|
||||
|
||||
palBufferData(m_buffers[next_buffer], AL_FORMAT_51CHN16, surround_short.data(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user