Allow the game to set the DSP sample rate. Fixes Bomberman Generation.

Fixes issue 2523.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6328 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
skidau 2010-11-01 23:41:20 +00:00
parent 48859da6e3
commit 13dda74946
3 changed files with 11 additions and 2 deletions

View File

@ -393,6 +393,11 @@ void IncreaseSampleCount(const u32 _iAmount)
}
}
unsigned int GetDSPSampleRate()
{
return g_DACSampleRate;
}
void Update()
{
// update timer

View File

@ -40,6 +40,9 @@ unsigned int Callback_GetStreaming(short* _pDestBuffer, unsigned int _numSamples
void Read32(u32& _uReturnValue, const u32 _iAddress);
void Write32(const u32 _iValue, const u32 _iAddress);
// Get the audio rates (48000 or 32000 only)
unsigned int GetDSPSampleRate();
} // namespace
#endif

View File

@ -166,8 +166,9 @@ void DSPCallback(u64 userdata, int cyclesLate)
void AudioDMACallback(u64 userdata, int cyclesLate)
{
int period = CPU_CORE_CLOCK / (AudioInterface::GetDSPSampleRate() * 4 / 32);
DSP::UpdateAudioDMA(); // Push audio to speakers.
CoreTiming::ScheduleEvent(AUDIO_DMA_PERIOD - cyclesLate, et_AudioDMA);
CoreTiming::ScheduleEvent(period - cyclesLate, et_AudioDMA);
}
void IPC_HLE_UpdateCallback(u64 userdata, int cyclesLate)
@ -279,7 +280,7 @@ void Init()
AI_PERIOD = GetTicksPerSecond() / 80;
// System internal sample rate is fixed at 32KHz * 4 (16bit Stereo) / 32 bytes DMA
AUDIO_DMA_PERIOD = CPU_CORE_CLOCK / (32000 * 4 / 32);
AUDIO_DMA_PERIOD = CPU_CORE_CLOCK / (AudioInterface::GetDSPSampleRate() * 4 / 32);
Common::Timer::IncreaseResolution();
// store and convert localtime at boot to timebase ticks