mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-23 23:36:18 +00:00
Additional streaming behaviour fix for XAudio2 driver
This commit is contained in:
parent
dd454ad543
commit
2c81edcf56
1 changed files with 8 additions and 21 deletions
|
@ -398,30 +398,16 @@ void CSourceXAudio2::submitStreamingBuffer(IBuffer *buffer)
|
||||||
|
|
||||||
nlassert(_BufferStreaming);
|
nlassert(_BufferStreaming);
|
||||||
|
|
||||||
|
// allow to change the format if not playing
|
||||||
|
if (!_IsPlaying)
|
||||||
|
{
|
||||||
IBuffer::TBufferFormat bufferFormat;
|
IBuffer::TBufferFormat bufferFormat;
|
||||||
uint8 channels;
|
uint8 channels;
|
||||||
uint8 bitsPerSample;
|
uint8 bitsPerSample;
|
||||||
uint32 frequency;
|
uint32 frequency;
|
||||||
buffer->getFormat(bufferFormat, channels, bitsPerSample, frequency);
|
buffer->getFormat(bufferFormat, channels, bitsPerSample, frequency);
|
||||||
// allow to change the format if not playing
|
|
||||||
if (!_IsPlaying)
|
|
||||||
{
|
|
||||||
if (!_SourceVoice)
|
|
||||||
{
|
|
||||||
// if no source yet, prepare the format
|
|
||||||
preparePlay(bufferFormat, channels, bitsPerSample, frequency);
|
preparePlay(bufferFormat, channels, bitsPerSample, frequency);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
XAUDIO2_VOICE_STATE voice_state;
|
|
||||||
_SourceVoice->GetState(&voice_state);
|
|
||||||
// if no buffers queued, prepare the format
|
|
||||||
if (!voice_state.BuffersQueued)
|
|
||||||
{
|
|
||||||
preparePlay(bufferFormat, channels, bitsPerSample, frequency);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
submitBuffer(static_cast<CBufferXAudio2 *>(buffer));
|
submitBuffer(static_cast<CBufferXAudio2 *>(buffer));
|
||||||
}
|
}
|
||||||
|
@ -636,6 +622,7 @@ bool CSourceXAudio2::play()
|
||||||
// preparePlay already called,
|
// preparePlay already called,
|
||||||
// stop already called before going into buffer streaming
|
// stop already called before going into buffer streaming
|
||||||
nlassert(!_IsPlaying);
|
nlassert(!_IsPlaying);
|
||||||
|
nlassert(_SourceVoice);
|
||||||
_PlayStart = CTime::getLocalTime();
|
_PlayStart = CTime::getLocalTime();
|
||||||
if (SUCCEEDED(_SourceVoice->Start(0))) _IsPlaying = true;
|
if (SUCCEEDED(_SourceVoice->Start(0))) _IsPlaying = true;
|
||||||
else nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED Play (_BufferStreaming)");
|
else nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED Play (_BufferStreaming)");
|
||||||
|
|
Loading…
Reference in a new issue