# HG changeset patch # User nenolod # Date 1130914892 28800 # Node ID 05d05f290c04d47679c17e08d18c2622cb720698 # Parent 4b2b964a7694869a0e1798ea811a9a207e8db987 [svn] More stuffness. It *decodes*, but: - locks up the player afterwards - doesn't sound right. try it and see what i mean. diff -r 4b2b964a7694 -r 05d05f290c04 Plugins/Input/console/Audacious_Driver.cpp --- a/Plugins/Input/console/Audacious_Driver.cpp Tue Nov 01 21:53:40 2005 -0800 +++ b/Plugins/Input/console/Audacious_Driver.cpp Tue Nov 01 23:01:32 2005 -0800 @@ -25,10 +25,13 @@ static GThread *decode_thread; static void *play_loop(gpointer arg); +static void console_init(void); static void console_stop(void); static void console_pause(gshort p); static int get_time(void); +extern InputPlugin console_ip; + static int is_our_file(gchar *filename) { gchar *ext; @@ -83,6 +86,9 @@ decode_thread = g_thread_create(play_loop, spc, TRUE, NULL); + if (!console_ip.output->open_audio(FMT_S16_NE, 44100, 1)) + return; + printf("decode_thread started.\n"); } @@ -91,11 +97,6 @@ // XXX: Not yet implemented } -static void console_init(void) -{ - // nothing to do here -} - InputPlugin console_ip = { NULL, NULL, @@ -143,21 +144,15 @@ static void *play_loop(gpointer arg) { Spc_Emu *my_spc = (Spc_Emu *) arg; - Music_Emu::sample_t buf[1024]; + Music_Emu::sample_t buf[16384]; - printf("inside decode_thread, my_spc = %p, spc = %p\n", my_spc, spc); - - do + while (my_spc->play(16384, buf) == NULL) { - printf("buf = %s\n", buf); - produce_audio(console_ip.output->written_time(), - FMT_S16_LE, 2, 1024, (char *) buf, - NULL); - printf("writing audio to output device\n"); - xmms_usleep(100000); - } while (my_spc->play(1024, buf)); - - printf("we're through in decode_thread, cleaning up\n"); + console_ip.add_vis_pcm(console_ip.output->written_time(), + FMT_S16_NE, 1, 16384, buf); + while(console_ip.output->buffer_free() < 16384); + console_ip.output->write_audio(buf, 16384); + } delete spc; g_thread_exit(NULL); @@ -170,3 +165,8 @@ return console_ip.output->output_time(); } +static void console_init(void) +{ + +} + diff -r 4b2b964a7694 -r 05d05f290c04 Plugins/Input/console/Snes_Spc.cpp --- a/Plugins/Input/console/Snes_Spc.cpp Tue Nov 01 21:53:40 2005 -0800 +++ b/Plugins/Input/console/Snes_Spc.cpp Tue Nov 01 23:01:32 2005 -0800 @@ -5,6 +5,7 @@ #include #include +#include /* Copyright (C) 2004-2005 Shay Green. This module is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser @@ -423,7 +424,7 @@ blargg_err_t Snes_Spc::play( long count, sample_t* out ) { require( count % 2 == 0 ); // output is always in pairs of samples - + // CPU time() runs from -duration to 0 spc_time_t duration = (count / 2) * clocks_per_sample;