aboutsummaryrefslogtreecommitdiff
path: root/engines/cruise
diff options
context:
space:
mode:
authorPaul Gilbert2009-06-23 01:01:16 +0000
committerPaul Gilbert2009-06-23 01:01:16 +0000
commit510700b0860e2f109deadcc2523b1232399085ea (patch)
tree475aff17d4b62b36e060ed29b39a12b488be82c0 /engines/cruise
parentb629b0cc7811877fcc0261b9e86fac1abe9dc495 (diff)
downloadscummvm-rg350-510700b0860e2f109deadcc2523b1232399085ea.tar.gz
scummvm-rg350-510700b0860e2f109deadcc2523b1232399085ea.tar.bz2
scummvm-rg350-510700b0860e2f109deadcc2523b1232399085ea.zip
Bugfixes to keep sound effects to channel #4 like the original (it ignores the channel parameter to the given library routine)
svn-id: r41787
Diffstat (limited to 'engines/cruise')
-rw-r--r--engines/cruise/function.cpp4
-rw-r--r--engines/cruise/sound.cpp22
-rw-r--r--engines/cruise/sound.h6
3 files changed, 19 insertions, 13 deletions
diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp
index 10d05de46c..5f65dce913 100644
--- a/engines/cruise/function.cpp
+++ b/engines/cruise/function.cpp
@@ -209,7 +209,7 @@ int16 Op_PlayFX(void) {
if (speed == -1)
speed = filesDatabase[sampleNum].subData.transparency;
- _vm->sound().playSound(channelNum, filesDatabase[sampleNum].subData.ptr,
+ _vm->sound().playSound(filesDatabase[sampleNum].subData.ptr,
filesDatabase[sampleNum].width, volume);
}
@@ -226,7 +226,7 @@ int16 Op_LoopFX(void) {
if (speed == -1)
speed = filesDatabase[sampleNum].subData.transparency;
- _vm->sound().playSound(channelNum, filesDatabase[sampleNum].subData.ptr,
+ _vm->sound().playSound(filesDatabase[sampleNum].subData.ptr,
filesDatabase[sampleNum].width, volume);
}
diff --git a/engines/cruise/sound.cpp b/engines/cruise/sound.cpp
index 3c359e1903..f1a9e95501 100644
--- a/engines/cruise/sound.cpp
+++ b/engines/cruise/sound.cpp
@@ -127,8 +127,8 @@ protected:
Audio::SoundHandle _soundHandle;
byte _vibrato;
- int _channelsVolumeTable[4];
- AdlibSoundInstrument _instrumentsTable[4];
+ int _channelsVolumeTable[5];
+ AdlibSoundInstrument _instrumentsTable[5];
static const int _freqTable[];
static const int _freqTableCount;
@@ -284,7 +284,7 @@ AdlibSoundDriver::~AdlibSoundDriver() {
}
void AdlibSoundDriver::setupChannel(int channel, const byte *data, int instrument, int volume) {
- assert(channel < 4);
+ assert(channel < 5);
if (data) {
if (volume > 80) {
volume = 80;
@@ -301,7 +301,7 @@ void AdlibSoundDriver::setupChannel(int channel, const byte *data, int instrumen
}
void AdlibSoundDriver::stopChannel(int channel) {
- assert(channel < 4);
+ assert(channel < 5);
AdlibSoundInstrument *ins = &_instrumentsTable[channel];
if (ins->mode != 0 && ins->channel == 6) {
channel = 6;
@@ -376,7 +376,7 @@ void AdlibSoundDriver::update(int16 *buf, int len) {
}
void AdlibSoundDriver::setupInstrument(const byte *data, int channel) {
- assert(channel < 4);
+ assert(channel < 5);
AdlibSoundInstrument *ins = &_instrumentsTable[channel];
loadInstrument(data, ins);
@@ -465,7 +465,7 @@ void AdlibSoundDriverADL::loadInstrument(const byte *data, AdlibSoundInstrument
}
void AdlibSoundDriverADL::setChannelFrequency(int channel, int frequency) {
- assert(channel < 4);
+ assert(channel < 5);
AdlibSoundInstrument *ins = &_instrumentsTable[channel];
if (ins->mode != 0) {
channel = ins->channel;
@@ -500,7 +500,7 @@ void AdlibSoundDriverADL::setChannelFrequency(int channel, int frequency) {
}
void AdlibSoundDriverADL::playSample(const byte *data, int size, int channel, int volume) {
- assert(channel < 4);
+ assert(channel < 5);
_channelsVolumeTable[channel] = 127;
setupInstrument(data, channel);
AdlibSoundInstrument *ins = &_instrumentsTable[channel];
@@ -725,6 +725,8 @@ PCSound::PCSound(Audio::Mixer *mixer, CruiseEngine *vm) {
_mixer = mixer;
_soundDriver = new AdlibSoundDriverADL(_mixer);
_player = new PCSoundFxPlayer(_soundDriver);
+ _musicVolume = ConfMan.getBool("music_mute") ? 0 : MIN(255, ConfMan.getInt("music_volume"));
+ _sfxVolume = ConfMan.getBool("sfx_mute") ? 0 : MIN(255, ConfMan.getInt("sfx_volume"));
}
PCSound::~PCSound() {
@@ -757,9 +759,9 @@ void PCSound::fadeOutMusic() {
_player->fadeOut();
}
-void PCSound::playSound(int channel, const uint8 *data, int size, int volume) {
- debugC(5, kCruiseDebugSound, "PCSound::playSound() channel %d size %d", channel, size);
- _soundDriver->playSample(data, size, channel, volume);
+void PCSound::playSound(const uint8 *data, int size, int volume) {
+ debugC(5, kCruiseDebugSound, "PCSound::playSound() channel %d size %d", 4, size);
+ _soundDriver->playSample(data, size, 4, volume);
}
void PCSound::stopSound(int channel) {
diff --git a/engines/cruise/sound.h b/engines/cruise/sound.h
index 3280323ad0..d3c1b3a97d 100644
--- a/engines/cruise/sound.h
+++ b/engines/cruise/sound.h
@@ -29,6 +29,8 @@
#include "sound/mididrv.h"
#include "sound/midiparser.h"
#include "sound/mixer.h"
+
+#include "common/config-manager.h"
#include "common/serializer.h"
namespace Cruise {
@@ -42,6 +44,8 @@ private:
Audio::Mixer *_mixer;
CruiseEngine *_vm;
int _genVolume;
+ uint8 _musicVolume;
+ uint8 _sfxVolume;
protected:
PCSoundDriver *_soundDriver;
PCSoundFxPlayer *_player;
@@ -55,7 +59,7 @@ public:
virtual void removeMusic();
virtual void fadeOutMusic();
- virtual void playSound(int channel, const uint8 *data, int size, int volume);
+ virtual void playSound(const uint8 *data, int size, int volume);
virtual void stopSound(int channel);
void doSync(Common::Serializer &s);