[Scummvm-cvs-logs] SF.net SVN: scummvm:[47193] scummvm/trunk/engines/sci/sound/softseq/pcjr. cpp

waltervn at users.sourceforge.net waltervn at users.sourceforge.net
Sat Jan 9 03:17:19 CET 2010


Revision: 47193
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47193&view=rev
Author:   waltervn
Date:     2010-01-09 02:17:17 +0000 (Sat, 09 Jan 2010)

Log Message:
-----------
SCI: Fix handling of output rate in PCJr driver

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sound/softseq/pcjr.cpp

Modified: scummvm/trunk/engines/sci/sound/softseq/pcjr.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/softseq/pcjr.cpp	2010-01-09 02:16:43 UTC (rev 47192)
+++ scummvm/trunk/engines/sci/sound/softseq/pcjr.cpp	2010-01-09 02:17:17 UTC (rev 47193)
@@ -27,7 +27,6 @@
 
 namespace Sci {
 
-#define FREQUENCY 44100
 #define VOLUME_SHIFT 3
 
 #define BASE_NOTE 129	// A10
@@ -163,6 +162,7 @@
 	int i;
 	int chan;
 	int freq[kMaxChannels];
+	int frequency = getRate();
 
 	for (chan = 0; chan < _channels_nr; chan++)
 		freq[chan] = get_freq(_notes[chan]);
@@ -176,20 +176,20 @@
 				             >> VOLUME_SHIFT;
 
 				_freq_count[chan] += freq[chan];
-				while (_freq_count[chan] >= (FREQUENCY << 1))
-					_freq_count[chan] -= (FREQUENCY << 1);
+				while (_freq_count[chan] >= (frequency << 1))
+					_freq_count[chan] -= (frequency << 1);
 
 				if (_freq_count[chan] - freq[chan] < 0) {
 					/* Unclean rising edge */
 					int l = volume << 1;
 					result += -volume + (l * _freq_count[chan]) / freq[chan];
-				} else if (_freq_count[chan] >= FREQUENCY
-				           && _freq_count[chan] - freq[chan] < FREQUENCY) {
+				} else if (_freq_count[chan] >= frequency
+				           && _freq_count[chan] - freq[chan] < frequency) {
 					/* Unclean falling edge */
 					int l = volume << 1;
-					result += volume - (l * (_freq_count[chan] - FREQUENCY)) / freq[chan];
+					result += volume - (l * (_freq_count[chan] - frequency)) / freq[chan];
 				} else {
-					if (_freq_count[chan] < FREQUENCY)
+					if (_freq_count[chan] < frequency)
 						result += volume;
 					else
 						result += -volume;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list