aboutsummaryrefslogtreecommitdiff
path: root/src/pcm.c
diff options
context:
space:
mode:
authorTaylor Holberton <taylorcholberton@gmail.com>2017-04-06 23:14:14 -0700
committerTaylor Holberton <taylorcholberton@gmail.com>2017-04-06 23:14:19 -0700
commitea06b977fabd88a3e22c89021ae8020baeebb427 (patch)
treef3700f189a2e550668fb6b8072043dd0b77c7c39 /src/pcm.c
parent851dd8073e08200836bf18c8d9c8283bbc35c299 (diff)
simplified pcm_read() and pcm_write()
Diffstat (limited to 'src/pcm.c')
-rw-r--r--src/pcm.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/pcm.c b/src/pcm.c
index 63afeb0..b4bbda1 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -48,6 +48,7 @@
#include <sound/asound.h>
#include <tinyalsa/pcm.h>
+#include <tinyalsa/limits.h>
#define PARAM_MAX SNDRV_PCM_HW_PARAM_LAST_INTERVAL
#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2)
@@ -626,11 +627,7 @@ int pcm_readi(struct pcm *pcm, void *data, unsigned int frame_count)
*/
int pcm_write(struct pcm *pcm, const void *data, unsigned int count)
{
- int ret = pcm_writei(pcm, data, pcm_bytes_to_frames(pcm, count));
- if (ret < 0){
- return ret;
- }
- return 0;
+ return pcm_writei(pcm, data, pcm_bytes_to_frames(pcm, count));
}
/** Reads audio samples from PCM.
@@ -646,11 +643,7 @@ int pcm_write(struct pcm *pcm, const void *data, unsigned int count)
*/
int pcm_read(struct pcm *pcm, void *data, unsigned int count)
{
- int ret = pcm_readi(pcm, data, pcm_bytes_to_frames(pcm, count));
- if (ret < 0) {
- return ret;
- }
- return 0;
+ return pcm_readi(pcm, data, pcm_bytes_to_frames(pcm, count));
}
static struct pcm bad_pcm = {