summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/Src/NullSoundStream.cpp
diff options
context:
space:
mode:
authorMatthew Parlane <parlane@gmail.com>2013-01-01 23:28:46 +1300
committerMatthew Parlane <parlane@gmail.com>2013-01-01 23:28:46 +1300
commite0c9a1fd09b9be953bf0ae41b9014485e750b07e (patch)
tree059744e17a2a35ca58dd9b817cab620faee38611 /Source/Core/AudioCommon/Src/NullSoundStream.cpp
parentfe1fdc5e7b957312c906324134e42ca3484fa2d5 (diff)
parentc728ef2cd30ef803210d5db0a1ecab6b198a2c65 (diff)
Merge branch 'master' into wii-network
Conflicts: Source/Core/Common/Src/CommonPaths.h Source/Core/Core/CMakeLists.txt Source/Core/Core/Src/Boot/Boot_BS2Emu.cpp Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
Diffstat (limited to 'Source/Core/AudioCommon/Src/NullSoundStream.cpp')
-rw-r--r--Source/Core/AudioCommon/Src/NullSoundStream.cpp13
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)