summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-11-23 15:08:50 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-11-23 15:08:50 +0200
commit9f13450e50a314fff6b51b1c1cd711b38b81efc7 (patch)
treebf5776341aac5dc80c274a3066c5749ac82de56c
parent6f6450a51b8c5961fe78f725c1fc880a26731107 (diff)
make convert return frames instead of bytes
-rw-r--r--src/pcm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pcm.c b/src/pcm.c
index 548d043..89ce9d0 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -444,7 +444,7 @@ convert(snd_pcm_t *pcm, const size_t frames, const struct io *io, void *arg)
}
}
- return io_bytes;
+ return io_bytes / (params[ei].bps * chans);
}
static size_t
@@ -482,7 +482,7 @@ snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
snd_pcm_uframes_t ret;
if (pcm->hw.needs_conversion) {
- ret = snd_pcm_bytes_to_frames(pcm, convert(pcm, size, &io, &state));
+ ret = convert(pcm, size, &io, &state);
} else {
ret = snd_pcm_bytes_to_frames(pcm, io.write(buffer, snd_pcm_frames_to_bytes(pcm, size), &state));
}
@@ -528,7 +528,7 @@ snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
snd_pcm_uframes_t ret;
if (pcm->hw.needs_conversion) {
- ret = snd_pcm_bytes_to_frames(pcm, convert(pcm, size, &io, &state));
+ ret = convert(pcm, size, &io, &state);
} else {
ret = snd_pcm_bytes_to_frames(pcm, io.read(buffer, snd_pcm_frames_to_bytes(pcm, size), &state));
}