mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-22 23:25:34 +00:00
ALSA: pause gives error when state is invalid
This commit is contained in:
parent
4a0b3579d4
commit
2a68f63079
|
@ -1015,6 +1015,7 @@ SOUNDIO_EXPORT int soundio_outstream_clear_buffer(struct SoundIoOutStream *outst
|
|||
/// * #SoundIoErrorIncompatibleDevice - device does not support
|
||||
/// pausing/unpausing. This error code might not be returned even if the
|
||||
/// device does not support pausing/unpausing.
|
||||
/// * #SoundIoErrorInvalid - outstream not opened and started
|
||||
SOUNDIO_EXPORT int soundio_outstream_pause(struct SoundIoOutStream *outstream, bool pause);
|
||||
|
||||
/// Obtain the total number of seconds that the next frame written after the
|
||||
|
|
|
@ -1459,8 +1459,14 @@ static int outstream_clear_buffer_alsa(SoundIoPrivate *si,
|
|||
}
|
||||
|
||||
static int outstream_pause_alsa(struct SoundIoPrivate *si, struct SoundIoOutStreamPrivate *os, bool pause) {
|
||||
if (!si)
|
||||
return SoundIoErrorInvalid;
|
||||
|
||||
SoundIoOutStreamAlsa *osa = &os->backend_data.alsa;
|
||||
|
||||
if (!osa->handle)
|
||||
return SoundIoErrorInvalid;
|
||||
|
||||
if (osa->is_paused == pause)
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue