aboutsummaryrefslogtreecommitdiff
path: root/audio/alsaaudio.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/alsaaudio.c')
-rw-r--r--audio/alsaaudio.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index cfe4228..eddf013 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -602,7 +602,7 @@ static size_t alsa_write(HWVoiceOut *hw, void *buf, size_t len)
{
ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw;
size_t pos = 0;
- size_t len_frames = len >> hw->info.shift;
+ size_t len_frames = len / hw->info.bytes_per_frame;
while (len_frames) {
char *src = advance(buf, pos);
@@ -648,7 +648,7 @@ static size_t alsa_write(HWVoiceOut *hw, void *buf, size_t len)
}
}
- pos += written << hw->info.shift;
+ pos += written * hw->info.bytes_per_frame;
if (written < len_frames) {
break;
}
@@ -802,7 +802,8 @@ static size_t alsa_read(HWVoiceIn *hw, void *buf, size_t len)
void *dst = advance(buf, pos);
snd_pcm_sframes_t nread;
- nread = snd_pcm_readi(alsa->handle, dst, len >> hw->info.shift);
+ nread = snd_pcm_readi(
+ alsa->handle, dst, len / hw->info.bytes_per_frame);
if (nread <= 0) {
switch (nread) {
@@ -828,8 +829,8 @@ static size_t alsa_read(HWVoiceIn *hw, void *buf, size_t len)
}
}
- pos += nread << hw->info.shift;
- len -= nread << hw->info.shift;
+ pos += nread * hw->info.bytes_per_frame;
+ len -= nread * hw->info.bytes_per_frame;
}
return pos;