Mercurial > audlegacy
changeset 103:948027ac55be trunk
[svn] Stop playback when requested to by user.
author | nenolod |
---|---|
date | Wed, 02 Nov 2005 19:11:24 -0800 |
parents | de414e40f772 |
children | 04d4827ea8a4 |
files | Plugins/Input/console/Audacious_Driver.cpp |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Input/console/Audacious_Driver.cpp Wed Nov 02 18:38:59 2005 -0800 +++ b/Plugins/Input/console/Audacious_Driver.cpp Wed Nov 02 19:11:24 2005 -0800 @@ -35,6 +35,7 @@ static void console_stop(void); static void console_pause(gshort p); static int get_time(void); +static gboolean console_ip_is_going; extern InputPlugin console_ip; @@ -90,12 +91,12 @@ spc->load(header, reader); spc->start_track(0); + console_ip_is_going = TRUE; + decode_thread = g_thread_create(play_loop, spc, TRUE, NULL); if (!console_ip.output->open_audio(MY_FMT, 32000, 2)) return; - - printf("decode_thread started.\n"); } static void seek(gint time) @@ -132,6 +133,7 @@ static void console_stop(void) { + console_ip_is_going = FALSE; g_thread_join(decode_thread); console_ip.output->close_audio(); } @@ -152,11 +154,11 @@ Spc_Emu *my_spc = (Spc_Emu *) arg; Music_Emu::sample_t buf[4096]; - while (my_spc->play(4096, buf) == NULL) + while (my_spc->play(4096, buf) == NULL && console_ip_is_going == TRUE) { console_ip.add_vis_pcm(console_ip.output->written_time(), MY_FMT, 1, 4096, buf); - while(console_ip.output->buffer_free() < 4096) + while(console_ip.output->buffer_free() < 4096 && console_ip_is_going == TRUE) xmms_usleep(10000); console_ip.output->write_audio(buf, 8192); }