From 0be36644a6e35e564cfdd587986d1376edd56b57 Mon Sep 17 00:00:00 2001 From: vspader Date: Wed, 16 May 2007 22:56:54 +0000 Subject: [PATCH] Fix for shorten bug at 48000 output rate. --- Credits.html | 2 +- Plugins/Shorten/ShortenDecoder.mm | 18 ++++++++++-------- TODO | 7 +++++++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Credits.html b/Credits.html index 8696aad95..22688dc54 100644 --- a/Credits.html +++ b/Credits.html @@ -1,6 +1,6 @@ -Cog is dedicated to snacos, the ungodly combination of snacks and tacos. +Cog is brought to you by the letter Q and the number 14.

This program has been made possible through contributions from users like you. diff --git a/Plugins/Shorten/ShortenDecoder.mm b/Plugins/Shorten/ShortenDecoder.mm index 5427ec6b8..7544757e3 100644 --- a/Plugins/Shorten/ShortenDecoder.mm +++ b/Plugins/Shorten/ShortenDecoder.mm @@ -27,7 +27,7 @@ decoder->open([[url path] UTF8String], true); - bufferSize = decoder->shn_get_buffer_block_size(512); + bufferSize = decoder->shn_get_buffer_block_size(NUM_DEFAULT_BUFFER_BLOCKS); decoder->file_info(NULL, &channels, &frequency, NULL, &bitsPerSample, NULL); @@ -47,7 +47,8 @@ totalRead = 0; - while (totalRead < size) { + //For some reason the busy loop is causing pops when output is set to 48000. Probably CPU starvation, since the SHN decoder seems to use a multithreaded approach. +// while (totalRead < size) { amountToRead = size - totalRead; if (amountToRead > bufferSize) { amountToRead = bufferSize; @@ -55,15 +56,16 @@ do { - amountRead = decoder->read(((char *)buf) + totalRead, amountToRead); - } while(amountRead == -1); + amountRead = decoder->read(buf, amountToRead); + } while(amountRead == -1 && totalRead == 0); - if (amountRead <= 0) { - return totalRead; - } +// if (amountRead <= 0) { +// return totalRead; +// } totalRead += amountRead; - } +// buf = (void *)((char *)buf + amountRead); +// } return totalRead; } diff --git a/TODO b/TODO index e69de29bb..2d2fbd4ec 100644 --- a/TODO +++ b/TODO @@ -0,0 +1,7 @@ +Bug fixes: + Short files: http://sbooth.org/forums/viewtopic.php?p=4304 + Broken MP3: http://sbooth.org/forums/viewtopic.php?t=1103 + Shorten files: http://sbooth.org/forums/viewtopic.php?p=4305 + Windows M3U paths: http://sbooth.org/forums/viewtopic.php?t=1209 + Playlist display: http://sbooth.org/forums/viewtopic.php?t=1050 +