mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 13:20:27 -06:00
Core audio system work (Watch for regressions please!):
* Restore Audio Throttle to function properly, broken by Ayuanx many hundreds of revisions back. * Simplify DSPLLE JIT dispatcher in preparation for an asm rewrite * Remove hack that made DSPLLE JIT seem faster than it was by running fewer cycles, but resulting in bad sound. This shows off how mysteriously slow it is - I don't understand why it's not faster. Use the DSPLLE interpreter for now if you want to use DSPLLE. * Made "DSPLLE on Thread" work properly with correct-ish timing - although the speed benefit is really small now. If it seems like this change slows anything non-LLE down, try turning off Audio Throttle and use the frame limiter in options instead. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5541 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
|
||||
|
||||
#include "Common.h" // Common
|
||||
#include "Atomic.h"
|
||||
#include "CommonTypes.h"
|
||||
#include "LogManager.h"
|
||||
#include "Thread.h"
|
||||
@ -49,7 +50,7 @@ SoundStream *soundStream = NULL;
|
||||
bool g_InitMixer = false;
|
||||
|
||||
bool bIsRunning = false;
|
||||
u32 cycle_count = 0;
|
||||
volatile u32 cycle_count = 0;
|
||||
|
||||
// Standard crap to make wxWidgets happy
|
||||
#ifdef _WIN32
|
||||
@ -219,17 +220,19 @@ THREAD_RETURN dsp_thread(void* lpParameter)
|
||||
{
|
||||
while (bIsRunning)
|
||||
{
|
||||
u32 cycles = 0;
|
||||
|
||||
if (jit)
|
||||
{
|
||||
cycles = cycle_count;
|
||||
DSPCore_RunCycles(cycles);
|
||||
int cycles = (int)cycle_count;
|
||||
if (cycles > 0) {
|
||||
if (jit)
|
||||
{
|
||||
cycles -= DSPCore_RunCycles(cycles);
|
||||
}
|
||||
else {
|
||||
cycles -= DSPInterpreter::RunCycles(cycles);
|
||||
}
|
||||
Common::AtomicAdd(cycle_count, -cycles);
|
||||
}
|
||||
else
|
||||
DSPInterpreter::Run();
|
||||
|
||||
cycle_count -= cycles;
|
||||
// yield?
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -374,7 +377,8 @@ void DSP_WriteMailboxLow(bool _CPUMailbox, u16 _uLowMail)
|
||||
|
||||
void DSP_Update(int cycles)
|
||||
{
|
||||
int cyclesRatio = cycles / (jit?20:6);
|
||||
int dsp_cycles = cycles / 6; //(jit?20:6);
|
||||
|
||||
// Sound stream update job has been handled by AudioDMA routine, which is more efficient
|
||||
/*
|
||||
// This gets called VERY OFTEN. The soundstream update might be expensive so only do it 200 times per second or something.
|
||||
@ -398,11 +402,14 @@ void DSP_Update(int cycles)
|
||||
if (!g_dspInitialize.bOnThread)
|
||||
{
|
||||
// ~1/6th as many cycles as the period PPC-side.
|
||||
DSPCore_RunCycles(cyclesRatio);;
|
||||
DSPCore_RunCycles(dsp_cycles);
|
||||
}
|
||||
else
|
||||
{
|
||||
cycle_count += (cyclesRatio);
|
||||
// Wait for dsp thread to catch up reasonably. Note: this logic should be thought through.
|
||||
while (cycle_count > dsp_cycles)
|
||||
;
|
||||
Common::AtomicAdd(cycle_count, dsp_cycles);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user