From c73c5df5f53e464a57852399771707cc923a497a Mon Sep 17 00:00:00 2001 From: Andre Date: Mon, 17 Apr 2006 20:49:54 +0200 Subject: [PATCH] play.c: make alsa_write() take the number of _bytes_ to write rather than the number of frames. --- play.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/play.c b/play.c index f459e4dd..1a30285d 100644 --- a/play.c +++ b/play.c @@ -174,12 +174,13 @@ static void alsa_init(void) /** * push out pcm frames * \param data pointer do data to be written - * \param count number of frames + * \param nbytes number of bytes (not frames) * * \return Number of bytes written. Exit on errors. */ -int alsa_write(u_char *data, size_t count) +int alsa_write(u_char *data, size_t nbytes) { + size_t count = nbytes / bytes_per_frame; snd_pcm_sframes_t r, result = 0; while (count > 0) { /* write interleaved frames */ @@ -276,7 +277,7 @@ again: } p = audiobuf; while (loaded >= chunk_bytes) { - ret = alsa_write(p, chunk_size); + ret = alsa_write(p, chunk_bytes); p += ret; written += ret; loaded -= ret; -- 2.39.5