Mercurial > audlegacy-plugins
changeset 1449:e92d0f4d2793
merge
author | Cristi Magherusan <majeru@atheme-project.org> |
---|---|
date | Mon, 06 Aug 2007 02:58:04 +0300 |
parents | 7b3290336f3b (current diff) 394738ae11dc (diff) |
children | 69bff388b0f8 |
files | |
diffstat | 3 files changed, 27 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/src/adplug/adplug-xmms.cc Mon Aug 06 02:52:19 2007 +0300 +++ b/src/adplug/adplug-xmms.cc Mon Aug 06 02:58:04 2007 +0300 @@ -724,7 +724,7 @@ if (!fd) { plr.playing = false; - g_thread_exit (NULL); + return (NULL); } // Try to load module @@ -734,7 +734,7 @@ dbg_printf ("error!\n"); // MessageBox("AdPlug :: Error", "File could not be opened!", "Ok"); plr.playing = false; - g_thread_exit (NULL); + return (NULL); } // Cache song length @@ -851,7 +851,6 @@ plr.playing = false; // important! XMMS won't get a self-ended song without it. dbg_printf (".\n"); vfs_fclose (fd); - g_thread_exit (NULL); return (NULL); } @@ -987,9 +986,10 @@ plr.time_ms = 0.0f; plr.seek = -1; - // start player thread - dbg_printf ("create"); - plr.play_thread = g_thread_create (play_loop, playback, TRUE, NULL); + // start player func + dbg_printf ("play"); + plr.play_thread = g_thread_self(); + play_loop(playback); dbg_printf (".\n"); }
--- a/src/timidity/src/xmms-timidity.c Mon Aug 06 02:52:19 2007 +0300 +++ b/src/timidity/src/xmms-timidity.c Mon Aug 06 02:58:04 2007 +0300 @@ -84,8 +84,6 @@ static gboolean xmmstimid_audio_error = FALSE; static MidSongOptions xmmstimid_opts; static MidSong *xmmstimid_song; -static gboolean xmmstimid_going; -static gboolean xmmstimid_eof; static gint xmmstimid_seek_to; static GtkWidget *xmmstimid_conf_wnd = NULL, *xmmstimid_about_wnd = NULL; @@ -273,19 +271,26 @@ xmmstimid_opts.buffer_size; buffer = g_malloc(buffer_size); - if (buffer == NULL) g_thread_exit(NULL); + if (buffer == NULL) return(NULL); fmt = (xmmstimid_opts.format == MID_AUDIO_S16LSB) ? FMT_S16_LE : FMT_S8; - while (xmmstimid_going) { + while (playback->playing) { bytes_read = mid_song_read_wave(xmmstimid_song, buffer, buffer_size); if (bytes_read != 0) produce_audio(mid_song_get_time(xmmstimid_song), fmt, xmmstimid_opts.channels, - bytes_read, buffer, &xmmstimid_going); - else xmmstimid_eof = TRUE; + bytes_read, buffer, &playback->playing); + else { + playback->eof = TRUE; + playback->output->buffer_free (); + playback->output->buffer_free (); + while (playback->output->buffer_playing()) + g_usleep(10000); + playback->playing = FALSE; + } if (xmmstimid_seek_to != -1) { mid_song_seek(xmmstimid_song, xmmstimid_seek_to * 1000); @@ -296,7 +301,6 @@ } g_free(buffer); - g_thread_exit(NULL); return(NULL); } @@ -381,20 +385,17 @@ g_free(title); mid_song_start(xmmstimid_song); - xmmstimid_going = TRUE; - xmmstimid_eof = FALSE; + playback->playing = TRUE; + playback->eof = FALSE; xmmstimid_seek_to = -1; - xmmstimid_decode_thread = g_thread_create((GThreadFunc)xmmstimid_play_loop, playback, TRUE, NULL); - if (xmmstimid_decode_thread == NULL) { - mid_song_free(xmmstimid_song); - xmmstimid_stop(playback); - } + xmmstimid_decode_thread = g_thread_self(); + xmmstimid_play_loop(playback); } void xmmstimid_stop(InputPlayback * playback) { - if (xmmstimid_song != NULL && xmmstimid_going) { - xmmstimid_going = FALSE; + if (xmmstimid_song != NULL && playback->playing) { + playback->playing = FALSE; g_thread_join(xmmstimid_decode_thread); playback->output->close_audio(); mid_song_free(xmmstimid_song); @@ -408,7 +409,7 @@ void xmmstimid_seek(InputPlayback * playback, int time) { xmmstimid_seek_to = time; - xmmstimid_eof = FALSE; + playback->eof = FALSE; while (xmmstimid_seek_to != -1) xmms_usleep(10000); @@ -419,7 +420,7 @@ return -2; if (xmmstimid_song == NULL) return -1; - if (!xmmstimid_going || (xmmstimid_eof && + if (!playback->playing || (playback->eof && playback->output->buffer_playing())) return -1;
--- a/src/tonegen/tonegen.c Mon Aug 06 02:52:19 2007 +0300 +++ b/src/tonegen/tonegen.c Mon Aug 06 02:58:04 2007 +0300 @@ -121,7 +121,6 @@ playback->output->buffer_free(); playback->output->buffer_free(); - g_thread_exit(NULL); return(NULL); } @@ -202,7 +201,8 @@ tone_ip.set_info(name, -1, 16 * OUTPUT_FREQ, OUTPUT_FREQ, 1); g_free(name); playback->data = frequencies; - play_thread = g_thread_create((GThreadFunc)play_loop, playback, TRUE, NULL); + play_thread = g_thread_self(); + play_loop(playback); } static void tone_stop(InputPlayback *playback)