make many-channel support work properly in winamp, add support in audacious

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@219 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
halleyscometsw 2008-06-12 00:06:35 +00:00
parent 6ca9d1fed6
commit fb7b381c69
2 changed files with 8 additions and 5 deletions

View File

@ -85,7 +85,7 @@ SIMPLE_INPUT_PLUGIN(vgmstream,vgmstream_iplist);
void* vgmstream_play_loop(InputPlayback *playback)
{
int16_t buffer[576*2];
int16_t buffer[576*vgmstream->channels];
long l;
gint seek_needed_samples;
gint samples_to_do;
@ -271,7 +271,7 @@ void vgmstream_play(InputPlayback *context)
char title[260];
// this is now called in a new thread context
vgmstream = init_vgmstream_from_STREAMFILE(open_vfs(context->filename));
if (!vgmstream || vgmstream->channels <= 0 || vgmstream->channels > 2)
if (!vgmstream || vgmstream->channels <= 0)
{
CLOSE_STREAM();
return;

View File

@ -392,15 +392,18 @@ void eq_set(int on, char data[10], int preamp) {}
/* the decode thread */
DWORD WINAPI __stdcall decode(void *arg) {
/* channel count shouldn't change during decode */
int max_buffer_samples = sizeof(sample_buffer)/sizeof(sample_buffer[0])/2/vgmstream->channels;
while (!decode_abort) {
int samples_to_do;
int l;
if (decode_pos_samples+576>stream_length_samples && (!loop_forever || !vgmstream->loop_flag))
if (decode_pos_samples+max_buffer_samples>stream_length_samples && (!loop_forever || !vgmstream->loop_flag))
samples_to_do=stream_length_samples-decode_pos_samples;
else
samples_to_do=576;
samples_to_do=max_buffer_samples;
/* play 'till the end of this seek, or note if we're done seeking */
if (seek_needed_samples != -1) {
@ -416,7 +419,7 @@ DWORD WINAPI __stdcall decode(void *arg) {
if (decode_pos_samples < seek_needed_samples) {
samples_to_do=seek_needed_samples-decode_pos_samples;
if (samples_to_do>576) samples_to_do=576;
if (samples_to_do>max_buffer_samples) samples_to_do=max_buffer_samples;
} else
seek_needed_samples = -1;