# HG changeset patch # User nenolod # Date 1138419499 28800 # Node ID 980261e29f97bb36e9e364ca976c34b2083f5be7 # Parent 68f20f7ac9544abc443c64f5d645c4eda64aa549 [svn] Patch for improved GYM/VGM file support ala blargg. diff -r 68f20f7ac954 -r 980261e29f97 Plugins/Input/console/Audacious_Driver.cpp --- a/Plugins/Input/console/Audacious_Driver.cpp Fri Jan 27 15:10:44 2006 -0800 +++ b/Plugins/Input/console/Audacious_Driver.cpp Fri Jan 27 19:38:19 2006 -0800 @@ -50,6 +50,7 @@ extern InputPlugin console_ip; static Music_Emu* emu = 0; static Track_Emu track_emu; +static int track_ended; static void unload_file() { @@ -520,8 +521,16 @@ } // fill buffer - if ( track_emu.play( buf_size, buf ) ) - console_ip_is_going = 0; + if ( track_ended ) + { + if ( track_ended++ > emu->sample_rate() * 3 / (buf_size / 2) ) + console_ip_is_going = false; + memset( buf, 0, sizeof buf ); + } + else if ( track_emu.play( buf_size, buf ) ) + { + track_ended = 1; + } produce_audio( console_ip.output->written_time(), FMT_S16_NE, 1, sizeof buf, buf, &console_ip_is_going ); @@ -607,7 +616,7 @@ if ( !console_ip.output->open_audio( FMT_S16_NE, sample_rate, 2 ) ) return; pending_seek = -1; - + track_ended = 0; track_emu.start_track( emu, track, length, !has_length ); console_ip_is_going = 1; decode_thread = g_thread_create( play_loop_track, NULL, TRUE, NULL );