diff options
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | base/gameDetector.cpp | 6 | ||||
-rw-r--r-- | doc/05_01.tex | 1 | ||||
-rw-r--r-- | gui/launcher.cpp | 3 | ||||
-rw-r--r-- | gui/options.cpp | 28 | ||||
-rw-r--r-- | gui/options.h | 3 | ||||
-rw-r--r-- | scumm/dialogs.cpp | 13 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse.cpp | 81 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse.h | 22 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse_sndmgr.h | 1 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 12 | ||||
-rw-r--r-- | scumm/scumm.cpp | 4 |
13 files changed, 138 insertions, 39 deletions
@@ -299,6 +299,7 @@ arguments - see the next section. -m, --music-volume=NUM Set the music volume, 0-255 (default: 192) -o, --master-volume=NUM Set the master volume, 0-255 (default: 192) -s, --sfx-volume=NUM Set the sfx volume, 0-255 (default: 192) + -r, --voice-volume=NUM Set the voice volume, 0-255 (default: 192) -n, --subtitles Enable subtitles (use with games that have voice) -b, --boot-param=NUM Pass number to the boot script (boot param) -d, --debuglevel=NUM Set debug verbosity level @@ -261,8 +261,6 @@ SCUMM - Change code to new mixer pool method procedure - Check if VAR_SYNC if it's set to nonzero value - Add pool method for FT voc samples from resource - - Add missing volume channels into sound mixer needed by imuse and add code - into imuse - Implement tuning volume level or something(not sure yet what is) - Implement stuff for fadeParam in JUMP opcode (maybe never implemented) - Recheck 'next region' code diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp index d51693f6a0..19f638019d 100644 --- a/base/gameDetector.cpp +++ b/base/gameDetector.cpp @@ -63,6 +63,7 @@ static const char USAGE_STRING[] = " -m, --music-volume=NUM Set the music volume, 0-255 (default: 192)\n" " -o, --master-volume=NUM Set the master volume, 0-255 (default: 192)\n" " -s, --sfx-volume=NUM Set the sfx volume, 0-255 (default: 192)\n" + " -r, --voice-volume=NUM Set the voice volume, 0-255 (default: 192)\n" " -n, --subtitles Enable subtitles (use with games that have voice)\n" " -b, --boot-param=NUM Pass number to the boot script (boot param)\n" " -d, --debuglevel=NUM Set debug verbosity level\n" @@ -107,6 +108,7 @@ GameDetector::GameDetector() { ConfMan.registerDefault("master_volume", 192); ConfMan.registerDefault("music_volume", 192); ConfMan.registerDefault("sfx_volume", 192); + ConfMan.registerDefault("voice_volume", 192); ConfMan.registerDefault("multi_midi", false); ConfMan.registerDefault("native_mt32", false); @@ -367,6 +369,10 @@ void GameDetector::parseCommandLine(int argc, char **argv) { ConfMan.set("sfx_volume", (int)strtol(option, 0, 10), kTransientDomain); END_OPTION + DO_OPTION('r', "voice-volume") + ConfMan.set("voice_volume", (int)strtol(option, 0, 10), kTransientDomain); + END_OPTION + DO_OPTION_CMD('t', "list-targets") listTargets(); exit(0); diff --git a/doc/05_01.tex b/doc/05_01.tex index 971c679e7b..accf0e534d 100644 --- a/doc/05_01.tex +++ b/doc/05_01.tex @@ -21,6 +21,7 @@ Usage: scummvm [OPTIONS]... [GAME]\\ -m, --music-volume=NUM &Set the music volume, 0-255 (default: 192)\\ -o, --master-volume=NUM &Set the master volume, 0-255 (default: 192)\\ -s, --sfx-volume=NUM &Set the sfx volume, 0-255 (default: 192)\\ + -r, --voice-volume=NUM &Set the voice volume, 0-255 (default: 192)\\ -n, --subtitles &Enable subtitles (use with games that have voice)\\ -b, --boot-param=NUM &Pass number to the boot script (boot param)\\ -d, --debuglevel=NUM &Set debug verbosity level\\ diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 8b2e6a6327..6edb87c27a 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -225,7 +225,8 @@ void EditGameDialog::open() { e = ConfMan.hasKey("master_volume", _domain) || ConfMan.hasKey("music_volume", _domain) || - ConfMan.hasKey("sfx_volume", _domain); + ConfMan.hasKey("sfx_volume", _domain) || + ConfMan.hasKey("voice_volume", _domain); _globalVolumeOverride->setState(e); // TODO: game path diff --git a/gui/options.cpp b/gui/options.cpp index c96f23dc67..5d2d9981e7 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -49,6 +49,7 @@ enum { kMasterVolumeChanged = 'mavc', kMusicVolumeChanged = 'muvc', kSfxVolumeChanged = 'sfvc', + kVoiceVolumeChanged = 'vcvc', kChooseSaveDirCmd = 'chos' }; @@ -62,7 +63,8 @@ OptionsDialog::OptionsDialog(const String &domain, int x, int y, int w, int h) _enableVolumeSettings(false), _masterVolumeSlider(0), _masterVolumeLabel(0), _musicVolumeSlider(0), _musicVolumeLabel(0), - _sfxVolumeSlider(0), _sfxVolumeLabel(0) { + _sfxVolumeSlider(0), _sfxVolumeLabel(0), + _voiceVolumeSlider(0), _voiceVolumeLabel(0) { } @@ -137,6 +139,10 @@ void OptionsDialog::open() { vol = ConfMan.getInt("sfx_volume", _domain); _sfxVolumeSlider->setValue(vol); _sfxVolumeLabel->setValue(vol); + + vol = ConfMan.getInt("voice_volume", _domain); + _voiceVolumeSlider->setValue(vol); + _voiceVolumeLabel->setValue(vol); } } @@ -161,10 +167,12 @@ void OptionsDialog::close() { ConfMan.set("master_volume", _masterVolumeSlider->getValue(), _domain); ConfMan.set("music_volume", _musicVolumeSlider->getValue(), _domain); ConfMan.set("sfx_volume", _sfxVolumeSlider->getValue(), _domain); + ConfMan.set("voice_volume", _voiceVolumeSlider->getValue(), _domain); } else { ConfMan.removeKey("master_volume", _domain); ConfMan.removeKey("music_volume", _domain); ConfMan.removeKey("sfx_volume", _domain); + ConfMan.removeKey("voice_volume", _domain); } } @@ -209,6 +217,10 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data _sfxVolumeLabel->setValue(_sfxVolumeSlider->getValue()); _sfxVolumeLabel->draw(); break; + case kVoiceVolumeChanged: + _voiceVolumeLabel->setValue(_voiceVolumeSlider->getValue()); + _voiceVolumeLabel->draw(); + break; case kOKCmd: setResult(1); close(); @@ -246,6 +258,8 @@ void OptionsDialog::setVolumeSettingsState(bool enabled) { _musicVolumeLabel->setEnabled(enabled); _sfxVolumeSlider->setEnabled(enabled); _sfxVolumeLabel->setEnabled(enabled); + _voiceVolumeSlider->setEnabled(enabled); + _voiceVolumeLabel->setEnabled(enabled); } int OptionsDialog::addGraphicControls(GuiObject *boss, int yoffset) { @@ -335,6 +349,12 @@ int OptionsDialog::addVolumeControls(GuiObject *boss, int yoffset) { _sfxVolumeLabel->setFlags(WIDGET_CLEARBG); yoffset += 16; + _voiceVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Voice volume: ", 100, kVoiceVolumeChanged); + _voiceVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft); + _voiceVolumeSlider->setMinValue(0); _voiceVolumeSlider->setMaxValue(255); + _voiceVolumeLabel->setFlags(WIDGET_CLEARBG); + yoffset += 16; + _enableVolumeSettings = true; return yoffset; @@ -344,13 +364,13 @@ int OptionsDialog::addVolumeControls(GuiObject *boss, int yoffset) { GlobalOptionsDialog::GlobalOptionsDialog(GameDetector &detector) - : OptionsDialog(Common::ConfigManager::kApplicationDomain, 10, 20, 320 - 2 * 10, 200 - 2 * 20) { + : OptionsDialog(Common::ConfigManager::kApplicationDomain, 10, 20, 320 - 2 * 10, 200 - 1 * 20) { - const int vBorder = 5; + const int vBorder = 4; int yoffset; // The tab widget - TabWidget *tab = new TabWidget(this, 0, vBorder, _w, _h - 24 - 2*vBorder); + TabWidget *tab = new TabWidget(this, 0, vBorder, _w, _h - 24 - 2 * vBorder); // // 1) The graphics tab diff --git a/gui/options.h b/gui/options.h index 9f6c6bf852..0ef6c266f2 100644 --- a/gui/options.h +++ b/gui/options.h @@ -90,6 +90,9 @@ private: SliderWidget *_sfxVolumeSlider; StaticTextWidget *_sfxVolumeLabel; + + SliderWidget *_voiceVolumeSlider; + StaticTextWidget *_voiceVolumeLabel; }; diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index cd3d2adf4d..e58fa6d270 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -30,6 +30,7 @@ #include "scumm/sound.h" #include "scumm/scumm.h" #include "scumm/imuse.h" +#include "scumm/imuse_digi/dimuse.h" #include "scumm/player_v2.h" #include "scumm/verbs.h" #include "sound/mididrv.h" @@ -430,7 +431,7 @@ ConfigDialog::ConfigDialog(ScummEngine *scumm) // // Some misc options // - subtitlesCheckbox = new GUI::CheckboxWidget(this, 15, 62, 200, 16, "Show subtitles", 0, 'S'); + subtitlesCheckbox = new GUI::CheckboxWidget(this, 15, 78, 200, 16, "Show subtitles", 0, 'S'); // // Create the sub dialog(s) @@ -469,10 +470,20 @@ void ConfigDialog::close() { int soundVolumeMaster = ConfMan.getInt("master_volume"); int soundVolumeMusic = ConfMan.getInt("music_volume"); int soundVolumeSfx = ConfMan.getInt("sfx_volume"); + int soundVolumeVoice = ConfMan.getInt("voice_volume"); + + if (_vm->_imuseDigital) { + _vm->_mixer->setVolume(soundVolumeMaster); + _vm->_imuseDigital->setGroupMusicVolume(soundVolumeMusic / 2); + _vm->_imuseDigital->setGroupSfxVolume(soundVolumeSfx / 2); + _vm->_imuseDigital->setGroupVoiceVolume(soundVolumeVoice / 2); + return; + } if (_vm->_imuse) { _vm->_imuse->set_music_volume(soundVolumeMusic); } + if (_vm->_musicEngine) { _vm->_musicEngine->setMasterVolume(soundVolumeMaster); } diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index a4869b712e..1c5721f33b 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -20,6 +20,7 @@ #include "stdafx.h" #include "common/timer.h" +#include "common/config-manager.h" #include "scumm/actor.h" #include "scumm/scumm.h" @@ -46,6 +47,9 @@ IMuseDigital::IMuseDigital(ScummEngine *scumm) _mutex = g_system->createMutex(); _pause = false; _sound = new ImuseDigiSndMgr(_vm); + _volVoice = 0; + _volSfx = 0; + _volMusic = 0; resetState(); _vm->_timer->installTimerProc(timer_handler, 1000000 / 25, this); } @@ -60,6 +64,28 @@ IMuseDigital::~IMuseDigital() { g_system->deleteMutex(_mutex); } +void IMuseDigital::resetState() { + _curMusicState = 0; + _curMusicSeq = 0; + _curMusicCue = 0; + memset(_attributes, 0, sizeof(_attributes)); + _curSeqAtribPos = 0; +} + +static const Common::String &kTransientDomain = Common::ConfigManager::kTransientDomain; + +void IMuseDigital::setGroupVoiceVolume(int volume) { + _volVoice = volume; +} + +void IMuseDigital::setGroupMusicVolume(int volume) { + _volMusic = volume; +} + +void IMuseDigital::setGroupSfxVolume(int volume) { + _volSfx = volume; +} + void IMuseDigital::callback() { Common::StackLock lock(_mutex, "IMuseDigital::callback()"); int l = 0; @@ -113,14 +139,22 @@ void IMuseDigital::callback() { } int pan = (_track[l].pan != 64) ? 2 * _track[l].pan - 127 : 0; + int vol = _track[l].vol / 1000; + + if (_track[l].soundGroup == 1) + vol = (vol * _volVoice) / 128; + if (_track[l].soundGroup == 2) + vol = (vol * _volSfx) / 128; + if (_track[l].soundGroup == 3) + vol = (vol * _volMusic) / 128; if (_vm->_mixer->isReady()) { if (_track[l].stream2) { if (!_track[l].started) { _track[l].started = true; - _vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream2, true, _track[l].vol / 1000, _track[l].pan, -1, false); + _vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream2, false, _track[l].vol / 1000, _track[l].pan, -1, false); } else { - _vm->_mixer->setChannelVolume(_track[l].handle, _track[l].vol / 1000); + _vm->_mixer->setChannelVolume(_track[l].handle, vol); _vm->_mixer->setChannelBalance(_track[l].handle, pan); } continue; @@ -174,7 +208,7 @@ void IMuseDigital::callback() { result = mixer_size; if (_vm->_mixer->isReady()) { - _vm->_mixer->setChannelVolume(_track[l].handle, _track[l].vol / 1000); + _vm->_mixer->setChannelVolume(_track[l].handle, vol); _vm->_mixer->setChannelBalance(_track[l].handle, pan); _track[l].stream->append(data, result); _track[l].regionOffset += result; @@ -345,7 +379,7 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, } else { _track[l].stream2 = NULL; _track[l].stream = makeAppendableAudioStream(freq, mixerFlags, 100000); - _vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream, true, _track[l].vol / 1000, _track[l].pan, -1); + _vm->_mixer->playInputStream(&_track[l].handle, _track[l].stream, false, _track[l].vol / 1000, _track[l].pan, -1); } _track[l].used = true; @@ -373,7 +407,7 @@ void IMuseDigital::stopSound(int soundId) { void IMuseDigital::setPriority(int soundId, int priority) { Common::StackLock lock(_mutex, "IMuseDigital::setPriority()"); - debug(5, "IMuseDigital::setPrioritySound(%d, %d)", soundId, priority); + debug(5, "IMuseDigital::setPriority(%d, %d)", soundId, priority); assert ((priority >= 0) && (priority <= 127)); @@ -386,7 +420,7 @@ void IMuseDigital::setPriority(int soundId, int priority) { void IMuseDigital::setVolume(int soundId, int volume) { Common::StackLock lock(_mutex, "IMuseDigital::setVolume()"); - debug(5, "IMuseDigital::setVolumeSound(%d, %d)", soundId, volume); + debug(5, "IMuseDigital::setVolume(%d, %d)", soundId, volume); for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { if ((_track[l].soundId == soundId) && _track[l].used) { _track[l].vol = volume * 1000; @@ -396,7 +430,7 @@ void IMuseDigital::setVolume(int soundId, int volume) { void IMuseDigital::setPan(int soundId, int pan) { Common::StackLock lock(_mutex, "IMuseDigital::setPan()"); - debug(5, "IMuseDigital::setVolumeSound(%d, %d)", soundId, pan); + debug(5, "IMuseDigital::setPan(%d, %d)", soundId, pan); for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { if ((_track[l].soundId == soundId) && _track[l].used) { _track[l].pan = pan; @@ -404,6 +438,17 @@ void IMuseDigital::setPan(int soundId, int pan) { } } +void IMuseDigital::selectGroupVolume(int soundId, int groupId) { + Common::StackLock lock(_mutex, "IMuseDigital::setGroupVolume()"); + debug(5, "IMuseDigital::setGroupVolume(%d, %d)", soundId, groupId); + assert((groupId >= 1) && (groupId <= 3)); + for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { + if ((_track[l].soundId == soundId) && _track[l].used) { + _track[l].soundGroup = groupId; + } + } +} + void IMuseDigital::setFade(int soundId, int destVolume, int delay60HzTicks) { Common::StackLock lock(_mutex, "IMuseDigital::setFade()"); debug(5, "IMuseDigital::setFade(%d, %d, %d)", soundId, destVolume, delay60HzTicks); @@ -497,8 +542,8 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int break; case 12: // ImuseSetParam switch (sub_cmd) { - case 0x400: // set group volume - debug(5, "set group volume (0x400), soundId(%d), group volume(%d)", soundId, d); + case 0x400: // select group volume + selectGroupVolume(soundId, d); break; case 0x500: // set priority setPriority(soundId, d); @@ -593,17 +638,17 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int _attributes[b] = c; } break; - case 0x2000: // ImuseSetMasterSFXVolume - debug(5, "ImuseSetMasterSFXVolume (%d)", b); - // TODO + case 0x2000: // ImuseSetGroupSfxVolume + debug(5, "ImuseSetGroupSFXVolume (%d)", b); +// setGroupSfxVolume(b); break; - case 0x2001: // ImuseSetMasterVoiceVolume - debug(5, "ImuseSetMasterVoiceVolume (%d)", b); - // TODO + case 0x2001: // ImuseSetGroupVoiceVolume + debug(5, "ImuseSetGroupVoiceVolume (%d)", b); +// setGroupVoiceVolume(b); break; - case 0x2002: // ImuseSetMasterMusicVolume - debug(5, "ImuseSetMasterMusicVolume (%d)", b); - // TODO + case 0x2002: // ImuseSetGroupMusicVolume + debug(5, "ImuseSetGroupMusicVolume (%d)", b); +// setGroupMusicVolume(b); break; default: warning("IMuseDigital::doCommand DEFAULT command %d", cmd); diff --git a/scumm/imuse_digi/dimuse.h b/scumm/imuse_digi/dimuse.h index 8f3c86b81c..995ed5f856 100644 --- a/scumm/imuse_digi/dimuse.h +++ b/scumm/imuse_digi/dimuse.h @@ -76,6 +76,11 @@ private: OSystem::MutexRef _mutex; ScummEngine *_vm; ImuseDigiSndMgr *_sound; + + int _volVoice; + int _volSfx; + int _volMusic; + bool _pause; int _attributes[188]; @@ -125,18 +130,21 @@ public: { debug(5, "startSfx(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_SFX, NULL, 0, 127, priority); } void startSound(int soundId) { error("MusicEngine::startSound() Should be never called"); } - void resetState() { - _curMusicState = 0; - _curMusicSeq = 0; - _curMusicCue = 0; - memset(_attributes, 0, sizeof(_attributes)); - _curSeqAtribPos = 0; - } + + void resetState(); + + void setGroupVoiceVolume(int volume); + void setGroupSfxVolume(int volume); + void setGroupMusicVolume(int volume); + int getGroupVoiceVolume() { return _volVoice; } + int getGroupSfxVolume() { return _volSfx; } + int getGroupMusicVolume() { return _volMusic; } void setPriority(int soundId, int priority); void setVolume(int soundId, int volume); void setPan(int soundId, int pan); void setFade(int soundId, int destVolume, int delay60HzTicks); + void selectGroupVolume(int soundId, int groupId); void setMasterVolume(int vol) {} void stopSound(int soundId); void stopAllSounds() { stopAllSounds(false); } diff --git a/scumm/imuse_digi/dimuse_sndmgr.h b/scumm/imuse_digi/dimuse_sndmgr.h index 61cc4370c5..c0d1b28783 100644 --- a/scumm/imuse_digi/dimuse_sndmgr.h +++ b/scumm/imuse_digi/dimuse_sndmgr.h @@ -41,6 +41,7 @@ public: #define IMUSE_RESOURCE 1 #define IMUSE_BUNDLE 2 + #define IMUSE_VOICE 1 #define IMUSE_SFX 2 #define IMUSE_MUSIC 3 diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index ddefb92d52..7a86e404e8 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -1461,14 +1461,14 @@ void ScummEngine_v8::o8_kernelGetFunctions() { push(a->talkStartFrame); } break; - case 0xDD: // getMasterSFXVol - push(ConfMan.getInt("sfx_volume") / 2); + case 0xDD: // getGroupSfxVol + push(_imuseDigital->getGroupSfxVolume()); break; - case 0xDE: // getMasterVoiceVol - push(ConfMan.getInt("sfx_volume") / 2); + case 0xDE: // getGroupVoiceVol + push(_imuseDigital->getGroupVoiceVolume()); break; - case 0xDF: // getMasterMusicVol - push(ConfMan.getInt("music_volume") / 2); + case 0xDF: // getGroupMusicVol + push(_imuseDigital->getGroupMusicVolume()); break; case 0xE0: // readRegistryValue { diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index b8f69454a2..780282ed6a 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -711,6 +711,10 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS // Init iMuse if (_features & GF_DIGI_IMUSE) { _musicEngine = _imuseDigital = new IMuseDigital(this); + _mixer->setVolume(ConfMan.getInt("master_volume")); + _imuseDigital->setGroupMusicVolume(ConfMan.getInt("music_volume") / 2); + _imuseDigital->setGroupSfxVolume(ConfMan.getInt("sfx_volume") / 2); + _imuseDigital->setGroupVoiceVolume(ConfMan.getInt("voice_volume") / 2); } else if ((_features & GF_AMIGA) && (_version == 2)) { _musicEngine = new Player_V2A(this); } else if ((_features & GF_AMIGA) && (_version == 3)) { |