diff options
Diffstat (limited to 'audio/out/ao_oss.c')
-rw-r--r-- | audio/out/ao_oss.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c index a97424c1cb..09a2951629 100644 --- a/audio/out/ao_oss.c +++ b/audio/out/ao_oss.c @@ -457,7 +457,7 @@ static int get_space(struct ao *ao) if (ioctl(p->audio_fd, SNDCTL_DSP_GETOSPACE, &p->zz) != -1) { // calculate exact buffer space: playsize = p->zz.fragments * p->zz.fragsize; - return playsize; + return playsize / ao->sstride; } #endif @@ -475,14 +475,14 @@ static int get_space(struct ao *ao) } #endif - return p->outburst; + return p->outburst / ao->sstride; } // stop playing, keep buffers (for pause) static void audio_pause(struct ao *ao) { struct priv *p = ao->priv; - p->prepause_space = get_space(ao); + p->prepause_space = get_space(ao) * ao->sstride; #ifdef SNDCTL_DSP_RESET ioctl(p->audio_fd, SNDCTL_DSP_RESET, NULL); #else @@ -493,17 +493,18 @@ static void audio_pause(struct ao *ao) // plays 'len' bytes of 'data' // it should round it down to outburst*n // return: number of bytes played -static int play(struct ao *ao, void *data, int len, int flags) +static int play(struct ao *ao, void **data, int samples, int flags) { struct priv *p = ao->priv; + int len = samples * ao->sstride; if (len == 0) return len; if (len > p->outburst || !(flags & AOPLAY_FINAL_CHUNK)) { len /= p->outburst; len *= p->outburst; } - len = write(p->audio_fd, data, len); - return len; + len = write(p->audio_fd, data[0], len); + return len / ao->sstride; } // resume playing, after audio_pause() @@ -513,8 +514,7 @@ static void audio_resume(struct ao *ao) #ifndef SNDCTL_DSP_RESET reset(ao); #endif - int fillframes = (get_space(ao) - p->prepause_space) / - (af_fmt2bits(ao->format) / 8 * ao->channels.num); + int fillframes = get_space(ao) - p->prepause_space / ao->sstride; if (fillframes > 0) ao_play_silence(ao, fillframes); } |