diff options
| author | skidau <skidau@gmail.com> | 2012-07-01 17:07:58 +1000 |
|---|---|---|
| committer | skidau <skidau@gmail.com> | 2012-07-01 17:07:58 +1000 |
| commit | c57640dfbd53b80b71d62b53c1f87a7f5fade12b (patch) | |
| tree | d85440d59c6ac66e0260fc70a70382b7408f7116 /Source/Core/AudioCommon/Src/NullSoundStream.cpp | |
| parent | b4ec836aca4392a86b864dc58b1030ca616fe0d5 (diff) | |
Implemented proper timing in the "No audio output" back-end.
Diffstat (limited to 'Source/Core/AudioCommon/Src/NullSoundStream.cpp')
| -rw-r--r-- | Source/Core/AudioCommon/Src/NullSoundStream.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/Core/AudioCommon/Src/NullSoundStream.cpp b/Source/Core/AudioCommon/Src/NullSoundStream.cpp index f42df9cc1f..db67b08a15 100644 --- a/Source/Core/AudioCommon/Src/NullSoundStream.cpp +++ b/Source/Core/AudioCommon/Src/NullSoundStream.cpp @@ -17,6 +17,8 @@ #include "AudioCommon.h" #include "NullSoundStream.h" +#include "../../Core/Src/HW/SystemTimers.h" +#include "../../Core/Src/HW/AudioInterface.h" void NullSound::SoundLoop() { @@ -33,9 +35,14 @@ void NullSound::SetVolume(int volume) void NullSound::Update() { - // This should equal AUDIO_DMA_PERIOD. TODO: Fix after DSP merge - int numBytesToRender = 32000 * 4 / 32; - m_mixer->Mix(realtimeBuffer, numBytesToRender / 4); + // num_samples_to_render in this update - depends on SystemTimers::AUDIO_DMA_PERIOD. + const u32 stereo_16_bit_size = 4; + const u32 dma_length = 32; + const u64 audio_dma_period = SystemTimers::GetTicksPerSecond() / (AudioInterface::GetAIDSampleRate() * stereo_16_bit_size / dma_length); + const u64 ais_samples_per_second = 48000 * stereo_16_bit_size; + const u64 num_samples_to_render = (audio_dma_period * ais_samples_per_second) / SystemTimers::GetTicksPerSecond(); + + m_mixer->Mix(realtimeBuffer, (unsigned int)num_samples_to_render); } void NullSound::Clear(bool mute) |
