aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cruise/function.cpp13
-rw-r--r--engines/cruise/sound.cpp4
-rw-r--r--engines/cruise/sound.h2
3 files changed, 11 insertions, 8 deletions
diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp
index 44107d4879..1dbac3e209 100644
--- a/engines/cruise/function.cpp
+++ b/engines/cruise/function.cpp
@@ -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_StopFX(void) {
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);
diff --git a/engines/cruise/sound.cpp b/engines/cruise/sound.cpp
index 45bf186174..db8dc67e5a 100644
--- a/engines/cruise/sound.cpp
+++ b/engines/cruise/sound.cpp
@@ -808,10 +808,10 @@ void PCSound::musicLoop(bool v) {
_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) {
diff --git a/engines/cruise/sound.h b/engines/cruise/sound.h
index bf5183cdda..a47b3fc8ad 100644
--- a/engines/cruise/sound.h
+++ b/engines/cruise/sound.h
@@ -70,7 +70,7 @@ public:
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();
};