changeset 495:a371216b5c8a trunk

[svn] Close enough... does some sort of speedup for 3 seconds like timidity, but close enough.
author nenolod
date Tue, 24 Jan 2006 21:34:46 -0800
parents 0868188271e0
children e52d8e22e718
files Plugins/Input/console/Audacious_Driver.cpp Plugins/Input/console/Track_Emu.cpp Plugins/Input/console/Track_Emu.h
diffstat 3 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/console/Audacious_Driver.cpp	Tue Jan 24 21:03:30 2006 -0800
+++ b/Plugins/Input/console/Audacious_Driver.cpp	Tue Jan 24 21:34:46 2006 -0800
@@ -518,12 +518,12 @@
 		long s = pending_seek;
 		pending_seek = -1; // to do: use atomic swap
 		if ( s >= 0 )
-			track_emu.seek( s );
+			track_emu.seek( s * 1000 );
 		
 		// fill buffer
 		if ( track_emu.play( buf_size, buf ) )
 			console_ip_is_going = false;
-		produce_audio( console_ip.output->written_time(), FMT_S16_NE, 1, sizeof buf, buf, NULL );
+		produce_audio( track_emu.tell(), FMT_S16_NE, 1, sizeof buf, buf, NULL );
 	}
 	
 	// stop playing
@@ -637,7 +637,7 @@
 
 static int get_time(void)
 {
-	return console_ip_is_going ? console_ip.output->output_time() : -1;
+	return console_ip_is_going ? track_emu.tell() : -1;
 }
 
 // Setup
--- a/Plugins/Input/console/Track_Emu.cpp	Tue Jan 24 21:03:30 2006 -0800
+++ b/Plugins/Input/console/Track_Emu.cpp	Tue Jan 24 21:34:46 2006 -0800
@@ -65,6 +65,12 @@
 	sync( pos );
 }
 
+long Track_Emu::tell() const
+{
+	long rate = emu->sample_rate() * stereo;
+	return (out_time / rate * 1000) + (out_time % rate * 1000 / rate);
+}
+
 void Track_Emu::start_track( Music_Emu* e, int t, long length, bool ds )
 {
 // to do: remove
--- a/Plugins/Input/console/Track_Emu.h	Tue Jan 24 21:03:30 2006 -0800
+++ b/Plugins/Input/console/Track_Emu.h	Tue Jan 24 21:34:46 2006 -0800
@@ -15,6 +15,8 @@
 	
 	// Seek to new time in track
 	void seek( long msec );
+
+	long tell() const;
 	
 	// Play for 'count' samples and write to output buffer. Returns true when track
 	// has ended.