Mercurial > audlegacy
comparison Plugins/Input/console/Audacious_Driver.cpp @ 528:980261e29f97 trunk
[svn] Patch for improved GYM/VGM file support ala blargg.
| author | nenolod |
|---|---|
| date | Fri, 27 Jan 2006 19:38:19 -0800 |
| parents | 626c86bda311 |
| children | d539e5c5f730 |
comparison
equal
deleted
inserted
replaced
| 527:68f20f7ac954 | 528:980261e29f97 |
|---|---|
| 48 static int console_ip_is_going; | 48 static int console_ip_is_going; |
| 49 static volatile long pending_seek; | 49 static volatile long pending_seek; |
| 50 extern InputPlugin console_ip; | 50 extern InputPlugin console_ip; |
| 51 static Music_Emu* emu = 0; | 51 static Music_Emu* emu = 0; |
| 52 static Track_Emu track_emu; | 52 static Track_Emu track_emu; |
| 53 static int track_ended; | |
| 53 | 54 |
| 54 static void unload_file() | 55 static void unload_file() |
| 55 { | 56 { |
| 56 delete emu; | 57 delete emu; |
| 57 emu = NULL; | 58 emu = NULL; |
| 518 console_ip.output->flush( s * 1000 ); | 519 console_ip.output->flush( s * 1000 ); |
| 519 track_emu.seek( s * 1000 ); | 520 track_emu.seek( s * 1000 ); |
| 520 } | 521 } |
| 521 | 522 |
| 522 // fill buffer | 523 // fill buffer |
| 523 if ( track_emu.play( buf_size, buf ) ) | 524 if ( track_ended ) |
| 524 console_ip_is_going = 0; | 525 { |
| 526 if ( track_ended++ > emu->sample_rate() * 3 / (buf_size / 2) ) | |
| 527 console_ip_is_going = false; | |
| 528 memset( buf, 0, sizeof buf ); | |
| 529 } | |
| 530 else if ( track_emu.play( buf_size, buf ) ) | |
| 531 { | |
| 532 track_ended = 1; | |
| 533 } | |
| 525 produce_audio( console_ip.output->written_time(), | 534 produce_audio( console_ip.output->written_time(), |
| 526 FMT_S16_NE, 1, sizeof buf, buf, | 535 FMT_S16_NE, 1, sizeof buf, buf, |
| 527 &console_ip_is_going ); | 536 &console_ip_is_going ); |
| 528 } | 537 } |
| 529 | 538 |
| 605 | 614 |
| 606 // start | 615 // start |
| 607 if ( !console_ip.output->open_audio( FMT_S16_NE, sample_rate, 2 ) ) | 616 if ( !console_ip.output->open_audio( FMT_S16_NE, sample_rate, 2 ) ) |
| 608 return; | 617 return; |
| 609 pending_seek = -1; | 618 pending_seek = -1; |
| 610 | 619 track_ended = 0; |
| 611 track_emu.start_track( emu, track, length, !has_length ); | 620 track_emu.start_track( emu, track, length, !has_length ); |
| 612 console_ip_is_going = 1; | 621 console_ip_is_going = 1; |
| 613 decode_thread = g_thread_create( play_loop_track, NULL, TRUE, NULL ); | 622 decode_thread = g_thread_create( play_loop_track, NULL, TRUE, NULL ); |
| 614 } | 623 } |
| 615 | 624 |
