mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-23 04:45:40 +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
|
/// * #SoundIoErrorIncompatibleDevice - device does not support
|
||||||
/// pausing/unpausing. This error code might not be returned even if the
|
/// pausing/unpausing. This error code might not be returned even if the
|
||||||
/// device does not support pausing/unpausing.
|
/// device does not support pausing/unpausing.
|
||||||
|
/// * #SoundIoErrorInvalid - outstream not opened and started
|
||||||
SOUNDIO_EXPORT int soundio_outstream_pause(struct SoundIoOutStream *outstream, bool pause);
|
SOUNDIO_EXPORT int soundio_outstream_pause(struct SoundIoOutStream *outstream, bool pause);
|
||||||
|
|
||||||
/// Obtain the total number of seconds that the next frame written after the
|
/// 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) {
|
static int outstream_pause_alsa(struct SoundIoPrivate *si, struct SoundIoOutStreamPrivate *os, bool pause) {
|
||||||
|
if (!si)
|
||||||
|
return SoundIoErrorInvalid;
|
||||||
|
|
||||||
SoundIoOutStreamAlsa *osa = &os->backend_data.alsa;
|
SoundIoOutStreamAlsa *osa = &os->backend_data.alsa;
|
||||||
|
|
||||||
|
if (!osa->handle)
|
||||||
|
return SoundIoErrorInvalid;
|
||||||
|
|
||||||
if (osa->is_paused == pause)
|
if (osa->is_paused == pause)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue