From 2f1babd3703416362e5e8bda9ed03f59019daa8f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 11 Dec 2008 13:54:18 +0000 Subject: Whoops changed integer size of variables storing volume information, now volume of 256 should work as expected. svn-id: r35303 --- engines/kyra/sound.h | 3 +-- engines/kyra/sound_midi.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'engines/kyra') diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index 457802f4fb..b456e96185 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -348,8 +348,7 @@ private: static void onTimer(void *data); // Our channel handling - uint8 _musicVolume; - uint8 _sfxVolume; + int _musicVolume, _sfxVolume; uint32 _fadeStartTime; bool _fadeMusicOut; diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp index 6e56ba0bc8..a9b4acc687 100644 --- a/engines/kyra/sound_midi.cpp +++ b/engines/kyra/sound_midi.cpp @@ -36,7 +36,7 @@ public: MidiOutput(OSystem *system, MidiDriver *output, bool isMT32, bool defaultMT32); ~MidiOutput(); - void setSourceVolume(int source, uint8 volume, bool apply=false); + void setSourceVolume(int source, int volume, bool apply=false); void initSource(int source); void deinitSource(int source); @@ -95,7 +95,7 @@ private: int _curSource; struct SoundSource { - byte volume; + int volume; int8 channelMap[16]; byte channelProgram[16]; @@ -158,7 +158,7 @@ MidiOutput::MidiOutput(OSystem *system, MidiDriver *output, bool isMT32, bool de } for (int i = 0; i < 4; ++i) { - _sources[i].volume = 0xFF; + _sources[i].volume = 256; initSource(i); } } @@ -317,7 +317,7 @@ void MidiOutput::metaEvent(byte type, byte *data, uint16 length) { _output->metaEvent(type, data, length); } -void MidiOutput::setSourceVolume(int source, uint8 volume, bool apply) { +void MidiOutput::setSourceVolume(int source, int volume, bool apply) { _sources[source].volume = volume; if (apply) { @@ -532,7 +532,7 @@ void SoundMidiPC::updateVolumeSettings() { if (!_output) return; - uint8 newMusVol = ConfMan.getInt("music_volume"); + int newMusVol = ConfMan.getInt("music_volume"); _sfxVolume = ConfMan.getInt("sfx_volume"); _output->setSourceVolume(0, newMusVol, newMusVol != _musicVolume); @@ -677,7 +677,7 @@ void SoundMidiPC::onTimer(void *data) { static const uint32 musicFadeTime = 1 * 1000; if (midi->_fadeStartTime + musicFadeTime > midi->_vm->_system->getMillis()) { - byte volume = (byte)((musicFadeTime - (midi->_vm->_system->getMillis() - midi->_fadeStartTime)) * midi->_musicVolume / musicFadeTime); + int volume = (byte)((musicFadeTime - (midi->_vm->_system->getMillis() - midi->_fadeStartTime)) * midi->_musicVolume / musicFadeTime); midi->_output->setSourceVolume(0, volume, true); } else { for (int i = 0; i < 16; ++i) -- cgit v1.2.3