Merge pull request #272 from DrChat/rel_audio_fix

Fix release-mode audio
This commit is contained in:
Ben Vanik 2015-06-20 17:57:45 -07:00
commit 27ae555555
2 changed files with 8 additions and 2 deletions

View File

@ -302,7 +302,9 @@ X_STATUS AudioSystem::RegisterClient(uint32_t callback, uint32_t callback_arg,
auto index = unused_clients_.front();
auto client_semaphore = client_semaphores_[index];
assert_true(ReleaseSemaphore(client_semaphore, kMaximumQueuedFrames, NULL) == TRUE);
BOOL ret = ReleaseSemaphore(client_semaphore, kMaximumQueuedFrames, NULL);
assert_true(ret == TRUE);
AudioDriver* driver;
auto result = CreateDriver(index, client_semaphore, &driver);
if (XFAILED(result)) {
@ -511,6 +513,7 @@ int AudioSystem::PrepareXMAPacket(XMAContext &context, XMAContextData &data) {
// Still have data to read.
auto packet = input_buffer + input_offset_bytes;
assert_true(input_offset_bytes % 2048 == 0);
context.decoder->PreparePacket(packet, seq_offset_bytes,
XMAContextData::kBytesPerPacket,
sample_rate, channels);

View File

@ -26,7 +26,10 @@ class XAudio2AudioDriver::VoiceCallback : public IXAudio2VoiceCallback {
void OnStreamEnd() {}
void OnVoiceProcessingPassEnd() {}
void OnVoiceProcessingPassStart(uint32_t samples_required) {}
void OnBufferEnd(void* context) { assert_true(ReleaseSemaphore(semaphore_, 1, NULL) == TRUE); }
void OnBufferEnd(void* context) {
BOOL ret = ReleaseSemaphore(semaphore_, 1, NULL);
assert_true(ret == TRUE);
}
void OnBufferStart(void* context) {}
void OnLoopEnd(void* context) {}
void OnVoiceError(void* context, HRESULT result) {}