changeset 149:908ef215f340 trunk

[svn] basic resampling code.
author nenolod
date Thu, 10 Nov 2005 18:15:39 -0800
parents fe9cb5132263
children 1997ecd9dcb1
files Plugins/Input/console/Audacious_Driver.cpp
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/console/Audacious_Driver.cpp	Thu Nov 10 18:07:22 2005 -0800
+++ b/Plugins/Input/console/Audacious_Driver.cpp	Thu Nov 10 18:15:39 2005 -0800
@@ -123,12 +123,18 @@
 	gchar *name;
 	Emu_Std_Reader reader;
 	Spc_Emu::header_t header;
+	gint samplerate;
+
+	if (audcfg.resample == TRUE)
+		samplerate = audcfg.resample_rate;
+	else
+		samplerate = Spc_Emu::native_sample_rate;
 
 	reader.open(filename);
 	reader.read(&header, sizeof(header));
 
 	spc = new Spc_Emu;
-	spc->init(32000);
+	spc->init(samplerate);
 	spc->load(header, reader);
 	spc->start_track(0);
 
@@ -138,14 +144,14 @@
 
 	if (audcfg.loop_length)
 		console_ip.set_info(name, audcfg.loop_length * 1000, 
-			spc->voice_count() * 1000, 32000, 2);
+			spc->voice_count() * 1000, samplerate, 2);
 	else
-		console_ip.set_info(name, -1, spc->voice_count(), 32000, 2);
-
+		console_ip.set_info(name, -1, spc->voice_count() * 1000,
+			samplerate, 2);
 
 	g_free(name);
 
-        if (!console_ip.output->open_audio(MY_FMT, 32000, 2))
+        if (!console_ip.output->open_audio(MY_FMT, samplerate, 2))
                  return;
 
 	playing_type = PLAY_TYPE_SPC;