aboutsummaryrefslogtreecommitdiff
path: root/pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcm.c')
-rw-r--r--pcm.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/pcm.c b/pcm.c
index adc0495..3ba51ba 100644
--- a/pcm.c
+++ b/pcm.c
@@ -350,3 +350,22 @@ int pcm_is_ready(struct pcm *pcm)
{
return pcm->fd >= 0;
}
+
+int pcm_start(struct pcm *pcm)
+{
+ if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_PREPARE) < 0)
+ return oops(pcm, errno, "cannot prepare channel");
+ if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_START) < 0)
+ return oops(pcm, errno, "cannot start channel");
+
+ return 0;
+}
+
+int pcm_stop(struct pcm *pcm)
+{
+ if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_DROP) < 0)
+ return oops(pcm, errno, "cannot stop channel");
+
+ return 0;
+}
+