Fix for shorten bug at 48000 output rate.

This commit is contained in:
vspader 2007-05-16 22:56:54 +00:00
parent 2659c1905c
commit 0be36644a6
3 changed files with 18 additions and 9 deletions

View file

@ -1,6 +1,6 @@
<html> <html>
<body style="text-align:center;"> <body style="text-align:center;">
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.
<br /><br /> <br /><br />
This program has been made possible through contributions from users like you. This program has been made possible through contributions from users like you.
</body> </body>

View file

@ -27,7 +27,7 @@
decoder->open([[url path] UTF8String], true); 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); decoder->file_info(NULL, &channels, &frequency, NULL, &bitsPerSample, NULL);
@ -47,7 +47,8 @@
totalRead = 0; 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; amountToRead = size - totalRead;
if (amountToRead > bufferSize) { if (amountToRead > bufferSize) {
amountToRead = bufferSize; amountToRead = bufferSize;
@ -55,15 +56,16 @@
do do
{ {
amountRead = decoder->read(((char *)buf) + totalRead, amountToRead); amountRead = decoder->read(buf, amountToRead);
} while(amountRead == -1); } while(amountRead == -1 && totalRead == 0);
if (amountRead <= 0) { // if (amountRead <= 0) {
return totalRead; // return totalRead;
} // }
totalRead += amountRead; totalRead += amountRead;
} // buf = (void *)((char *)buf + amountRead);
// }
return totalRead; return totalRead;
} }

7
TODO
View file

@ -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