[Scummvm-cvs-logs] SF.net SVN: scummvm:[41726] scummvm/trunk/engines/cruise

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sun Jun 21 13:53:12 CEST 2009


Revision: 41726
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41726&view=rev
Author:   dreammaster
Date:     2009-06-21 11:53:11 +0000 (Sun, 21 Jun 2009)

Log Message:
-----------
Minor fixes to the individual note playing code

Modified Paths:
--------------
    scummvm/trunk/engines/cruise/function.cpp
    scummvm/trunk/engines/cruise/sound.cpp
    scummvm/trunk/engines/cruise/sound.h

Modified: scummvm/trunk/engines/cruise/function.cpp
===================================================================
--- scummvm/trunk/engines/cruise/function.cpp	2009-06-21 11:42:45 UTC (rev 41725)
+++ scummvm/trunk/engines/cruise/function.cpp	2009-06-21 11:53:11 UTC (rev 41726)
@@ -32,6 +32,10 @@
 
 namespace Cruise {
 
+uint32 Period(uint32 hz) {
+	return ((uint32)(100000000L / ((uint32)hz * 28L)));
+}
+
 //#define FUNCTION_DEBUG
 
 int16 Op_LoadOverlay(void) {
@@ -246,15 +250,14 @@
 
 int16 Op_FreqFX(void) {
 	int volume = popVar();
-	int speed = popVar();
+	int freq2 = popVar();
 	int channelNum = popVar();
 	int sampleNum = popVar();
 
 	if ((sampleNum >= 0) && (sampleNum < NUM_FILE_ENTRIES) && (filesDatabase[sampleNum].subData.ptr)) {
-		if (speed == -1)
-			speed = filesDatabase[sampleNum].subData.transparency;
-
-		_vm->sound().startNote(channelNum, volume, speed);
+		int freq = Period(freq2 * 1000);
+		
+		_vm->sound().startNote(channelNum, volume, freq);
 	}
 
 	return (0);

Modified: scummvm/trunk/engines/cruise/sound.cpp
===================================================================
--- scummvm/trunk/engines/cruise/sound.cpp	2009-06-21 11:42:45 UTC (rev 41725)
+++ scummvm/trunk/engines/cruise/sound.cpp	2009-06-21 11:53:11 UTC (rev 41726)
@@ -808,10 +808,10 @@
 	_player->setLooping(v);
 }
 
-void PCSound::startNote(int channel, int volume, int speed) {
+void PCSound::startNote(int channel, int volume, int freq) {
 	warning("TODO: startNote");
 //	_soundDriver->setVolume(channel, volume);
-	_soundDriver->setChannelFrequency(channel, speed);
+	_soundDriver->setChannelFrequency(channel, freq);
 }
 
 void PCSound::setVolume(int volume) {

Modified: scummvm/trunk/engines/cruise/sound.h
===================================================================
--- scummvm/trunk/engines/cruise/sound.h	2009-06-21 11:42:45 UTC (rev 41725)
+++ scummvm/trunk/engines/cruise/sound.h	2009-06-21 11:53:11 UTC (rev 41726)
@@ -70,7 +70,7 @@
 	void setPattern(int offset, uint8 value);
 	bool musicLooping() const;
 	void musicLoop(bool v);
-	void startNote(int channel, int volume, int speed);
+	void startNote(int channel, int volume, int freq);
 	void setVolume(int volume);
 	uint8 getVolume();
 };


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