changeset 2750:6319a15e7243

Plugin is mostly usable now.
author William Pitcock <nenolod@atheme.org>
date Mon, 30 Jun 2008 23:39:49 -0500
parents 290357060cdb
children 533d73cfa1ff
files src/psf2/eng_psf2.c src/psf2/peops2/spu.c src/psf2/plugin.c
diffstat 3 files changed, 26 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/psf2/eng_psf2.c	Mon Jun 30 23:17:59 2008 -0500
+++ b/src/psf2/eng_psf2.c	Mon Jun 30 23:39:49 2008 -0500
@@ -590,14 +590,17 @@
 {	
 	int i;
 
-	for (i = 0; i < 44100 / 60; i++)
+	while (playback->playing && !playback->eof)
 	{
-		SPU2async(1, playback);
-		ps2_hw_slice();
+		for (i = 0; i < 44100 / 60; i++)
+		{
+			SPU2async(1, playback);
+			ps2_hw_slice();
+		}
+
+		ps2_hw_frame();
 	}
 
-	ps2_hw_frame();
-	
 	return AO_SUCCESS;
 }
 
--- a/src/psf2/peops2/spu.c	Mon Jun 30 23:17:59 2008 -0500
+++ b/src/psf2/peops2/spu.c	Mon Jun 30 23:39:49 2008 -0500
@@ -741,7 +741,7 @@
     	{
 		if(sampcount>=decayend) 
 		{
-//		       	ao_song_done = 1;
+			psf2_update(NULL, 0, data);
 		        return(0);
 		}
 
--- a/src/psf2/plugin.c	Mon Jun 30 23:17:59 2008 -0500
+++ b/src/psf2/plugin.c	Mon Jun 30 23:39:49 2008 -0500
@@ -174,15 +174,32 @@
 		psf2_execute(data);
 	}	
 
+	psf2_stop();
+
+	data->output->buffer_free();
+	data->output->buffer_free();
+
+	data->output->close_audio();
+
 	g_free(buffer);
 	g_free(path);
         g_free(title);
+
+	data->playing = FALSE;
 }
 
 void psf2_update(unsigned char *buffer, long count, InputPlayback *playback)
 {
 	const int mask = ~((((16 / 8) * 2)) - 1);
 
+	if (buffer == NULL)
+	{
+		playback->playing = FALSE;
+		playback->eof = TRUE;
+
+		return;
+	}
+
 	while (count > 0)
 	{
 		int t = playback->output->buffer_free() & mask;