aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--README101
-rw-r--r--TODO2
-rw-r--r--backends/fs/fs.h7
-rw-r--r--base/gameDetector.cpp8
-rwxr-xr-xconfigure33
-rw-r--r--doc/05_01.tex2
-rw-r--r--doc/07.tex26
-rw-r--r--doc/08.tex2
-rw-r--r--gui/browser.cpp116
-rw-r--r--gui/browser.h34
-rw-r--r--gui/launcher.cpp8
-rw-r--r--gui/launcher.h4
-rw-r--r--gui/options.cpp49
-rw-r--r--gui/options.h8
-rw-r--r--sound/mididrv.cpp6
-rw-r--r--sound/mididrv.h6
-rw-r--r--sound/module.mk1
18 files changed, 327 insertions, 87 deletions
diff --git a/NEWS b/NEWS
index 79f90a9fb5..f401c5e78f 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ For a more comprehensive changelog for the latest experimental CVS code, see:
General:
- Reworked cursor handling in SDL backend. Now cursors can have their own
palette and scaling. This is used by Humongous Entertainment games now.
+ - Added FluidSynth MIDI driver.
SCUMM:
- Added support for Mac Humongous Entertainment titles
diff --git a/README b/README
index c358d14b65..6ad83f3fb4 100644
--- a/README
+++ b/README
@@ -31,12 +31,13 @@ Table of Contents:
* 6.1 Autosaves
7.0) Music and Sound
* 7.1 Adlib emulation
- * 7.2 MT-32 emulation
- * 7.3 MIDI emulation
- * 7.4 Native MIDI support
- * 7.5 UNIX native & ALSA sequencer support
- * 7.6 Using compressed audiofiles (MP3, Ogg Vorbis, Flac)
- * 7.7 Output sample rate
+ * 7.2 FluidSynth MIDI emulation
+ * 7.3 MT-32 emulation
+ * 7.4 MIDI emulation
+ * 7.5 Native MIDI support
+ * 7.6 UNIX native & ALSA sequencer support
+ * 7.7 Using compressed audiofiles (MP3, Ogg Vorbis, Flac)
+ * 7.8 Output sample rate
8.0) Configuration Files
9.0) Compiling
@@ -369,6 +370,8 @@ arguments - see the next section.
--platform=WORD Specify version of game (allowed values: amiga,
atari, fmtowns, mac, pc, windows)
--savepath=PATH Path to where savegames are stored
+ --soundfont=FILE Select the SoundFont for MIDI playback. (Only
+ supported by some MIDI drivers.)
--multi-midi Enable combination of Adlib and native MIDI
--native-mt32 True Roland MT-32 (disable GM emulation)
--output-rate=RATE Select output sample rate in Hz (e.g. 22050)
@@ -705,20 +708,21 @@ emulation. MIDI may not be available on all operating systems or may need
manual configuration. If you ARE using MIDI, you have several different
choices of output, depending on your operating system and configuration.
- null - Null output. Don't play any music.
-
- adlib - Internal Adlib emulation (default)
- mt32 - Internal MT-32 emulation
- pcjr - Internal PCjr emulation
- pcspk - Internal PC Speaker emulation
- towns - Internal FM-TOWNS YM2612 emulation
-
- alsa - Output using ALSA sequencer device. See below.
- amidi - Use the MorphOS MIDI system, for MorphOS users
- core - CoreAudio sound, for Mac OS X users.
- qt - Quicktime sound, for Macintosh users.
- seq - Use /dev/sequencer for MIDI, *nix users. See below.
- windows - Windows MIDI. Uses built-in sequencer, for Windows users
+ null - Null output. Don't play any music.
+
+ adlib - Internal Adlib emulation (default)
+ fluidsynth - FluidSynth MIDI emulation
+ mt32 - Internal MT-32 emulation
+ pcjr - Internal PCjr emulation
+ pcspk - Internal PC Speaker emulation
+ towns - Internal FM-TOWNS YM2612 emulation
+
+ alsa - Output using ALSA sequencer device. See below.
+ amidi - Use the MorphOS MIDI system, for MorphOS users
+ core - CoreAudio sound, for Mac OS X users.
+ qt - Quicktime sound, for Macintosh users.
+ seq - Use /dev/sequencer for MIDI, *nix users. See below.
+ windows - Windows MIDI. Uses built-in sequencer, for Windows users
To select a sound driver, pass its name via the '-e' option to scummvm,
for example:
@@ -732,7 +736,18 @@ By default an Adlib card will be emulated and ScummVM will output the music
as sampled waves. This is the default mode for most games, and offers the
best compatibility between machines and games.
-7.2) Playing sound with MT-32 emulation:
+
+7.2) Playing sound with FluildSynth MIDI emulation:
+---- ----------------------------------------------
+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.
+
+NOTE: The processor requirements for FluidSynth can be fairly high in some
+cases. A fast CPU is recommended.
+
+
+7.3) Playing sound with MT-32 emulation:
---- -----------------------------------
Some games which contain MIDI music data also have improved tracks designed
for the MT-32 sound module. ScummVM can now emulate this device, however you
@@ -749,25 +764,27 @@ gets turned on.
NOTE: The processor requirements for the emulator are quite high; a fast CPU is
strongly recommended.
-7.3) Playing sound with MIDI emulation:
+
+7.4) Playing sound with MIDI emulation:
---- ----------------------------------
Some games (such as Sam and Max) only contain MIDI music data. This once
prevented music for these games from working on platforms that do not support
MIDI, or soundcards that do not provide MIDI drivers (e.g, many soundcards will
not play MIDI under Linux). ScummVM can now emulate MIDI mode using sampled
-waves and Adlib or MT-32 emulation using the -eadlib or -emt32 options
-respectively. However, if you are capable of using native MIDI, we recommend
-using one of the MIDI modes below for best sound.
+waves and Adlib, FluidSynth MIDI emulation or MT-32 emulation using the
+-eadlib, -efluidsynth or -emt32 options respectively. However, if you are
+capable of using native MIDI, we recommend using one of the MIDI modes below
+for best sound.
-7.4) Playing sound with Native MIDI:
+7.5) Playing sound with Native MIDI:
---- -------------------------------
Use the appropriate -e<mode> command line option from the list above to
select your preferred MIDI device. For example, if you wish to use the
Windows MIDI driver, use the -ewindows option.
-7.5.0) Playing sound with Sequencer MIDI: [UNIX ONLY]
+7.6.0) Playing sound with Sequencer MIDI: [UNIX ONLY]
------ ----------------------------------
If your soundcard driver supports a sequencer, you may set the environment
variable "SCUMMVM_MIDI" to your sequencer device - e.g., /dev/sequencer
@@ -780,7 +797,7 @@ performance and quality than Adlib emulation. However, for those systems where
sequencer support does not work, you can always fall back on Adlib emulation.
-7.5.1) Playing sound with ALSA sequencer: [UNIX ONLY]
+7.6.1) Playing sound with ALSA sequencer: [UNIX ONLY]
------ ----------------------------------
If you have installed the ALSA driver with the sequencer support, then
set the environment variable SCUMMVM_PORT or the config file parameter
@@ -829,7 +846,7 @@ Asking FluidSynth to become an ALSA sequencer (using SoundFonts):
Once either TiMidity or FluidSynth are running, use the 'aconnect -o -l'
command as described earlier in this section.
-7.6.0) Using MP3 files for CD audio:
+7.7.0) Using MP3 files for CD audio:
------ -----------------------------
Use LAME or some other MP3 encoder to rip the cd audio tracks to files. Name
the files track1.mp3 track2.mp3 etc. ScummVM must be compiled with MAD support
@@ -840,7 +857,7 @@ following LAME command line:
lame -t -q 0 -b 96 track1.wav track1.mp3
-7.6.1) Using Ogg Vorbis files for CD audio:
+7.7.1) Using Ogg Vorbis files for CD audio:
------ ------------------------------------
Use oggenc or some other vorbis encoder to encode the audio tracks to files.
Name the files track1.ogg track2.ogg etc. ScummVM must be compiled with vorbis
@@ -851,7 +868,7 @@ command line with the value after q specifying the desired quality from 0 to 10:
oggenc -q 5 track1.wav
-7.6.2) Using Flac files for CD audio:
+7.7.2) Using Flac files for CD audio:
------ ------------------------------------
Use flac or some other flac encoder to encode the audio tracks to files.
Name the files track1.flac track2.flac etc. In your filesystem only allows
@@ -866,7 +883,7 @@ Remember that the quality is always the same, varying encoder options will only
affect the encoding time and resulting filesize.
-7.6.3) Compressing MONSTER.SOU with MP3:
+7.7.3) Compressing MONSTER.SOU with MP3:
------ ---------------------------------
You need LAME, and our compress_scumm_sou util from the scummvm-tools package
to perform this task, and ScummVM must be compiled with MAD support.
@@ -877,7 +894,7 @@ Eventually you will have a much smaller monster.so3 file, copy this file
to your game directory. You can safely remove the monster.sou file.
-7.6.4) Compressing MONSTER.SOU with Ogg Vorbis:
+7.7.4) Compressing MONSTER.SOU with Ogg Vorbis:
------ ----------------------------------------
As above, but ScummVM must be compiled with OGG support. Run:
@@ -888,7 +905,7 @@ game directory. Ogg encoding may take a considerable longer amount of time
than MP3, so have a good book handy.
-7.6.5) Compressing MONSTER.SOU with Flac:
+7.7.5) Compressing MONSTER.SOU with Flac:
------ ----------------------------------------
As above, but ScummVM must be compiled with Flac support. Run:
@@ -902,7 +919,7 @@ filesize - 1152 seems to be a good value for those kind of soundfiles. Be sure
to read the encoder documentation before you use other values.
-7.6.6) Compressing sfx/speech in Simon the Sorcerer 1 and 2
+7.7.6) Compressing sfx/speech in Simon the Sorcerer 1 and 2
------ ----------------------------------------------------
Use our compress_simon util from the scummvm-tools package to perform this
task. You can choose between multiple target formats, but note that you can
@@ -929,7 +946,7 @@ For Flac add --flac and optional parameters, i.e.
Eventually you will have a much smaller *.mp3, *.ogg or *.fla file, copy this
file to your game dir. You can safely remove the old file.
-7.6.7) Compressing speech/music in Broken Sword 1
+7.7.7) Compressing speech/music in Broken Sword 1
------ ------------------------------------------
The compress_sword1 tool from the scummvm-tools package can encode music and
speech to MP3 as well as Ogg Vorbis.
@@ -945,7 +962,7 @@ instead of MP3.
Use "compress_sword1 --help" to get a full list of the options.
-7.6.8) Compressing speech/music in Broken Sword 2
+7.7.8) Compressing speech/music in Broken Sword 2
------ ------------------------------------------
Use our compress_sword2 util from the scummvm-tools package to perform this
task. You can choose between multiple target formats, but note that you can
@@ -970,7 +987,7 @@ files in Broken Sword 2. It will not work with any of the other *.clu files,
nor will it work with the speech files from Broken Sword 1.
-7.7) Output sample rate:
+7.8) Output sample rate:
---- -------------------
The output sample rate tells ScummVM how many sound samples to play per channel
per second. There is much that could be said on this subject, but most of it
@@ -1087,6 +1104,8 @@ The following keywords are recognized:
music_volume number The music volume setting (0-255)
multi_midi bool If true, enable combination Adlib and native
MIDI.
+ soundfont string The SoundFont to use for MIDI playback. (Only
+ supported by some MIDI drivers.)
native_mt32 bool If true, disable GM emulation and assume that
there is a true Roland MT-32 available.
sfx_volume number The sfx volume setting (0-255)
@@ -1150,20 +1169,20 @@ messages (see http://www.sysinternals.com/ntw2k/freeware/debugview.shtml).
Microsoft Visual C++ 6.0:
* Open the workspace, scummwm.dsw
* Enter the path to the needed libraries and includes in
- Tools|Options|Directories
+ Tools|Options|Directories
* Now it should compile successfully.
Microsoft Visual C++ 7.0:
* Open the solution file scummwm.sln
* Enter the path to the needed libraries and includes in
- Tools|Options|Projects|VC++ Directories
+ Tools|Options|Projects|VC++ Directories
* Now it should compile successfully.
Windows Mobile with Microsoft eMbedded Visual C++ 3 or 4 :
* Download SDL with additional Windows Mobile tweaks:
http://arisme.free.fr/ports/SDL.php
* Download additional third party libraries:
- http://arisme.free.fr/ports
+ http://arisme.free.fr/ports
* Modify your include and library paths accordingly in EVC3/EVC4.
* Open the ScummVM project dists\msevc4\PocketSCUMM.vcw
* Modify the libraries and config parameters if necessary.
diff --git a/TODO b/TODO
index b0d14a1a48..6265548024 100644
--- a/TODO
+++ b/TODO
@@ -183,6 +183,8 @@ GUI
Problem: It's not fully clear to me how to "best" deal with global vs. local
settings here...
* Maybe add the ScummVM logo (+typeface?) to the about dialog
+* Unify DirBrowserDialog and FileBrowserDialog.
+* MacOS X version of FileBrowserDialog, since there is one of DirBrowserDialog.
Launcher
========
diff --git a/backends/fs/fs.h b/backends/fs/fs.h
index 302027ba45..3b9254f512 100644
--- a/backends/fs/fs.h
+++ b/backends/fs/fs.h
@@ -131,10 +131,15 @@ public:
virtual FSList listDir(ListMode mode = kListDirectoriesOnly) const = 0;
/**
- * Compare the name of this node to the name of another.
+ * Compare the name of this node to the name of another. Directories
+ * go before normal files.
*/
virtual bool operator< (const AbstractFilesystemNode& node) const
{
+ if (isDirectory() && !node.isDirectory())
+ return true;
+ if (!isDirectory() && node.isDirectory())
+ return false;
return scumm_stricmp(displayName().c_str(), node.displayName().c_str()) < 0;
}
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp
index 282be9165e..bd0920a9ab 100644
--- a/base/gameDetector.cpp
+++ b/base/gameDetector.cpp
@@ -92,12 +92,14 @@ static const char USAGE_STRING[] =
" --platform=WORD Specify version of game (allowed values: amiga,\n"
" atari, fmtowns, nes, mac, pc, windows)\n"
" --savepath=PATH Path to where savegames are stored\n"
+ " --soundfont=FILE Select the SoundFont for MIDI playback. (Only\n"
+ " supported by some MIDI drivers.)\n"
" --multi-midi Enable combination Adlib and native MIDI\n"
" --native-mt32 True Roland MT-32 (disable GM emulation)\n"
" --output-rate=RATE Select output sample rate in Hz (e.g. 22050)\n"
" --aspect-ratio Enable aspect ratio correction\n"
" --render-mode=MODE Enable additional render modes (cga, ega, hercGreen,\n"
- " hercAmber, amiga)\n"
+ " hercAmber, amiga)\n"
" --force-1x-overlay Make inner GUI 320x200\n"
"\n"
#if !defined(DISABLE_SKY) || !defined(DISABLE_QUEEN)
@@ -472,6 +474,10 @@ void GameDetector::parseCommandLine(int argc, char **argv) {
ConfMan.set("platform", option, kTransientDomain);
END_OPTION
+ DO_LONG_OPTION("soundfont")
+ ConfMan.set("soundfont", option, kTransientDomain);
+ END_OPTION
+
DO_LONG_OPTION_BOOL("multi-midi")
ConfMan.set("multi_midi", cmdValue, kTransientDomain);
END_OPTION
diff --git a/configure b/configure
index e85ab85865..99032fbae3 100755
--- a/configure
+++ b/configure
@@ -20,6 +20,7 @@ _mad=auto
_alsa=auto
_zlib=auto
_mpeg2=auto
+_fluidsynth=auto
_mt32emu=yes
# default option behaviour yes/no
_build_scumm=yes
@@ -294,6 +295,9 @@ Optional Libraries:
--with-mpeg2-prefix=DIR Prefix where libmpeg2 is installed (optional)
--disable-mpeg2 disable mpeg2 codec for cutscenes [autodetect]
+ --with-fluidsynth-prefix=DIR Prefix where libfluidsynth is installed (optional)
+ --disable-fluidsynth disable fluidsynth MIDI driver [autodetect]
+
--with-sdl-prefix=DIR Prefix where the sdl-config script is installed (optional)
--with-nasm-prefix=DIR Prefix where nasm executable is installed (optional)
@@ -338,9 +342,15 @@ for ac_option in $@; do
--enable-nasm) _nasm=yes ;;
--disable-nasm) _nasm=no ;;
--disable-mpeg2) _mpeg2=no ;;
+ --disable-fluidsynth) _fluidsynth=no ;;
--enable-plugins) _build_plugins=yes ;;
--enable-mt32emu) _mt32emu=yes ;;
--disable-mt32emu) _mt32emu=no ;;
+ --with-fluidsynth-prefix=*)
+ _prefix=`echo $ac_option | cut -d '=' -f 2`
+ FLUIDSYNTH_CFLAGS="-I$_prefix/include"
+ FLUIDSYNTH_LIBS="-L$_prefix/lib"
+ ;;
--with-mpeg2-prefix=*)
_prefix=`echo $ac_option | cut -d '=' -f 2`
MPEG2_CFLAGS="-I$_prefix/include"
@@ -991,6 +1001,28 @@ echo "$_mpeg2"
rm -f $TMPC $TMPO$EXEEXT
#
+# Check for libfluidsynth
+#
+echocheck "libfluidsynth"
+if test "$_fluidsynth" = auto ; then
+ _fluidsynth=no
+ cat > $TMPC << EOF
+#include <fluidsynth.h>
+int main(void) { return 0; }
+EOF
+ cc_check $LDFLAGS $CXXFLAGS $FLUIDSYNTH_CFLAGS $FLUIDSYNTH_LIBS -lfluidsynth && _fluidsynth=yes
+fi
+if test "$_fluidsynth" = yes ; then
+ _def_fluidsynth='#define USE_FLUIDSYNTH'
+ LIBS="$LIBS $FLUIDSYNTH_LIBS -lfluidsynth"
+ INCLUDE="$INCLUDES $FLUIDSYNTH_CFLAGS"
+else
+ _def_fluidsynth='#undef USE_FLUIDSYNTH'
+fi
+echo "$_fluidsynth"
+rm -f $TMPC $TMPO$EXEEXT
+
+#
# Check for nasm
#
if test "$_have_x86" = yes ; then
@@ -1126,6 +1158,7 @@ $_def_mad
$_def_alsa
$_def_zlib
$_def_mpeg2
+$_def_fluidsynth
$_def_mt32emu
/* Whether we should use i386 assembly routines */
diff --git a/doc/05_01.tex b/doc/05_01.tex
index 5f91f8db5b..2afc462e53 100644
--- a/doc/05_01.tex
+++ b/doc/05_01.tex
@@ -36,6 +36,8 @@ Usage: scummvm [OPTIONS]... [GAME]\\
&atari, fmtowns, mac, pc, windows)\\
--savepath=PATH &Path to where savegames are stored\\
--multi-midi &Enable combination of Adlib and native MIDI\\
+ --soundfont &Select the SoundFont for MIDI playback. (Only\\
+ &supported by some MIDI drivers.)\\
--native-mt32 &True Roland MT-32 (disable GM emulation)\\
--output-rate=RATE &Select output sample rate in Hz (e.g. 22050)\\
--aspect-ratio &Enable aspect ratio correction\\
diff --git a/doc/07.tex b/doc/07.tex
index f4c2a61459..f9662cdb9a 100644
--- a/doc/07.tex
+++ b/doc/07.tex
@@ -11,18 +11,19 @@ manual configuration. If you ARE using MIDI, you have several different
choices of output, depending on your operating system and configuration.
\begin{tabular}[h]{ll}
- adlib & Uses internal Adlib Emulation (default)\\
- mt32 & Uses internal MT-32 Emulation\\
- pcjr & Uses internal PCjr Emulation \\
- pcspk & Uses internal PC Speaker Emulation\\
- towns & Uses FM-TOWNS YM2612 Emulation\\
- windows & Windows MIDI. Uses built-in sequencer, for Windows users\\
- seq & Uses /dev/sequencer for MIDI, *nix users. See below.\\
- qt & Quicktime sound, for Macintosh users.\\
- core & CoreAudio sound, for MacOS X users.\\
- amidi & Uses the MorphOS MIDI system, for MorphOS users\\
- alsa & Output using ALSA sequencer device. See below.\\
- null & Null output. Don't play any music.\\
+ adlib & Uses internal Adlib Emulation (default)\\
+ fluidsynth & Uses FluidSynth MIDI Emulation\\
+ mt32 & Uses internal MT-32 Emulation\\
+ pcjr & Uses internal PCjr Emulation \\
+ pcspk & Uses internal PC Speaker Emulation\\
+ towns & Uses FM-TOWNS YM2612 Emulation\\
+ windows & Windows MIDI. Uses built-in sequencer, for Windows users\\
+ seq & Uses /dev/sequencer for MIDI, *nix users. See below.\\
+ qt & Quicktime sound, for Macintosh users.\\
+ core & CoreAudio sound, for MacOS X users.\\
+ amidi & Uses the MorphOS MIDI system, for MorphOS users\\
+ alsa & Output using ALSA sequencer device. See below.\\
+ null & Null output. Don't play any music.\\
\end{tabular}
To select a sound driver, pass its name via the '-e' option to scummvm,
@@ -32,6 +33,7 @@ for example:
\end{verbatim}
\input {07_01.tex}
+\input {07_02b.tex}
\input {07_02a.tex}
\input {07_02.tex}
\input {07_03.tex}
diff --git a/doc/08.tex b/doc/08.tex
index a6a17a6b7c..56e829415d 100644
--- a/doc/08.tex
+++ b/doc/08.tex
@@ -98,6 +98,8 @@ The following keywords are recognized:
music\_volume &number The music volume setting (0-255)\\
multi\_midi &bool If true, enable combination Adlib and native\\
& MIDI.\\
+ soundfont &string The SoundFont to use for MIDI playback. (Only\\
+ & supported by some MIDI drivers.)\\
native\_mt32 &bool If true, disable GM emulation and assume that\\
& there is a true Roland MT-32 available.\\
sfx\_volume &number The sfx volume setting (0-255)\\
diff --git a/gui/browser.cpp b/gui/browser.cpp
index 9e42f6900e..5294c9860c 100644
--- a/gui/browser.cpp
+++ b/gui/browser.cpp
@@ -34,16 +34,16 @@ namespace GUI {
* other operating systems.
*/
-BrowserDialog::BrowserDialog(const char *title)
+DirBrowserDialog::DirBrowserDialog(const char *title)
: Dialog(20, 10, 320 -2 * 20, 200 - 2 * 10) {
_titleRef = CFStringCreateWithCString(0, title, CFStringGetSystemEncoding());
}
-BrowserDialog::~BrowserDialog() {
+DirBrowserDialog::~DirBrowserDialog() {
CFRelease(_titleRef);
}
-int BrowserDialog::runModal() {
+int DirBrowserDialog::runModal() {
NavDialogRef dialogRef;
WindowRef windowRef = 0;
NavDialogCreationOptions options;
@@ -125,7 +125,7 @@ enum {
kGoUpCmd = 'GoUp'
};
-BrowserDialog::BrowserDialog(const char *title)
+DirBrowserDialog::DirBrowserDialog(const char *title)
: Dialog(20, 10, 320 -2 * 20, 200 - 2 * 10)
{
@@ -150,7 +150,7 @@ BrowserDialog::BrowserDialog(const char *title)
addButton(_w - (kButtonWidth+10), _h - 24, "Choose", kChooseCmd, 0);
}
-void BrowserDialog::open() {
+void DirBrowserDialog::open() {
// If no node has been set, or the last used one is now invalid,
// go back to the root/default dir.
if (!_node.isValid()) {
@@ -164,7 +164,7 @@ void BrowserDialog::open() {
Dialog::open();
}
-void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+void DirBrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kChooseCmd: {
// If nothing is selected in the list widget, choose the current dir.
@@ -193,7 +193,7 @@ void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
}
}
-void BrowserDialog::updateListing() {
+void DirBrowserDialog::updateListing() {
// Update the path display
_currentPath->setLabel(_node.path());
@@ -216,4 +216,106 @@ void BrowserDialog::updateListing() {
#endif // MACOSX
+FileBrowserDialog::FileBrowserDialog(const char *title)
+ : Dialog(20, 10, 320 -2 * 20, 200 - 2 * 10)
+ {
+
+ _fileList = NULL;
+ _currentPath = NULL;
+
+ // Headline - TODO: should be customizable during creation time
+ new StaticTextWidget(this, 10, 8, _w - 2 * 10, kLineHeight, title, kTextAlignCenter);
+
+ // Current path - TODO: handle long paths ?
+ _currentPath = new StaticTextWidget(this, 10, 20, _w - 2 * 10, kLineHeight,
+ "DUMMY", kTextAlignLeft);
+
+ // Add file list
+ _fileList = new ListWidget(this, 10, 34, _w - 2 * 10, _h - 34 - 24 - 10);
+ _fileList->setNumberingMode(kListNumberingOff);
+ _fileList->setEditable(false);
+
+ // Buttons
+ addButton(10, _h - 24, "Go up", kGoUpCmd, 0);
+ addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
+ addButton(_w - (kButtonWidth+10), _h - 24, "Choose", kChooseCmd, 0);
+}
+
+void FileBrowserDialog::open() {
+ // If no node has been set, or the last used one is now invalid,
+ // go back to the root/default dir.
+ if (!_node.isValid()) {
+ _node = FilesystemNode();
+ }
+
+ // Alway refresh file list
+ updateListing();
+
+ // Call super implementation
+ Dialog::open();
+}
+
+void FileBrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ switch (cmd) {
+ case kChooseCmd: {
+ int selection = _fileList->getSelected();
+ if (selection < 0)
+ break;
+ if (_nodeContent[selection].isDirectory()) {
+ _node = _nodeContent[selection];
+ updateListing();
+ } else {
+ _choice = _nodeContent[selection];
+ setResult(1);
+ close();
+ }
+ }
+ break;
+ case kGoUpCmd:
+ _node = _node.getParent();
+ updateListing();
+ break;
+ case kListItemActivatedCmd:
+ case kListItemDoubleClickedCmd:
+ if (_nodeContent[data].isDirectory()) {
+ _node = _nodeContent[data];
+ updateListing();
+ } else {
+ _choice = _nodeContent[data];
+ setResult(1);
+ close();
+ }
+ break;
+ default:
+ Dialog::handleCommand(sender, cmd, data);
+ }
+}
+
+void FileBrowserDialog::updateListing() {
+ // Update the path display
+ _currentPath->setLabel(_node.path());
+
+ // Read in the data from the file system
+ _nodeContent = _node.listDir(AbstractFilesystemNode::kListAll);
+ _nodeContent.sort();
+
+ // Populate the ListWidget
+ Common::StringList list;
+ int size = _nodeContent.size();
+ int i;
+
+ for (i = 0; i < size; i++) {
+ if (_nodeContent[i].isDirectory())
+ list.push_back(_nodeContent[i].displayName() + "/");
+ else
+ list.push_back(_nodeContent[i].displayName());
+ }
+
+ _fileList->setList(list);
+ _fileList->scrollTo(0);
+
+ // Finally, redraw
+ draw();
+}
+
} // End of namespace GUI
diff --git a/gui/browser.h b/gui/browser.h
index 97b573f1ee..46b3512fe7 100644
--- a/gui/browser.h
+++ b/gui/browser.h
@@ -34,14 +34,16 @@ namespace GUI {
class ListWidget;
class StaticTextWidget;
-class BrowserDialog : public Dialog {
+// TODO: Common parent class for DirBrowserDialog and FileBrowserDialog
+
+class DirBrowserDialog : public Dialog {
typedef Common::String String;
typedef Common::StringList StringList;
public:
- BrowserDialog(const char *title);
+ DirBrowserDialog(const char *title);
#ifdef MACOSX
- ~BrowserDialog();
+ ~DirBrowserDialog();
virtual int runModal();
#else
virtual void open();
@@ -50,13 +52,12 @@ public:
const FilesystemNode &getResult() { return _choice; }
-
protected:
#ifdef MACOSX
CFStringRef _titleRef;
#else
ListWidget *_fileList;
- StaticTextWidget*_currentPath;
+ StaticTextWidget *_currentPath;
FilesystemNode _node;
FSList _nodeContent;
#endif
@@ -67,6 +68,29 @@ protected:
#endif
};
+// TODO: MACOSX version
+
+class FileBrowserDialog : public Dialog {
+ typedef Common::String String;
+ typedef Common::StringList StringList;
+public:
+ FileBrowserDialog(const char *title);
+
+ virtual void open();
+ virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+
+ const FilesystemNode &getResult() { return _choice; }
+
+protected:
+ ListWidget *_fileList;
+ StaticTextWidget *_currentPath;
+ FilesystemNode _node;
+ FSList _nodeContent;
+ FilesystemNode _choice;
+
+ void updateListing();
+};
+
} // End of namespace GUI
#endif
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 07acdad6ee..e9b784ef45 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -349,7 +349,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
// Change path for the game
case kCmdGameBrowser: {
- BrowserDialog *_browser = new BrowserDialog("Select additional game directory");
+ DirBrowserDialog *_browser = new DirBrowserDialog("Select additional game directory");
if (_browser->runModal() > 0) {
// User made his choice...
FilesystemNode dir(_browser->getResult());
@@ -366,7 +366,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
// Change path for extra game data (eg, using sword cutscenes when playing via CD)
case kCmdExtraBrowser: {
- BrowserDialog *_browser = new BrowserDialog("Select additional game directory");
+ DirBrowserDialog *_browser = new DirBrowserDialog("Select additional game directory");
if (_browser->runModal() > 0) {
// User made his choice...
FilesystemNode dir(_browser->getResult());
@@ -377,7 +377,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
}
// Change path for stored save game (perm and temp) data
case kCmdSaveBrowser: {
- BrowserDialog *_browser = new BrowserDialog("Select directory for saved games");
+ DirBrowserDialog *_browser = new DirBrowserDialog("Select directory for saved games");
if (_browser->runModal() > 0) {
// User made his choice...
FilesystemNode dir(_browser->getResult());
@@ -449,7 +449,7 @@ LauncherDialog::LauncherDialog(GameDetector &detector)
updateButtons();
// Create file browser dialog
- _browser = new BrowserDialog("Select directory with game data");
+ _browser = new DirBrowserDialog("Select directory with game data");
}
void LauncherDialog::selectGame(const String &name) {
diff --git a/gui/launcher.h b/gui/launcher.h
index ba6cfa5210..90c51b657d 100644
--- a/gui/launcher.h
+++ b/gui/launcher.h
@@ -28,7 +28,7 @@ class GameDetector;
namespace GUI {
-class BrowserDialog;
+class DirBrowserDialog;
class ListWidget;
class LauncherDialog : public Dialog {
@@ -47,7 +47,7 @@ protected:
Widget *_removeButton;
StringList _domains;
GameDetector &_detector;
- BrowserDialog *_browser;
+ DirBrowserDialog *_browser;
void updateListing();
void updateButtons();
diff --git a/gui/options.cpp b/gui/options.cpp
index c3f21b5163..040fafc9d0 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -50,7 +50,7 @@
namespace GUI {
// TODO - allow changing options for:
-// - the save path (use _browser!)
+// - the save path (use _dirBrowser!)
// - music & graphics driver (but see also the comments on EditGameDialog
// for some techincal difficulties with this)
// - default volumes (sfx/speech/music)
@@ -60,6 +60,7 @@ enum {
kMusicVolumeChanged = 'muvc',
kSfxVolumeChanged = 'sfvc',
kSpeechVolumeChanged = 'vcvc',
+ kChooseSoundFontCmd = 'chsf',
kChooseSaveDirCmd = 'chos',
kChooseExtraDirCmd = 'chex'
};
@@ -343,18 +344,24 @@ int OptionsDialog::addMIDIControls(GuiObject *boss, int yoffset) {
_midiPopUp->appendEntry(md->description, md->id);
md++;
}
+
+ // SoundFont
+ new ButtonWidget(boss, x, yoffset, kButtonWidth + 14, 16, "SoundFont: ", kChooseSoundFontCmd, 0);
+ _soundFont = new StaticTextWidget(boss, x + kButtonWidth + 20, yoffset + 3, _w - (x + kButtonWidth + 20) - 10, kLineHeight, "None", kTextAlignLeft);
+
+ yoffset += 18;
// Multi midi setting
_multiMidiCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Mixed Adlib/MIDI mode");
- yoffset += 16;
+ yoffset += 15;
// Native mt32 setting
_mt32Checkbox = new CheckboxWidget(boss, x, yoffset, w, 16, "True Roland MT-32 (disable GM emulation)");
- yoffset += 16;
+ yoffset += 15;
// Subtitles on/off
_subCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Display subtitles");
- yoffset += 16;
+ yoffset += 15;
_enableAudioSettings = true;
@@ -448,8 +455,9 @@ GlobalOptionsDialog::GlobalOptionsDialog(GameDetector &detector)
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
- // Create file browser dialog
- _browser = new BrowserDialog("Select directory for savegames");
+ // Create file browser dialogs
+ _dirBrowser = new DirBrowserDialog("Select directory for savegames");
+ _fileBrowser = new FileBrowserDialog("Select SoundFont");
#ifdef _WIN32_WCE
_keysDialog = new CEKeysDialog();
@@ -457,7 +465,8 @@ GlobalOptionsDialog::GlobalOptionsDialog(GameDetector &detector)
}
GlobalOptionsDialog::~GlobalOptionsDialog() {
- delete _browser;
+ delete _dirBrowser;
+ delete _fileBrowser;
#ifdef _WIN32_WCE
delete _keysDialog;
@@ -471,6 +480,7 @@ void GlobalOptionsDialog::open() {
// Set _savePath to the current save path
Common::String dir(ConfMan.get("savepath", _domain));
Common::String extraPath(ConfMan.get("extrapath", _domain));
+ Common::String soundFont(ConfMan.get("soundfont", _domain));
if (!dir.isEmpty()) {
_savePath->setLabel(dir);
@@ -486,6 +496,12 @@ void GlobalOptionsDialog::open() {
} else {
_extraPath->setLabel(extraPath);
}
+
+ if (soundFont.isEmpty() || !ConfMan.hasKey("soundfont", _domain)) {
+ _soundFont->setLabel("None");
+ } else {
+ _soundFont->setLabel(soundFont);
+ }
#endif
}
@@ -497,6 +513,10 @@ void GlobalOptionsDialog::close() {
String extraPath = _extraPath->getLabel();
if (!extraPath.isEmpty() && (extraPath != "None"))
ConfMan.set("extrapath", extraPath, _domain);
+
+ String soundFont = _soundFont->getLabel();
+ if (!soundFont.isEmpty() && (soundFont != "None"))
+ ConfMan.set("soundfont", soundFont, _domain);
}
OptionsDialog::close();
}
@@ -504,20 +524,27 @@ void GlobalOptionsDialog::close() {
void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kChooseSaveDirCmd:
- if (_browser->runModal() > 0) {
+ if (_dirBrowser->runModal() > 0) {
// User made his choice...
- FilesystemNode dir(_browser->getResult());
+ FilesystemNode dir(_dirBrowser->getResult());
_savePath->setLabel(dir.path());
// TODO - we should check if the directory is writeable before accepting it
}
break;
case kChooseExtraDirCmd:
- if (_browser->runModal() > 0) {
+ if (_dirBrowser->runModal() > 0) {
// User made his choice...
- FilesystemNode dir(_browser->getResult());
+ FilesystemNode dir(_dirBrowser->getResult());
_extraPath->setLabel(dir.path());
}
break;
+ case kChooseSoundFontCmd:
+ if (_fileBrowser->runModal() > 0) {
+ // User made his choice...
+ FilesystemNode file(_fileBrowser->getResult());
+ _soundFont->setLabel(file.path());
+ }
+ break;
#ifdef _WIN32_WCE
case kChooseKeyMappingCmd:
_keysDialog->runModal();
diff --git a/gui/options.h b/gui/options.h
index 497e216ed5..5797a62494 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -32,7 +32,8 @@ class GameDetector;
namespace GUI {
-class BrowserDialog;
+class DirBrowserDialog;
+class FileBrowserDialog;
class CheckboxWidget;
class PopUpWidget;
class SliderWidget;
@@ -55,6 +56,8 @@ protected:
/** Config domain this dialog is used to edit. */
String _domain;
+ StaticTextWidget *_soundFont;
+
int addGraphicControls(GuiObject *boss, int yoffset);
int addMIDIControls(GuiObject *boss, int yoffset);
int addVolumeControls(GuiObject *boss, int yoffset);
@@ -109,7 +112,8 @@ public:
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
protected:
- BrowserDialog *_browser;
+ DirBrowserDialog *_dirBrowser;
+ FileBrowserDialog *_fileBrowser;
#ifdef _WIN32_WCE
CEKeysDialog *_keysDialog;
#endif
diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp
index 5567d7134c..b233ad9a62 100644
--- a/sound/mididrv.cpp
+++ b/sound/mididrv.cpp
@@ -58,6 +58,9 @@ static const struct MidiDriverDescription midiDrivers[] = {
{"towns", "FM Towns", MD_TOWNS},
{"pcspk", "PC Speaker", MD_PCSPK},
{"pcjr", "IBM PCjr", MD_PCJR},
+#ifdef USE_FLUIDSYNTH
+ {"fluidsynth", "FluidSynth", MD_FLUIDSYNTH},
+#endif
#ifdef USE_MT32EMU
{"mt32", "MT-32", MD_MT32},
#endif
@@ -172,6 +175,9 @@ MidiDriver *MidiDriver::createMidi(int midiDriver) {
// driver.
case MD_ADLIB: return NULL;
+#ifdef USE_FLUIDSYNTH
+ case MD_FLUIDSYNTH: return MidiDriver_FluidSynth_create(g_engine->_mixer);
+#endif
#ifdef USE_MT32EMU
case MD_MT32: return MidiDriver_MT32_create(g_engine->_mixer);
#endif
diff --git a/sound/mididrv.h b/sound/mididrv.h
index 58082e3cd0..3f9db6a664 100644
--- a/sound/mididrv.h
+++ b/sound/mididrv.h
@@ -48,7 +48,8 @@ enum {
MD_TOWNS = 13,
MD_YPA1 = 14, // PalmOS
MD_ZODIAC = 15, // PalmOS
- MD_MT32 = 16
+ MD_MT32 = 16,
+ MD_FLUIDSYNTH = 17
};
enum MidiDriverType {
@@ -195,6 +196,9 @@ extern MidiDriver *MidiDriver_CORE_create();
extern MidiDriver *MidiDriver_ETUDE_create();
extern MidiDriver *MidiDriver_ALSA_create();
extern MidiDriver *MidiDriver_YM2612_create(SoundMixer *mixer);
+#ifdef USE_FLUIDSYNTH
+extern MidiDriver *MidiDriver_FluidSynth_create(SoundMixer *mixer);
+#endif
#ifdef USE_MT32EMU
extern MidiDriver *MidiDriver_MT32_create(SoundMixer *mixer);
#endif
diff --git a/sound/module.mk b/sound/module.mk
index 84e40c9607..e57d145b55 100644
--- a/sound/module.mk
+++ b/sound/module.mk
@@ -18,6 +18,7 @@ MODULE_OBJS := \
sound/wave.o \
sound/softsynth/adlib.o \
sound/softsynth/ym2612.o \
+ sound/softsynth/fluidsynth.o \
sound/softsynth/mt32.o \
MODULE_DIRS += \