changeset 521:54cd4bac0c0a trunk

[svn] fixes via blargg.
author nenolod
date Thu, 26 Jan 2006 17:24:48 -0800
parents 1cf60c54c22d
children 60c744f652f4
files Plugins/Input/console/Track_Emu.cpp
diffstat 1 files changed, 16 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/console/Track_Emu.cpp	Thu Jan 26 16:35:44 2006 -0800
+++ b/Plugins/Input/console/Track_Emu.cpp	Thu Jan 26 17:24:48 2006 -0800
@@ -98,23 +98,19 @@
 
 void Track_Emu::fill_buf( bool check_silence )
 {
-	if ( !buf_count && !track_ended &&
-			emu_time - out_time < silence_max * stereo * emu->sample_rate() )
+	emu->play( buf_size, buf );
+	emu_time += buf_size;
+	if ( (check_silence || emu_time > fade_time) && is_silence( buf, buf_size ) )
 	{
-		emu->play( buf_size, buf );
-		emu_time += buf_size;
-		if ( (check_silence || emu_time > fade_time) && is_silence( buf, buf_size ) )
-		{
-			silence_count += buf_size;
-		}
-		else
-		{
-			silence_time = emu_time;
-			buf_count = buf_size;
-		}
-		if ( emu->track_ended() || emu->error_count() )
-			track_ended = true;
+		silence_count += buf_size;
 	}
+	else
+	{
+		silence_time = emu_time;
+		buf_count = buf_size;
+	}
+	if ( emu->track_ended() || emu->error_count() )
+		track_ended = true;
 }
 
 inline void Track_Emu::end_track()
@@ -156,7 +152,12 @@
 		
 		// keep internal buffer full and possibly run ahead
 		for ( int n = 6; n--; )
+		{
+			if ( buf_count || track_ended ||
+					emu_time - out_time > silence_max * stereo * emu->sample_rate() )
+				break;
 			fill_buf( detect_silence );
+		}
 	}
 	out_time += out_count;