Audio system update - HLE plugin submitted, homebrew has sound, and also Mario movies!! (this was very unexpected). This also acts as a frame limiter. Might provide an option to turn it off in the future.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@227 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-08-16 21:58:07 +00:00
parent dcd5ffeb7a
commit aa3fee8c60
57 changed files with 4438 additions and 104 deletions

View file

@ -163,32 +163,29 @@ void Mixer(short* buffer, int numSamples, int bits, int rate, int channels)
void DSP_Initialize(DSPInitialize _dspInitialize)
{
g_dspInitialize = _dspInitialize;
gdsp_init();
g_dsp.step_counter = 0;
g_dsp.cpu_ram = g_dspInitialize.pGetMemoryPointer(0);
g_dsp.irq_request = dspi_req_dsp_irq;
gdsp_reset();
if (!gdsp_load_rom("data\\dsp_rom.bin"))
{
g_dspInitialize = _dspInitialize;
gdsp_init();
g_dsp.step_counter = 0;
g_dsp.cpu_ram = g_dspInitialize.pGetMemoryPointer(0);
g_dsp.irq_request = dspi_req_dsp_irq;
gdsp_reset();
if (!gdsp_load_rom("data\\dsp_rom.bin"))
{
ErrorLog("Cannot load DSP ROM\n");
}
if (!gdsp_load_coef("data\\dsp_coef.bin"))
{
ErrorLog("Cannot load DSP COEF\n");
}
ErrorLog("Cannot load DSP ROM\n");
}
if (!gdsp_load_coef("data\\dsp_coef.bin"))
{
ErrorLog("Cannot load DSP COEF\n");
}
/* Dump UCode to file...
FILE* t = fopen("e:\\hmm.txt", "wb");
gd_globals_t gdg;
gd_dis_file(&gdg, "D:\\DSP_UCode.bin", t);
fclose(t); */
}
#ifdef _WIN32
#if _DEBUG
@ -200,13 +197,12 @@ void DSP_Initialize(DSPInitialize _dspInitialize)
pthread_create(&g_hDSPThread, NULL, dsp_thread, (void *)NULL);
#endif
#ifdef _WIN32
InitializeCriticalSection(&g_CriticalSection);
DSound::DSound_StartSound((HWND)g_dspInitialize.hWnd, 32000, Mixer);
#else
AOSound::AOSound_StartSound(32000, Mixer);
#endif
#ifdef _WIN32
InitializeCriticalSection(&g_CriticalSection);
DSound::DSound_StartSound((HWND)g_dspInitialize.hWnd, 48000, Mixer);
#else
AOSound::AOSound_StartSound(48000, Mixer);
#endif
}
@ -313,7 +309,7 @@ void DSP_WriteMailboxLow(bool _CPUMailbox, short unsigned int _uLowMail)
}
void DSP_Update()
void DSP_Update(int cycles)
{
if (g_hDSPThread)
{
@ -322,19 +318,19 @@ void DSP_Update()
#ifdef _WIN32
if (g_Dialog.CanDoStep())
{
gdsp_runx(100);
gdsp_runx(100); // cycles
}
#endif
}
#ifdef _WIN32
void DSP_SendAIBuffer(unsigned __int32 _Address, unsigned __int32 _Size)
void DSP_SendAIBuffer(unsigned int address, int sample_rate)
#else
void DSP_SendAIBuffer(unsigned int _Address, unsigned int _Size)
void DSP_SendAIBuffer(unsigned int address, int sample_rate)
#endif
{
uint32 Size = _Size * 16 * 2; // 16bit per sample, two channels
// uint32 Size = _Size * 16 * 2; // 16bit per sample, two channels
g_LastDMAAddress = _Address;
g_LastDMASize = Size;
g_LastDMAAddress = address;
g_LastDMASize = 32;
}