aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-01-14 20:05:56 +0000
committerTorbjörn Andersson2006-01-14 20:05:56 +0000
commita61e62db95d30c9886cf2e66e84f9e753c04f2d5 (patch)
tree8b3f192d2c74ef1c40187d3f106c3ffe56b21bd5
parentd8d6da1ff0defa13d4f458e1a6340c5254c76a2d (diff)
downloadscummvm-rg350-a61e62db95d30c9886cf2e66e84f9e753c04f2d5.tar.gz
scummvm-rg350-a61e62db95d30c9886cf2e66e84f9e753c04f2d5.tar.bz2
scummvm-rg350-a61e62db95d30c9886cf2e66e84f9e753c04f2d5.zip
Lowered FluidSynth's default gain, and added config file and command-line
options to specify it. FluidSynth's gain ranges from 0.0 through 10.0 and is probably measured in decibel, but to keep things simple, ScummVM uses settings from 0 through 1000 instead. (Though currently there's no guard against invalid settings.) This is a slightly revised version of the non-GUI part of patch #1336171. svn-id: r20030
-rw-r--r--NEWS1
-rw-r--r--README15
-rw-r--r--base/gameDetector.cpp9
-rw-r--r--doc/05_01.tex2
-rw-r--r--doc/07_02b.tex9
-rw-r--r--doc/08.tex2
-rw-r--r--sound/softsynth/fluidsynth.cpp10
7 files changed, 43 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 33919199d6..20f2b92d7d 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@ For a more comprehensive changelog for the latest experimental CVS code, see:
cannot use it.
- Fixed potential security vulnerability with oversized PATH environment
variables.
+ - Lowered default gain for FluidSynth and made it configurable.
SCUMM:
- Fixed mouse button states in COMI.
diff --git a/README b/README
index 871de440d9..ae5a04eb03 100644
--- a/README
+++ b/README
@@ -469,7 +469,9 @@ arguments - see the next section.
-q, --language=LANG Select language (see also section 5.2)
-m, --music-volume=NUM Set the music volume, 0-255 (default: 192)
-s, --sfx-volume=NUM Set the sfx volume, 0-255 (default: 192)
- -r, --speech-volume=NUM Set the voice volume, 0-255 (default: 192)
+ -r, --speech-volume=NUM Set the voice volume, 0-255 (default: 192)
+ --midi-gain=NUM Set the gain for MIDI playback, 0-1000 (default:100)
+ (only supported by some MIDI drivers)
-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
@@ -865,6 +867,15 @@ If ScummVM was build with libfluildsynth support it will be able to play MIDI
music through the FluidSynth driver. You will have to specify a SoundFont to
use, however.
+Since the default output volume from FluidSynth can be fairly low, ScummVM will
+set the gain by default to get a stronger signal. This can be further adjusted
+using the --midi-gain command-line option, or the "midi_gain" config file
+setting.
+
+The setting can take any value from 0 through 1000, with the default being 100.
+(This corresponds to FluidSynth's gain settings of 0.0 through 10.0, which are
+presumably measured in decibel.)
+
NOTE: The processor requirements for FluidSynth can be fairly high in some
cases. A fast CPU is recommended.
@@ -1269,6 +1280,8 @@ The following keywords are recognized:
sfx_volume number The sfx volume setting (0-255)
tempo number The music tempo (50-200) (default: 100)
speech_volume number The speech volume setting (0-255)
+ midi_gain number The MIDI gain (0-1000) (default: 100) (Only
+ suported by some MIDI drivers.)
copy_protection bool Enable copy protection in SCUMM games, when
ScummVM disables it by default.
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp
index 3ae7698eee..0444f164e2 100644
--- a/base/gameDetector.cpp
+++ b/base/gameDetector.cpp
@@ -73,6 +73,8 @@ static const char USAGE_STRING[] =
" -m, --music-volume=NUM Set the music volume, 0-255 (default: 192)\n"
" -s, --sfx-volume=NUM Set the sfx volume, 0-255 (default: 192)\n"
" -r, --speech-volume=NUM Set the speech volume, 0-255 (default: 192)\n"
+ " --midi-gain=NUM Set the gain for MIDI playback, 0-1000 (default:\n"
+ " 100) (only supported by some MIDI drivers)\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"
@@ -132,11 +134,12 @@ GameDetector::GameDetector() {
ConfMan.registerDefault("multi_midi", false);
ConfMan.registerDefault("native_mt32", false);
ConfMan.registerDefault("enable_gs", false);
+ ConfMan.registerDefault("midi_gain", 100);
// ConfMan.registerDefault("music_driver", ???);
ConfMan.registerDefault("cdrom", 0);
- // Game specifc
+ // Game specific
ConfMan.registerDefault("path", "");
ConfMan.registerDefault("savepath", "");
@@ -459,6 +462,10 @@ void GameDetector::parseCommandLine(int argc, char **argv) {
settings["speech_volume"] = option;
END_OPTION
+ DO_LONG_OPTION_INT("midi-gain")
+ settings["midi_gain"] = option;
+ END_OPTION
+
DO_OPTION_CMD('t', "list-targets")
listTargets();
exit(0);
diff --git a/doc/05_01.tex b/doc/05_01.tex
index 9b40d81115..220bfad68c 100644
--- a/doc/05_01.tex
+++ b/doc/05_01.tex
@@ -22,6 +22,8 @@ Usage: scummvm [OPTIONS]... [GAME]\\
-m, --music-volume=NUM &Set the music volume, 0-255 (default: 192)\\
-s, --sfx-volume=NUM &Set the sfx volume, 0-255 (default: 192)\\
-r, --speech-volume=NUM &Set the voice volume, 0-255 (default: 192)\\
+ --midi-gain &Set the gain for MIDI playback, 0-1000 (default:\\
+ &100) (only supported by some MIDI drivers)\\
-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/doc/07_02b.tex b/doc/07_02b.tex
index 8c9c22c9aa..4acc95ae2d 100644
--- a/doc/07_02b.tex
+++ b/doc/07_02b.tex
@@ -10,5 +10,14 @@ If ScummVM was build with libfluildsynth support it will be able to play MIDI
music through the FluidSynth driver. You will have to specify a SoundFont to
use, however.
+Since the default output volume from FluidSynth can be fairly low, ScummVM will
+set the gain by default to get a stronger signal. This can be further adjusted
+using the --midi-gain command-line option, or the ``midi\_gain'' config file
+setting.
+
+The setting can take any value from 0 through 1000, with the default being 100.
+(This corresponds to FluidSynth's gain settings of 0.0 through 10.0, which are
+presumably measured in decibel.)
+
\textbf{NOTE:} The processor requirements for FluidSynth can be fairly high in
some cases. A fast CPU is recommended.
diff --git a/doc/08.tex b/doc/08.tex
index 7bde403612..461eee6de4 100644
--- a/doc/08.tex
+++ b/doc/08.tex
@@ -109,6 +109,8 @@ The following keywords are recognized:
sfx\_volume &number The sfx volume setting (0-255)\\
tempo &number The music tempo (50-200) (default: 100)\\
speech\_volume &number The speech volume setting (0-255)\\
+ midi\_gain &number The MIDI gain (0-1000) (default: 100) (Only\\
+ & supported by some MIDI drivers.)\\
\\
copy\_protection&bool Enable copy protection in SCUMM games, when\\
& ScummVM disables it by default.\\
diff --git a/sound/softsynth/fluidsynth.cpp b/sound/softsynth/fluidsynth.cpp
index a3aaab3bcb..e0ded4596f 100644
--- a/sound/softsynth/fluidsynth.cpp
+++ b/sound/softsynth/fluidsynth.cpp
@@ -114,10 +114,14 @@ int MidiDriver_FluidSynth::open() {
_settings = new_fluid_settings();
- // The default gain setting is ridiculously low, but we can't set it
- // too high either or sound will be clipped. This may need tuning...
+ // The default gain setting is ridiculously low - at least for me. This
+ // cannot be fixed by ScummVM's volume settings because they can only
+ // soften the sound, not amplify it, so instead we add an option to
+ // adjust the gain of FluidSynth itself.
- setNum("synth.gain", 2.1);
+ double gain = (double)ConfMan.getInt("midi_gain") / 100.0;
+
+ setNum("synth.gain", gain);
setNum("synth.sample-rate", _outputRate);
_synth = new_fluid_synth(_settings);