diff options
author | Ludvig Strigeus | 2002-04-15 18:07:56 +0000 |
---|---|---|
committer | Ludvig Strigeus | 2002-04-15 18:07:56 +0000 |
commit | c3b734f79c08436ac51f0a94afb055477c8be6c5 (patch) | |
tree | 3eee214d4dd3ebeea3f92cad7ef52a533e5ebb55 | |
parent | 18ee3f37e6fc51f3010b191f21f16617c64cb6fe (diff) | |
download | scummvm-rg350-c3b734f79c08436ac51f0a94afb055477c8be6c5.tar.gz scummvm-rg350-c3b734f79c08436ac51f0a94afb055477c8be6c5.tar.bz2 scummvm-rg350-c3b734f79c08436ac51f0a94afb055477c8be6c5.zip |
command line option for sfx volume
svn-id: r3947
-rw-r--r-- | gameDetector.cpp | 15 | ||||
-rw-r--r-- | gameDetector.h | 1 | ||||
-rw-r--r-- | main.cpp | 5 | ||||
-rw-r--r-- | scummvm.cpp | 2 | ||||
-rw-r--r-- | simon/simon.cpp | 29 | ||||
-rw-r--r-- | simon/simon.h | 6 | ||||
-rw-r--r-- | sound.cpp | 1 |
7 files changed, 39 insertions, 20 deletions
diff --git a/gameDetector.cpp b/gameDetector.cpp index e7a524e189..273fd112f3 100644 --- a/gameDetector.cpp +++ b/gameDetector.cpp @@ -41,6 +41,7 @@ static const char USAGE_STRING[] = "\tt<num> - set music tempo. Suggested: 1F0000\n" "\tp<path> - look for game in <path>\n" "\tm<num> - set music volume to <num> (0-100)\n" + "\ts<num> - set sfx volume to <num> (0-255)\n" "\te<mode> - set music engine. see readme.txt for details\n" "\tr - emulate roland mt32 instruments\n" "\tf - fullscreen mode\n" @@ -108,6 +109,12 @@ void GameDetector::parseCommandLine(int argc, char **argv) _music_volume = atoi(s + 1); goto NextArg; } + case 's':{ + if (*(s + 1) == '\0') + goto ShowHelpAndExit; + _sfx_volume = atoi(s + 1); + goto NextArg; + } case 'r':{ _mt32emulate = true; break; @@ -202,9 +209,6 @@ bool GameDetector::parseMusicDriver(const char *s) { for(i=0; i!=ARRAYSIZE(music_drivers); i++,md++) { if (!scumm_stricmp(md->name, s)) { - /* FIXME: when adlib driver is in use, propagate that to - * the IMuse class, and let it create an IMuseAdlib driver - * instead of IMuseGM driver */ if (md->id == -1) { _use_adlib = true; } @@ -335,9 +339,10 @@ int GameDetector::detectMain(int argc, char **argv) _noSubtitles = 0; // use by default - should this depend on soundtrack? _gfx_mode = GFX_DOUBLESIZE; - _gfx_driver = GD_AUTO; + _sfx_volume = 100; + #ifdef USE_NULL_DRIVER _gfx_driver = GD_NULL; #endif @@ -346,6 +351,8 @@ int GameDetector::detectMain(int argc, char **argv) _gameTempo = 0; _soundCardType = 3; + + _midi_driver = MD_AUTO; parseCommandLine(argc, argv); diff --git a/gameDetector.h b/gameDetector.h index 296ba6539d..43473e3fa9 100644 --- a/gameDetector.h +++ b/gameDetector.h @@ -35,6 +35,7 @@ public: bool _use_adlib; byte _music_volume; + byte _sfx_volume; bool _mt32emulate; uint16 _debugMode; @@ -67,9 +67,10 @@ int main(int argc, char *argv[]) /* Simon the Sorcerer. Completely different initialization */ MidiDriver *midi = detector.createMidi(); - SimonState *simon = SimonState::create(); + SimonState *simon = SimonState::create(system, midi); simon->_game = detector._gameId - GID_SIMON_FIRST; - simon->go(system, midi); + simon->set_volume(detector._sfx_volume); + simon->go(); } else { Scumm *scumm = Scumm::createFromDetector(&detector, system); diff --git a/scummvm.cpp b/scummvm.cpp index 549ef2e85d..808cde2a5b 100644 --- a/scummvm.cpp +++ b/scummvm.cpp @@ -1301,6 +1301,8 @@ Scumm *Scumm::createFromDetector(GameDetector *detector, OSystem *syst) scumm->_noSubtitles = detector->_noSubtitles; scumm->_cdrom = detector->_cdrom; + scumm->_sound_volume_sfx = detector->_sfx_volume; + { IMuse *imuse; diff --git a/simon/simon.cpp b/simon/simon.cpp index 3c0597b98c..107970863d 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -7555,15 +7555,10 @@ void SimonState::realizePalette() { } -void SimonState::go(OSystem *syst, MidiDriver *driver) { - _system = syst; - +void SimonState::go() { if (!_dump_file) _dump_file = stdout; - /* Setup midi driver */ - midi.set_driver(driver); - /* allocate buffers */ sdl_buf_3 = (byte*)calloc(320*200,1); sdl_buf = (byte*)calloc(320*200,1); @@ -7593,9 +7588,6 @@ void SimonState::go(OSystem *syst, MidiDriver *driver) { _vk_t_toggle = true; _system->property(OSystem::PROP_SHOW_DEFAULT_CURSOR, 1); - - _mixer->bind_to_system(_system); - _mixer->set_volume(256); while(1) { hitarea_stuff(); @@ -8784,7 +8776,22 @@ void SimonState::dump_single_bitmap(int file, int image, byte *offs, int w, int #endif } -SimonState *SimonState::create() { - return new SimonState; +SimonState *SimonState::create(OSystem *syst, MidiDriver *driver) { + SimonState *s = new SimonState; + + s->_system = syst; + + /* Setup midi driver */ + s->midi.set_driver(driver); + + /* Setup mixer */ + s->_mixer->bind_to_system(syst); + + return s; + +} + +void SimonState::set_volume(byte volume) { + _mixer->set_volume(volume * 256 / 100); } diff --git a/simon/simon.h b/simon/simon.h index a4391e482f..9709ace991 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -961,7 +961,7 @@ public: void resfile_read(void *dst, uint32 offs, uint32 size); - void go(OSystem *syst, MidiDriver *driver); + void go(); void openGameFile(); static int CDECL game_thread_proc(void *param); @@ -1031,9 +1031,11 @@ public: void vc_kill_thread(uint file, uint sprite); - static SimonState *create(); + static SimonState *create(OSystem *syst, MidiDriver *driver); void set_dummy_cursor(); + + void set_volume(byte volume); }; @@ -385,7 +385,6 @@ void Scumm::setupSound() se->set_music_volume(60); se->set_master_volume(125); - _sound_volume_sfx = 100; _sound_volume_music = se->get_music_volume(); _sound_volume_master = (se->get_master_volume() / 127); } |