Mercurial > audlegacy-plugins
changeset 212:a927c9688584 trunk
[svn] Port pthread -> gthread, port audio output to produce_audio, sprinkle debug printfs. Still broken, good luck
author | chainsaw |
---|---|
date | Sat, 04 Nov 2006 07:04:02 -0800 |
parents | 0962114e7626 |
children | dc19e2baf7e0 |
files | ChangeLog src/sap/fileinfo.c src/sap/sap_plug.c |
diffstat | 3 files changed, 21 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- 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 <chainsaw@gentoo.org> + 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 <chainsaw@gentoo.org> revision [420] Build this thing in a proper two-stage process. As it hardlocks instead of playing it is not built by default yet.
--- 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 <gtk/gtk.h> #include <audacious/util.h> #include <string.h> -#include <pthread.h> #include "fileinfo.h" #include "saplib/sapLib.h"
--- 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 <audacious/plugin.h> #include <glib.h> #include <string.h> -#include <pthread.h> #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 <mikey@scene.pl>\n SAP library ver 0.3F by Adam Bienias\n\n" + "SAP Player plug-in v"VERSION"\nby Michal Szwaczko <mikey@scene.pl>\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);