From ab9d38481390b570650ca69b97088c60edc65a99 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 12 Jan 2014 23:43:58 -0800 Subject: [PATCH] Passing samples. --- src/xenia/apu/xaudio2/xaudio2_audio_system.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/xenia/apu/xaudio2/xaudio2_audio_system.cc b/src/xenia/apu/xaudio2/xaudio2_audio_system.cc index 2c3b8088d..ba7cda211 100644 --- a/src/xenia/apu/xaudio2/xaudio2_audio_system.cc +++ b/src/xenia/apu/xaudio2/xaudio2_audio_system.cc @@ -74,16 +74,17 @@ void XAudio2AudioSystem::SubmitFrame(uint32_t samples_ptr) { // Process samples! They are big-endian floats. HRESULT hr; - auto samples = reinterpret_cast(emulator_->memory()->membase() + samples_ptr); - for (int i = 0; i < _countof(samples_); ++i) - { - samples_[i] = XESWAPF32BE(*samples++); + int sample_count = 6 * 256; + auto samples = reinterpret_cast( + emulator_->memory()->membase() + samples_ptr); + for (int i = 0; i < sample_count; ++i) { + samples_[i] = XESWAPF32BE(*(samples + i)); } // this is dumb and not right. XAUDIO2_BUFFER buffer; buffer.Flags = 0; - buffer.AudioBytes = sizeof(samples_); + buffer.AudioBytes = sample_count * sizeof(float); buffer.pAudioData = reinterpret_cast(samples_); buffer.PlayBegin = 0; buffer.PlayLength = 0;