# HG changeset patch # User chainsaw # Date 1162652642 28800 # Node ID a927c96885844c06d7f28c8cc41ad9e991c015a0 # Parent 0962114e7626ef81271d62c986f4a063a9d6a0ac [svn] Port pthread -> gthread, port audio output to produce_audio, sprinkle debug printfs. Still broken, good luck diff -r 0962114e7626 -r a927c9688584 ChangeLog --- a/ChangeLog Sat Nov 04 06:06:27 2006 -0800 +++ b/ChangeLog Sat Nov 04 07:04:02 2006 -0800 @@ -1,3 +1,10 @@ +2006-11-04 14:06:27 +0000 Tony Vroon + revision [422] + Yes SVN, that too! + trunk/src/sap/saplib/Makefile | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + + 2006-11-04 14:05:38 +0000 Tony Vroon revision [420] Build this thing in a proper two-stage process. As it hardlocks instead of playing it is not built by default yet. diff -r 0962114e7626 -r a927c9688584 src/sap/fileinfo.c --- a/src/sap/fileinfo.c Sat Nov 04 06:06:27 2006 -0800 +++ b/src/sap/fileinfo.c Sat Nov 04 07:04:02 2006 -0800 @@ -23,7 +23,6 @@ #include #include #include -#include #include "fileinfo.h" #include "saplib/sapLib.h" diff -r 0962114e7626 -r a927c9688584 src/sap/sap_plug.c --- a/src/sap/sap_plug.c Sat Nov 04 06:06:27 2006 -0800 +++ b/src/sap/sap_plug.c Sat Nov 04 07:04:02 2006 -0800 @@ -24,7 +24,6 @@ #include #include #include -#include #include "sap_plug.h" @@ -80,27 +79,23 @@ 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) { sapRenderBuffer(play_buf,N_RENDER); - /* for spectrum analyser */ - sap_ip.add_vis_pcm(sap_ip.output->written_time(), FMT_S16_NE, 2, N_RENDER, play_buf); - - while (sap_ip.output->buffer_free() < ( N_RENDER << 2 ) && going) - - xmms_usleep(30000); if (going) - - sap_ip.output->write_audio(play_buf, datasize); + 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); } - + printf("Left play loop\n"); sap_ip.output->buffer_free(); sap_ip.output->buffer_free(); - pthread_exit(NULL); + printf("Double buffer free completed, thread is exiting now\n"); + g_thread_exit(NULL); } @@ -118,12 +113,13 @@ /* 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_LE, OUTPUT_FREQ, 2) == 0) { + if (sap_ip.output->open_audio(FMT_S16_NE, OUTPUT_FREQ, 2) == 0) { audio_error = TRUE; going = FALSE; @@ -138,17 +134,16 @@ g_string_free(titstr,TRUE); - pthread_create(&play_thread, NULL, play_loop, NULL); - - + printf("Launching play thread NOW\n"); + play_thread = g_thread_create((GThreadFunc)play_loop, NULL, TRUE, NULL); + xmms_usleep (40000); } static void sap_stop (void) { if (going) { - going = FALSE; - pthread_join(play_thread, NULL); + g_thread_join(play_thread); sap_ip.output->close_audio(); } } @@ -156,18 +151,15 @@ 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) { @@ -184,7 +176,7 @@ aboutbox = xmms_show_message( "About SAP Plugin", - "SAP Player plug-in v"VERSION"\nby Michal Szwaczko \n SAP library ver 0.3F by Adam Bienias\n\n" + "SAP Player plug-in v"VERSION"\nby Michal Szwaczko \nSAP 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);