mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 13:49:53 -06:00
Core/AudioCommon: Feed bigger audio chunks to the output devices in case of underrun.
This should eliminate the crackling with alsa and pulseaudio backends and replace it with much nicer pauses. This is only interesting for audio backends that do not respect Mixer::GetNumSamples() and should not impact users able to run the DSPLLE at full speed. The cost of this is an added LLE audio latency of about 0.06 s in the continuous playback case. If that is too much, lower the low watermark. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6239 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -37,19 +37,30 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
|
||||
}
|
||||
|
||||
unsigned int numLeft = Common::AtomicLoad(m_numSamples);
|
||||
numLeft = (numLeft > numSamples) ? numSamples : numLeft;
|
||||
|
||||
// Do re-sampling if needed
|
||||
if (m_sampleRate == 32000)
|
||||
{
|
||||
for (unsigned int i = 0; i < numLeft * 2; i++)
|
||||
samples[i] = Common::swap16(m_buffer[(m_indexR + i) & INDEX_MASK]);
|
||||
m_indexR += numLeft * 2;
|
||||
if (m_LLEplaying) {
|
||||
if (numLeft < numSamples)//cannot do much about this
|
||||
m_LLEplaying = false;
|
||||
if (numLeft < MAX_SAMPLES/4)//low watermark
|
||||
m_LLEplaying = false;
|
||||
} else {
|
||||
if (numLeft > MAX_SAMPLES/2)//high watermark
|
||||
m_LLEplaying = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// AyuanX: Up-sampling is not implemented yet
|
||||
PanicAlert("Mixer: Up-sampling is not implemented yet!");
|
||||
|
||||
if (m_LLEplaying) {
|
||||
numLeft = (numLeft > numSamples) ? numSamples : numLeft;
|
||||
|
||||
// Do re-sampling if needed
|
||||
if (m_sampleRate == 32000)
|
||||
{
|
||||
for (unsigned int i = 0; i < numLeft * 2; i++)
|
||||
samples[i] = Common::swap16(m_buffer[(m_indexR + i) & INDEX_MASK]);
|
||||
m_indexR += numLeft * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// AyuanX: Up-sampling is not implemented yet
|
||||
PanicAlert("Mixer: Up-sampling is not implemented yet!");
|
||||
/*
|
||||
static int PV1l=0,PV2l=0,PV3l=0,PV4l=0;
|
||||
static int PV1r=0,PV2r=0,PV3r=0,PV4r=0;
|
||||
@ -112,6 +123,10 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
|
||||
m_queueSize += 2;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
} else {
|
||||
numLeft = 0;
|
||||
}
|
||||
|
||||
// Padding
|
||||
|
Reference in New Issue
Block a user