changeset 147:6fe2bfbe6fc2 trunk

[svn] Move SPC-specific code into SPC-specific routines.
author nenolod
date Thu, 10 Nov 2005 18:05:56 -0800
parents 4309d2df6586
children fe9cb5132263
files Plugins/Input/console/Audacious_Driver.cpp Plugins/Input/console/Audacious_Driver.h
diffstat 2 files changed, 28 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/console/Audacious_Driver.cpp	Thu Nov 10 17:52:13 2005 -0800
+++ b/Plugins/Input/console/Audacious_Driver.cpp	Thu Nov 10 18:05:56 2005 -0800
@@ -35,7 +35,7 @@
 static Spc_Emu *spc = NULL;
 static GThread *decode_thread;
 
-static void *play_loop(gpointer arg);
+static void *play_loop_spc(gpointer arg);
 static void console_init(void);
 extern "C" void console_aboutbox(void);
 static void console_stop(void);
@@ -43,6 +43,7 @@
 static int get_time(void);
 static gboolean console_ip_is_going;
 extern InputPlugin console_ip;
+static int playing_type;
 
 static int is_our_file(gchar *filename)
 {
@@ -102,7 +103,7 @@
 		(*length) = -1;
 }
 
-static void play_file(char *filename)
+static void play_file_spc(char *filename)
 {
 	gchar *name;
 	Emu_Std_Reader reader;
@@ -132,7 +133,22 @@
         if (!console_ip.output->open_audio(MY_FMT, 32000, 2))
                  return;
 
-	decode_thread = g_thread_create(play_loop, spc, TRUE, NULL);
+	playing_type = PLAY_TYPE_SPC;
+
+	decode_thread = g_thread_create(play_loop_spc, spc, TRUE, NULL);
+}
+
+static void play_file(char *filename)
+{
+	gchar *ext;
+
+	ext = strrchr(filename, '.');
+
+	if (ext)
+	{
+		if (!strcasecmp(ext, ".spc"))
+			play_file_spc(filename);
+	}
 }
 
 static void seek(gint time)
@@ -185,7 +201,7 @@
         console_ip.output->pause(p);
 }
 
-static void *play_loop(gpointer arg)
+static void *play_loop_spc(gpointer arg)
 {
 	Spc_Emu *my_spc = (Spc_Emu *) arg;
         Music_Emu::sample_t buf[1024];
@@ -210,6 +226,7 @@
         delete spc;
         console_ip.output->close_audio();
 	console_ip_is_going = FALSE;
+	playing_type = PLAY_TYPE_NONE;
         g_thread_exit(NULL);
 
         return NULL;
--- a/Plugins/Input/console/Audacious_Driver.h	Thu Nov 10 17:52:13 2005 -0800
+++ b/Plugins/Input/console/Audacious_Driver.h	Thu Nov 10 18:05:56 2005 -0800
@@ -49,4 +49,11 @@
 	gint resample_rate;	// rate to resample at
 };
 
+#define PLAY_TYPE_NONE		0
+#define PLAY_TYPE_SPC		1
+#define PLAY_TYPE_NSF		2
+#define PLAY_TYPE_VGM		3
+#define PLAY_TIME_GBS		4
+#define PLAY_TYPE_GYM		5
+
 #endif