Fixed NullSound hanging on movies. Compared to DSound, it's now slower on movies but faster in menus
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2183 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
59a8fd4848
commit
09c8368180
|
@ -24,7 +24,7 @@ class IEXIDevice
|
|||
{
|
||||
private:
|
||||
// Byte transfer function for this device
|
||||
virtual void TransferByte(u8& _byte) {};
|
||||
virtual void TransferByte(u8&) {};
|
||||
|
||||
public:
|
||||
// Immediate copy functions
|
||||
|
|
|
@ -110,8 +110,7 @@ void DSound::SoundLoop() {
|
|||
// No blocking inside the csection
|
||||
soundCriticalSection->Enter();
|
||||
dsBuffer->GetCurrentPosition((DWORD*)¤tPos, 0);
|
||||
int numBytesToRender = FIX128(
|
||||
ModBufferSize(currentPos - lastPos));
|
||||
int numBytesToRender = FIX128(ModBufferSize(currentPos - lastPos));
|
||||
|
||||
if (numBytesToRender >= 256)
|
||||
{
|
||||
|
|
|
@ -68,13 +68,7 @@ void Mixer(short *buffer, int numSamples, int bits, int rate, int channels)
|
|||
g_dspInitialize.pGetAudioStreaming(buffer, numSamples);
|
||||
}
|
||||
|
||||
//if this was called directly from the HLE, and not by timeout
|
||||
if (g_Config.m_EnableHLEAudio && mixer_HLEready)
|
||||
{
|
||||
IUCode* pUCode = CDSPHandler::GetInstance().GetUCode();
|
||||
if (pUCode != NULL)
|
||||
pUCode->MixAdd(buffer, numSamples);
|
||||
}
|
||||
Mixer_MixUCode(buffer, numSamples, bits, rate, channels);
|
||||
|
||||
push_sync.Enter();
|
||||
int count = 0;
|
||||
|
@ -96,6 +90,17 @@ void Mixer(short *buffer, int numSamples, int bits, int rate, int channels)
|
|||
push_sync.Leave();
|
||||
}
|
||||
|
||||
void Mixer_MixUCode(short *buffer, int numSamples, int bits, int rate,
|
||||
int channels) {
|
||||
//if this was called directly from the HLE, and not by timeout
|
||||
if (g_Config.m_EnableHLEAudio && mixer_HLEready)
|
||||
{
|
||||
IUCode* pUCode = CDSPHandler::GetInstance().GetUCode();
|
||||
if (pUCode != NULL)
|
||||
pUCode->MixAdd(buffer, numSamples);
|
||||
}
|
||||
}
|
||||
|
||||
void Mixer_PushSamples(short *buffer, int num_stereo_samples, int sample_rate) {
|
||||
// static FILE *f;
|
||||
// if (!f)
|
||||
|
|
|
@ -23,6 +23,8 @@ extern volatile bool mixer_HLEready;
|
|||
// Called from audio threads
|
||||
void Mixer(short* buffer, int numSamples, int bits, int rate, int channels);
|
||||
|
||||
void Mixer_MixUCode(short *buffer, int numSamples, int bits, int rate, int channels);
|
||||
|
||||
// Called from main thread
|
||||
void Mixer_PushSamples(short *buffer, int num_stereo_samples, int sample_rate);
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@ public:
|
|||
}
|
||||
|
||||
virtual bool Start() { return true; }
|
||||
|
||||
virtual void Update() {
|
||||
(*callback)(NULL, 256 >> 2, 16, sampleRate, 2);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //__NULLSOUNDSTREAM_H__
|
||||
|
|
|
@ -326,7 +326,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
// write logging data to debugger
|
||||
if (m_frame)
|
||||
if (m_frame && _pBuffer)
|
||||
{
|
||||
CUCode_AX::Logging(_pBuffer, _iSize, 0, false);
|
||||
}
|
||||
|
@ -383,22 +383,23 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
|
|||
// write back out pbs
|
||||
WriteBackPBs(m_addressPBs, PBs, numberOfPBs);
|
||||
|
||||
for (int i = 0; i < _iSize; i++)
|
||||
{
|
||||
// Clamp into 16-bit. Maybe we should add a volume compressor here.
|
||||
int left = templbuffer[i] + _pBuffer[0];
|
||||
int right = temprbuffer[i] + _pBuffer[1];
|
||||
if (left < -32767) left = -32767;
|
||||
if (left > 32767) left = 32767;
|
||||
if (right < -32767) right = -32767;
|
||||
if (right > 32767) right = 32767;
|
||||
*_pBuffer++ = left;
|
||||
*_pBuffer++ = right;
|
||||
if(_pBuffer) {
|
||||
for (int i = 0; i < _iSize; i++)
|
||||
{
|
||||
// Clamp into 16-bit. Maybe we should add a volume compressor here.
|
||||
int left = templbuffer[i] + _pBuffer[0];
|
||||
int right = temprbuffer[i] + _pBuffer[1];
|
||||
if (left < -32767) left = -32767;
|
||||
if (left > 32767) left = 32767;
|
||||
if (right < -32767) right = -32767;
|
||||
if (right > 32767) right = 32767;
|
||||
*_pBuffer++ = left;
|
||||
*_pBuffer++ = right;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
// write logging data to debugger again after the update
|
||||
if (m_frame)
|
||||
if (m_frame && _pBuffer)
|
||||
{
|
||||
CUCode_AX::Logging(_pBuffer, _iSize, 1, false);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs)
|
|||
// -------------------------------------------
|
||||
// write logging data to debugger
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (m_frame)
|
||||
if (m_frame && _pBuffer)
|
||||
{
|
||||
lCUCode_AX->Logging(_pBuffer, _iSize, 0, true);
|
||||
|
||||
|
@ -199,22 +199,25 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs)
|
|||
|
||||
WriteBackPBsWii(m_addressPBs, PBs, numberOfPBs);
|
||||
// We write the sound to _pBuffer
|
||||
for (int i = 0; i < _iSize; i++)
|
||||
if(_pBuffer)
|
||||
{
|
||||
// Clamp into 16-bit. Maybe we should add a volume compressor here.
|
||||
int left = templbuffer[i] + _pBuffer[0];
|
||||
int right = temprbuffer[i] + _pBuffer[1];
|
||||
if (left < -32767) left = -32767;
|
||||
if (left > 32767) left = 32767;
|
||||
if (right < -32767) right = -32767;
|
||||
if (right > 32767) right = 32767;
|
||||
*_pBuffer++ = left;
|
||||
*_pBuffer++ = right;
|
||||
for (int i = 0; i < _iSize; i++)
|
||||
{
|
||||
// Clamp into 16-bit. Maybe we should add a volume compressor here.
|
||||
int left = templbuffer[i] + _pBuffer[0];
|
||||
int right = temprbuffer[i] + _pBuffer[1];
|
||||
if (left < -32767) left = -32767;
|
||||
if (left > 32767) left = 32767;
|
||||
if (right < -32767) right = -32767;
|
||||
if (right > 32767) right = 32767;
|
||||
*_pBuffer++ = left;
|
||||
*_pBuffer++ = right;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
// write logging data to debugger again after the update
|
||||
if (m_frame)
|
||||
if (m_frame && _pBuffer)
|
||||
{
|
||||
lCUCode_AX->Logging(_pBuffer, _iSize, 1, true);
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ void Initialize(void *init)
|
|||
if (AOSound::isValid())
|
||||
soundStream = new AOSound(48000, Mixer);
|
||||
} else if(strncasecmp(g_Config.sBackend, "NullSound", 10) == 0) {
|
||||
soundStream = new NullSound(48000, Mixer);
|
||||
soundStream = new NullSound(48000, Mixer_MixUCode);
|
||||
} else {
|
||||
PanicAlert("Cannot recognize backend %s", g_Config.sBackend);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue