Passing samples.

This commit is contained in:
Ben Vanik 2014-01-12 23:43:58 -08:00
parent edb1633fc9
commit ab9d384813
1 changed files with 6 additions and 5 deletions

View File

@ -74,16 +74,17 @@ void XAudio2AudioSystem::SubmitFrame(uint32_t samples_ptr) {
// Process samples! They are big-endian floats. // Process samples! They are big-endian floats.
HRESULT hr; HRESULT hr;
auto samples = reinterpret_cast<float*>(emulator_->memory()->membase() + samples_ptr); int sample_count = 6 * 256;
for (int i = 0; i < _countof(samples_); ++i) auto samples = reinterpret_cast<float*>(
{ emulator_->memory()->membase() + samples_ptr);
samples_[i] = XESWAPF32BE(*samples++); for (int i = 0; i < sample_count; ++i) {
samples_[i] = XESWAPF32BE(*(samples + i));
} }
// this is dumb and not right. // this is dumb and not right.
XAUDIO2_BUFFER buffer; XAUDIO2_BUFFER buffer;
buffer.Flags = 0; buffer.Flags = 0;
buffer.AudioBytes = sizeof(samples_); buffer.AudioBytes = sample_count * sizeof(float);
buffer.pAudioData = reinterpret_cast<BYTE*>(samples_); buffer.pAudioData = reinterpret_cast<BYTE*>(samples_);
buffer.PlayBegin = 0; buffer.PlayBegin = 0;
buffer.PlayLength = 0; buffer.PlayLength = 0;