summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-10-31 08:14:47 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-10-31 08:14:47 +0200
commitf00bac8c036add21438fca10c779f2c03e70a2d5 (patch)
tree8e0f21f9e508a84b7b03361f4ad7c526e5fd8563
parentd5407e5d9b536007d5ae2d5d25367226163ef758 (diff)
implement snd_pcm_wait and snd_pcm_reset
-rw-r--r--libasound.c12
-rw-r--r--stubs.h2
2 files changed, 12 insertions, 2 deletions
diff --git a/libasound.c b/libasound.c
index 00bf1a6..5dcbdbe 100644
--- a/libasound.c
+++ b/libasound.c
@@ -283,6 +283,12 @@ snd_pcm_state(snd_pcm_t *pcm)
return SND_PCM_STATE_OPEN;
}
+int
+snd_pcm_wait(snd_pcm_t *pcm, int timeout)
+{
+ return 1; // we are always ready for io
+}
+
static size_t
io_do(snd_pcm_t *pcm, void *buffer, const size_t frames, size_t (*io)(struct sio_hdl*, void*, size_t))
{
@@ -451,6 +457,12 @@ snd_pcm_pause(snd_pcm_t *pcm, int enable)
return (enable ? snd_pcm_drain(pcm) : snd_pcm_start(pcm));
}
+int
+snd_pcm_reset(snd_pcm_t *pcm)
+{
+ return (!snd_pcm_drain(pcm) && !snd_pcm_prepare(pcm) ? 0 : -1);
+}
+
size_t
snd_pcm_hw_params_sizeof(void)
{
diff --git a/stubs.h b/stubs.h
index 19cd160..f51e679 100644
--- a/stubs.h
+++ b/stubs.h
@@ -492,7 +492,6 @@ snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler) { WARNX1("stu
int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info) { WARNX1("stub"); return 0; }
int snd_pcm_hw_free(snd_pcm_t *pcm) { WARNX1("stub"); return 0; }
int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params) { WARNX1("stub"); return 0; }
-int snd_pcm_reset(snd_pcm_t *pcm) { WARNX1("stub"); return 0; }
int snd_pcm_status(snd_pcm_t *pcm, snd_pcm_status_t *status) { WARNX1("stub"); return 0; }
int snd_pcm_hwsync(snd_pcm_t *pcm) { WARNX1("stub"); return 0; }
int snd_pcm_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_t *tstamp) { WARNX1("stub"); return 0; }
@@ -503,7 +502,6 @@ snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t *pcm) { WARNX1("stub"); return 0
snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames) { WARNX1("stub"); return 0; }
snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size) { WARNX1("stub"); return 0; }
snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size) { WARNX1("stub"); return 0; }
-int snd_pcm_wait(snd_pcm_t *pcm, int timeout) { WARNX1("stub"); return 0; }
int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2) { WARNX1("stub"); return 0; }
int snd_pcm_unlink(snd_pcm_t *pcm) { WARNX1("stub"); return 0; }
snd_pcm_chmap_query_t **snd_pcm_query_chmaps(snd_pcm_t *pcm) { WARNX1("stub"); return NULL; }