[FAudio]Correct the behavior of device_changed check
Fixes the behavior to take the timeout into account properly, fixing the throttled behavior so that it matches (or strives to) the configured value instead of being stuck at <90%
This commit is contained in:
parent
3c32bad886
commit
94752f8314
|
@ -59,6 +59,17 @@ int FAGetDev(FAudio* fa) {
|
||||||
|
|
||||||
class FAudio_BufferNotify : public FAudioVoiceCallback {
|
class FAudio_BufferNotify : public FAudioVoiceCallback {
|
||||||
public:
|
public:
|
||||||
|
FAudio_BufferNotify() {
|
||||||
|
OnBufferEnd = &FAudio_BufferNotify::StaticOnBufferEnd;
|
||||||
|
OnVoiceProcessingPassStart = &FAudio_BufferNotify::StaticOnVoiceProcessingPassStart;
|
||||||
|
OnVoiceProcessingPassEnd = &FAudio_BufferNotify::StaticOnVoiceProcessingPassEnd;
|
||||||
|
OnStreamEnd = &FAudio_BufferNotify::StaticOnStreamEnd;
|
||||||
|
OnBufferStart = &FAudio_BufferNotify::StaticOnBufferStart;
|
||||||
|
OnLoopEnd = &FAudio_BufferNotify::StaticOnLoopEnd;
|
||||||
|
OnVoiceError = &FAudio_BufferNotify::StaticOnVoiceError;
|
||||||
|
}
|
||||||
|
~FAudio_BufferNotify() = default;
|
||||||
|
|
||||||
// Waits for the buffer end event to be signaled for 10 seconds.
|
// Waits for the buffer end event to be signaled for 10 seconds.
|
||||||
// Returns true if the buffer end event was signaled, false if the wait timed out.
|
// Returns true if the buffer end event was signaled, false if the wait timed out.
|
||||||
bool WaitForSignal() {
|
bool WaitForSignal() {
|
||||||
|
@ -71,17 +82,6 @@ public:
|
||||||
return was_signaled;
|
return was_signaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
FAudio_BufferNotify() {
|
|
||||||
OnBufferEnd = &FAudio_BufferNotify::StaticOnBufferEnd;
|
|
||||||
OnVoiceProcessingPassStart = &FAudio_BufferNotify::StaticOnVoiceProcessingPassStart;
|
|
||||||
OnVoiceProcessingPassEnd = &FAudio_BufferNotify::StaticOnVoiceProcessingPassEnd;
|
|
||||||
OnStreamEnd = &FAudio_BufferNotify::StaticOnStreamEnd;
|
|
||||||
OnBufferStart = &FAudio_BufferNotify::StaticOnBufferStart;
|
|
||||||
OnLoopEnd = &FAudio_BufferNotify::StaticOnLoopEnd;
|
|
||||||
OnVoiceError = &FAudio_BufferNotify::StaticOnVoiceError;
|
|
||||||
}
|
|
||||||
~FAudio_BufferNotify() = default;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Signals that the buffer end event has occurred.
|
// Signals that the buffer end event has occurred.
|
||||||
void SignalBufferEnd() {
|
void SignalBufferEnd() {
|
||||||
|
@ -391,7 +391,7 @@ void FAudio_Output::write(uint16_t* finalWave, int) {
|
||||||
// the maximum number of buffers is currently queued
|
// the maximum number of buffers is currently queued
|
||||||
if (!coreOptions.speedup && coreOptions.throttle && !gba_joybus_active) {
|
if (!coreOptions.speedup && coreOptions.throttle && !gba_joybus_active) {
|
||||||
// wait for one buffer to finish playing
|
// wait for one buffer to finish playing
|
||||||
if (notify.WaitForSignal()) {
|
if (!notify.WaitForSignal()) {
|
||||||
device_changed = true;
|
device_changed = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue