# HG changeset patch # User nenolod # Date 1162671524 28800 # Node ID d21151b929aee050523f8d849a777f5873a8584c # Parent 852009adbb68bb5701e649965dd8ba6df4cb9ce0 [svn] - gthread and produce_audio diff -r 852009adbb68 -r d21151b929ae ChangeLog --- a/ChangeLog Sat Nov 04 11:46:52 2006 -0800 +++ b/ChangeLog Sat Nov 04 12:18:44 2006 -0800 @@ -1,3 +1,12 @@ +2006-11-04 19:46:52 +0000 Aaron Sheldon + revision [428] + Get rid of compile warnings. Also, note that this is a one-line fix + despite appearances. + + trunk/src/sap/sap_plug.h | 88 +++++++++++++++++++++++------------------------ + 1 file changed, 44 insertions(+), 44 deletions(-) + + 2006-11-04 19:35:34 +0000 Aaron Sheldon revision [426] Add sap plugin to configure.ac stuff diff -r 852009adbb68 -r d21151b929ae src/sap/sap_plug.c --- a/src/sap/sap_plug.c Sat Nov 04 11:46:52 2006 -0800 +++ b/src/sap/sap_plug.c Sat Nov 04 12:18:44 2006 -0800 @@ -76,31 +76,23 @@ return 0; } -static void *play_loop (void *arg) { - - int datasize = N_RENDER << 2; - printf("In play loop, datasize is %i and going is %i\n", datasize, going); - while (going) { - +static void *play_loop (gpointer arg) +{ + while (going) + { sapRenderBuffer(play_buf,N_RENDER); - if (going) - produce_audio (sap_ip.output->written_time(), FMT_S16_NE, 2, N_RENDER, play_buf, &going); - - while (sap_ip.output->buffer_free() < ( N_RENDER << 2 ) && going) - xmms_usleep(30000); - + /* for spectrum analyser */ + produce_audio(sap_ip.output->written_time(), FMT_S16_NE, 2, N_RENDER, play_buf, &going); } - printf("Left play loop\n"); + sap_ip.output->buffer_free(); sap_ip.output->buffer_free(); - printf("Double buffer free completed, thread is exiting now\n"); g_thread_exit(NULL); - } -static void sap_play_file (char *filename) { - +static void sap_play_file (char *filename) +{ GString *titstr; if ((currentFile = sapLoadMusicFile(filename)) == NULL) return; @@ -113,13 +105,12 @@ /* we always start with 1st tune */ currentSong = 0; - printf("sapLoadMusicFile succesfully completed for %s, %i tunes present\n", filename, tunes); sapPlaySong(currentSong); going = TRUE; audio_error = FALSE; - if (sap_ip.output->open_audio(FMT_S16_NE, OUTPUT_FREQ, 2) == 0) { + if (sap_ip.output->open_audio(FMT_S16_LE, OUTPUT_FREQ, 2) == 0) { audio_error = TRUE; going = FALSE; @@ -134,14 +125,13 @@ g_string_free(titstr,TRUE); - printf("Launching play thread NOW\n"); - play_thread = g_thread_create((GThreadFunc)play_loop, NULL, TRUE, NULL); - xmms_usleep (40000); + play_thread = g_thread_create(play_loop, NULL, TRUE, NULL); } -static void sap_stop (void) { - - if (going) { +static void sap_stop (void) +{ + if (going) + { going = FALSE; g_thread_join(play_thread); sap_ip.output->close_audio(); @@ -151,15 +141,18 @@ static void sap_seek(int time) { if (currentSong != tunes) { + currentSong = (currentSong+1) % currentFile->numOfSongs; sapPlaySong(currentSong); sap_ip.output->flush(currentSong * 1000); + } } static void sap_pause(short paused) { sap_ip.output->pause(paused); + } static int sap_get_time(void) { @@ -176,7 +169,7 @@ aboutbox = xmms_show_message( "About SAP Plugin", - "SAP Player plug-in v"VERSION"\nby Michal Szwaczko \nSAP library ver 0.3F by Adam Bienias\n\n" + "SAP Player plug-in v"VERSION"\nby Michal Szwaczko \n SAP library ver 0.3F by Adam Bienias\n\n" "Get more POKEY sound from ASMA at:\n[http://asma.musichall.cz]\n\nEnjoy!", "Ok", FALSE, NULL, NULL); diff -r 852009adbb68 -r d21151b929ae src/sap/sap_plug.h --- a/src/sap/sap_plug.h Sat Nov 04 11:46:52 2006 -0800 +++ b/src/sap/sap_plug.h Sat Nov 04 12:18:44 2006 -0800 @@ -37,7 +37,7 @@ static gboolean going; static gboolean audio_error; -static GThread* play_thread; +GThread *play_thread; int currentSong; static int tunes;