summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-10-30 15:51:46 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-10-30 15:51:46 +0200
commit6ddcd3f630b33d0d962327a2eff1f8e6e42e75d0 (patch)
treecb3e2a98e0586e652086838d639b44f20f06f4f0
parent859a0349f1afd45010c0f619521bd35cf1d84f0f (diff)
use snd_pcm_drain before closing
Just so that we reuse code. Stopping may imply more state changes than just started = false in future, and it's good to have these in same place.
-rw-r--r--libasound.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libasound.c b/libasound.c
index be67601..1733056 100644
--- a/libasound.c
+++ b/libasound.c
@@ -169,8 +169,8 @@ snd_pcm_close(snd_pcm_t *pcm)
int
snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock)
{
+ snd_pcm_drain(pcm);
sio_close(pcm->hdl);
- pcm->started = false;
if (!(pcm->hdl = device_open(pcm->name, pcm->stream, (nonblock ? SND_PCM_NONBLOCK : false))))
return -1;