From 2d340744856e7e6a47f559244a1ce8f0081a67df Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Sat, 6 Feb 2010 17:26:54 +0100 Subject: fixed streaming of mono files --- streamer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/streamer.c b/streamer.c index 201f7025..2ac5d9b6 100644 --- a/streamer.c +++ b/streamer.c @@ -747,6 +747,7 @@ streamer_read_data_for_src (int16_t *buffer, int frames) { while (n >= 0) { buffer[n*2+0] = buffer[n]; buffer[n*2+1] = buffer[n]; + n--; } } return bytesread / (sizeof (int16_t) * channels); @@ -760,18 +761,20 @@ streamer_read_data_for_src_float (float *buffer, int frames) { channels = 2; } if (decoder->read_float32) { + { int bytesread = decoder->read_float32 ((uint8_t*)buffer, frames * sizeof (float) * channels); apply_replay_gain_float32 (&str_streaming_song, (uint8_t*)buffer, bytesread); if (channels == 1) { // convert to stereo int n = frames-1; while (n >= 0) { - buffer[n*2+0] = buffer[n]; buffer[n*2+1] = buffer[n]; + buffer[n*2+0] = buffer[n]; + n--; } - bytesread *= 2; } return bytesread / (sizeof (float) * channels); + } } // trace ("read_float32 not impl\n"); -- cgit v1.2.3