| 458 | } |
| 459 | |
| 460 | void AudioBackendXAudio2::Source_Stop(uint32 sourceID) |
| 461 | { |
| 462 | auto aSource = XAudio2::GetSource(sourceID); |
| 463 | if (aSource && aSource->Voice) |
| 464 | { |
| 465 | aSource->StartTimeForQueueBuffer = 0.0f; |
| 466 | aSource->LastBufferStartTime = 0.0f; |
| 467 | |
| 468 | // Pause |
| 469 | HRESULT hr = aSource->Voice->Stop(); |
| 470 | XAUDIO2_CHECK_ERROR(Stop); |
| 471 | aSource->IsPlaying = false; |
| 472 | |
| 473 | // Unset streaming buffers to rewind |
| 474 | hr = aSource->Voice->FlushSourceBuffers(); |
| 475 | XAUDIO2_CHECK_ERROR(FlushSourceBuffers); |
| 476 | Platform::Sleep(10); // TODO: find a better way to handle case when VoiceCallback::OnBufferEnd is called after source was stopped thus BuffersProcessed != 0, probably via buffers contexts ptrs |
| 477 | aSource->BuffersProcessed = 0; |
| 478 | aSource->Callback.PeekSamples(); |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | void AudioBackendXAudio2::Source_SetCurrentBufferTime(uint32 sourceID, float value) |
| 483 | { |
nothing calls this directly
no test coverage detected