Ticket #8413: fluidsynth4.diff
File fluidsynth4.diff, 40.3 KB (added by , 20 years ago) |
---|
-
README
diff -urN ScummVM-cvs20050409/README ScummVM-cvs20050409+hack/README
old new 31 31 * 6.1 Autosaves 32 32 7.0) Music and Sound 33 33 * 7.1 Adlib emulation 34 * 7.2 MT-32 emulation 35 * 7.3 MIDI emulation 36 * 7.4 Native MIDI support 37 * 7.5 UNIX native & ALSA sequencer support 38 * 7.6 Using compressed audiofiles (MP3, Ogg Vorbis, Flac) 39 * 7.7 Output sample rate 34 * 7.2 FluidSynth MIDI emulation 35 * 7.3 MT-32 emulation 36 * 7.4 MIDI emulation 37 * 7.5 Native MIDI support 38 * 7.6 UNIX native & ALSA sequencer support 39 * 7.7 Using compressed audiofiles (MP3, Ogg Vorbis, Flac) 40 * 7.8 Output sample rate 40 41 8.0) Configuration Files 41 42 9.0) Compiling 42 43 … … 369 370 --platform=WORD Specify version of game (allowed values: amiga, 370 371 atari, fmtowns, mac, pc, windows) 371 372 --savepath=PATH Path to where savegames are stored 373 --soundfont=FILE Select the SoundFont for MIDI playback. (Only 374 supported by some MIDI drivers.) 372 375 --multi-midi Enable combination of Adlib and native MIDI 373 376 --native-mt32 True Roland MT-32 (disable GM emulation) 374 377 --output-rate=RATE Select output sample rate in Hz (e.g. 22050) … … 705 708 manual configuration. If you ARE using MIDI, you have several different 706 709 choices of output, depending on your operating system and configuration. 707 710 708 null - Null output. Don't play any music.711 null - Null output. Don't play any music. 709 712 710 adlib - Internal Adlib emulation (default) 711 mt32 - Internal MT-32 emulation 712 pcjr - Internal PCjr emulation 713 pcspk - Internal PC Speaker emulation 714 towns - Internal FM-TOWNS YM2612 emulation 715 716 alsa - Output using ALSA sequencer device. See below. 717 amidi - Use the MorphOS MIDI system, for MorphOS users 718 core - CoreAudio sound, for Mac OS X users. 719 qt - Quicktime sound, for Macintosh users. 720 seq - Use /dev/sequencer for MIDI, *nix users. See below. 721 windows - Windows MIDI. Uses built-in sequencer, for Windows users 713 adlib - Internal Adlib emulation (default) 714 fluidsynth - FluidSynth MIDI emulation 715 mt32 - Internal MT-32 emulation 716 pcjr - Internal PCjr emulation 717 pcspk - Internal PC Speaker emulation 718 towns - Internal FM-TOWNS YM2612 emulation 719 720 alsa - Output using ALSA sequencer device. See below. 721 amidi - Use the MorphOS MIDI system, for MorphOS users 722 core - CoreAudio sound, for Mac OS X users. 723 qt - Quicktime sound, for Macintosh users. 724 seq - Use /dev/sequencer for MIDI, *nix users. See below. 725 windows - Windows MIDI. Uses built-in sequencer, for Windows users 722 726 723 727 To select a sound driver, pass its name via the '-e' option to scummvm, 724 728 for example: … … 732 736 as sampled waves. This is the default mode for most games, and offers the 733 737 best compatibility between machines and games. 734 738 735 7.2) Playing sound with MT-32 emulation: 739 740 7.2) Playing sound with FluildSynth MIDI emulation: 741 ---- ---------------------------------------------- 742 If ScummVM was build with libfluildsynth support it will be able to play MIDI 743 music through the FluidSynth driver. You will have to specify a SoundFont to 744 use, however. 745 746 NOTE: The processor requirements for FluidSynth can be fairly high in some 747 cases. A fast CPU is recommended. 748 749 750 7.3) Playing sound with MT-32 emulation: 736 751 ---- ----------------------------------- 737 752 Some games which contain MIDI music data also have improved tracks designed 738 753 for the MT-32 sound module. ScummVM can now emulate this device, however you … … 749 764 NOTE: The processor requirements for the emulator are quite high; a fast CPU is 750 765 strongly recommended. 751 766 752 7.3) Playing sound with MIDI emulation: 767 768 7.4) Playing sound with MIDI emulation: 753 769 ---- ---------------------------------- 754 770 Some games (such as Sam and Max) only contain MIDI music data. This once 755 771 prevented music for these games from working on platforms that do not support 756 772 MIDI, or soundcards that do not provide MIDI drivers (e.g, many soundcards will 757 773 not play MIDI under Linux). ScummVM can now emulate MIDI mode using sampled 758 waves and Adlib or MT-32 emulation using the -eadlib or -emt32 options 759 respectively. However, if you are capable of using native MIDI, we recommend 760 using one of the MIDI modes below for best sound. 774 waves and Adlib, FluidSynth MIDI emulation or MT-32 emulation using the 775 -eadlib, -efluidsynth or -emt32 options respectively. However, if you are 776 capable of using native MIDI, we recommend using one of the MIDI modes below 777 for best sound. 761 778 762 779 763 7. 4) Playing sound with Native MIDI:780 7.5) Playing sound with Native MIDI: 764 781 ---- ------------------------------- 765 782 Use the appropriate -e<mode> command line option from the list above to 766 783 select your preferred MIDI device. For example, if you wish to use the 767 784 Windows MIDI driver, use the -ewindows option. 768 785 769 786 770 7. 5.0) Playing sound with Sequencer MIDI: [UNIX ONLY]787 7.6.0) Playing sound with Sequencer MIDI: [UNIX ONLY] 771 788 ------ ---------------------------------- 772 789 If your soundcard driver supports a sequencer, you may set the environment 773 790 variable "SCUMMVM_MIDI" to your sequencer device - e.g., /dev/sequencer … … 780 797 sequencer support does not work, you can always fall back on Adlib emulation. 781 798 782 799 783 7. 5.1) Playing sound with ALSA sequencer: [UNIX ONLY]800 7.6.1) Playing sound with ALSA sequencer: [UNIX ONLY] 784 801 ------ ---------------------------------- 785 802 If you have installed the ALSA driver with the sequencer support, then 786 803 set the environment variable SCUMMVM_PORT or the config file parameter … … 829 846 Once either TiMidity or FluidSynth are running, use the 'aconnect -o -l' 830 847 command as described earlier in this section. 831 848 832 7. 6.0) Using MP3 files for CD audio:849 7.7.0) Using MP3 files for CD audio: 833 850 ------ ----------------------------- 834 851 Use LAME or some other MP3 encoder to rip the cd audio tracks to files. Name 835 852 the files track1.mp3 track2.mp3 etc. ScummVM must be compiled with MAD support … … 840 857 lame -t -q 0 -b 96 track1.wav track1.mp3 841 858 842 859 843 7. 6.1) Using Ogg Vorbis files for CD audio:860 7.7.1) Using Ogg Vorbis files for CD audio: 844 861 ------ ------------------------------------ 845 862 Use oggenc or some other vorbis encoder to encode the audio tracks to files. 846 863 Name the files track1.ogg track2.ogg etc. ScummVM must be compiled with vorbis … … 851 868 oggenc -q 5 track1.wav 852 869 853 870 854 7. 6.2) Using Flac files for CD audio:871 7.7.2) Using Flac files for CD audio: 855 872 ------ ------------------------------------ 856 873 Use flac or some other flac encoder to encode the audio tracks to files. 857 874 Name the files track1.flac track2.flac etc. In your filesystem only allows … … 866 883 affect the encoding time and resulting filesize. 867 884 868 885 869 7. 6.3) Compressing MONSTER.SOU with MP3:886 7.7.3) Compressing MONSTER.SOU with MP3: 870 887 ------ --------------------------------- 871 888 You need LAME, and our compress_scumm_sou util from the scummvm-tools package 872 889 to perform this task, and ScummVM must be compiled with MAD support. … … 877 894 to your game directory. You can safely remove the monster.sou file. 878 895 879 896 880 7. 6.4) Compressing MONSTER.SOU with Ogg Vorbis:897 7.7.4) Compressing MONSTER.SOU with Ogg Vorbis: 881 898 ------ ---------------------------------------- 882 899 As above, but ScummVM must be compiled with OGG support. Run: 883 900 … … 888 905 than MP3, so have a good book handy. 889 906 890 907 891 7. 6.5) Compressing MONSTER.SOU with Flac:908 7.7.5) Compressing MONSTER.SOU with Flac: 892 909 ------ ---------------------------------------- 893 910 As above, but ScummVM must be compiled with Flac support. Run: 894 911 … … 902 919 to read the encoder documentation before you use other values. 903 920 904 921 905 7. 6.6) Compressing sfx/speech in Simon the Sorcerer 1 and 2922 7.7.6) Compressing sfx/speech in Simon the Sorcerer 1 and 2 906 923 ------ ---------------------------------------------------- 907 924 Use our compress_simon util from the scummvm-tools package to perform this 908 925 task. You can choose between multiple target formats, but note that you can … … 929 946 Eventually you will have a much smaller *.mp3, *.ogg or *.fla file, copy this 930 947 file to your game dir. You can safely remove the old file. 931 948 932 7. 6.7) Compressing speech/music in Broken Sword 1949 7.7.7) Compressing speech/music in Broken Sword 1 933 950 ------ ------------------------------------------ 934 951 The compress_sword1 tool from the scummvm-tools package can encode music and 935 952 speech to MP3 as well as Ogg Vorbis. … … 945 962 Use "compress_sword1 --help" to get a full list of the options. 946 963 947 964 948 7. 6.8) Compressing speech/music in Broken Sword 2965 7.7.8) Compressing speech/music in Broken Sword 2 949 966 ------ ------------------------------------------ 950 967 Use our compress_sword2 util from the scummvm-tools package to perform this 951 968 task. You can choose between multiple target formats, but note that you can … … 970 987 nor will it work with the speech files from Broken Sword 1. 971 988 972 989 973 7. 7) Output sample rate:990 7.8) Output sample rate: 974 991 ---- ------------------- 975 992 The output sample rate tells ScummVM how many sound samples to play per channel 976 993 per second. There is much that could be said on this subject, but most of it … … 1087 1104 music_volume number The music volume setting (0-255) 1088 1105 multi_midi bool If true, enable combination Adlib and native 1089 1106 MIDI. 1107 soundfont string The SoundFont to use for MIDI playback. (Only 1108 supported by some MIDI drivers.) 1090 1109 native_mt32 bool If true, disable GM emulation and assume that 1091 1110 there is a true Roland MT-32 available. 1092 1111 sfx_volume number The sfx volume setting (0-255) -
backends/fs/fs.h
diff -urN ScummVM-cvs20050409/backends/fs/fs.h ScummVM-cvs20050409+hack/backends/fs/fs.h
old new 131 131 virtual FSList listDir(ListMode mode = kListDirectoriesOnly) const = 0; 132 132 133 133 /** 134 * Compare the name of this node to the name of another. 134 * Compare the name of this node to the name of another. Directories 135 * go before normal files. 135 136 */ 136 137 virtual bool operator< (const AbstractFilesystemNode& node) const 137 138 { 139 if (isDirectory() && !node.isDirectory()) 140 return true; 141 if (!isDirectory() && node.isDirectory()) 142 return false; 138 143 return scumm_stricmp(displayName().c_str(), node.displayName().c_str()) < 0; 139 144 } 140 145 -
base/gameDetector.cpp
diff -urN ScummVM-cvs20050409/base/gameDetector.cpp ScummVM-cvs20050409+hack/base/gameDetector.cpp
old new 92 92 " --platform=WORD Specify version of game (allowed values: amiga,\n" 93 93 " atari, fmtowns, nes, mac, pc, windows)\n" 94 94 " --savepath=PATH Path to where savegames are stored\n" 95 " --soundfont=FILE Select the SoundFont for MIDI playback. (Only\n" 96 " supported by some MIDI drivers.)\n" 95 97 " --multi-midi Enable combination Adlib and native MIDI\n" 96 98 " --native-mt32 True Roland MT-32 (disable GM emulation)\n" 97 99 " --output-rate=RATE Select output sample rate in Hz (e.g. 22050)\n" 98 100 " --aspect-ratio Enable aspect ratio correction\n" 99 101 " --render-mode=MODE Enable additional render modes (cga, ega, hercGreen,\n" 100 102 " hercAmber, amiga)\n" 101 103 " --force-1x-overlay Make inner GUI 320x200\n" 102 104 "\n" 103 105 #if !defined(DISABLE_SKY) || !defined(DISABLE_QUEEN) … … 472 474 ConfMan.set("platform", option, kTransientDomain); 473 475 END_OPTION 474 476 477 DO_LONG_OPTION("soundfont") 478 ConfMan.set("soundfont", option, kTransientDomain); 479 END_OPTION 480 475 481 DO_LONG_OPTION_BOOL("multi-midi") 476 482 ConfMan.set("multi_midi", cmdValue, kTransientDomain); 477 483 END_OPTION -
configure
diff -urN ScummVM-cvs20050409/configure ScummVM-cvs20050409+hack/configure
old new 20 20 _alsa=auto 21 21 _zlib=auto 22 22 _mpeg2=auto 23 _fluidsynth=auto 23 24 _mt32emu=yes 24 25 # default option behaviour yes/no 25 26 _build_scumm=yes … … 294 295 --with-mpeg2-prefix=DIR Prefix where libmpeg2 is installed (optional) 295 296 --disable-mpeg2 disable mpeg2 codec for cutscenes [autodetect] 296 297 298 --with-fluidsynth-prefix=DIR Prefix where libfluidsynth is installed (optional) 299 --disable-fluidsynth disable fluidsynth MIDI driver [autodetect] 300 297 301 --with-sdl-prefix=DIR Prefix where the sdl-config script is installed (optional) 298 302 299 303 --with-nasm-prefix=DIR Prefix where nasm executable is installed (optional) … … 338 342 --enable-nasm) _nasm=yes ;; 339 343 --disable-nasm) _nasm=no ;; 340 344 --disable-mpeg2) _mpeg2=no ;; 345 --disable-fluidsynth) _fluidsynth=no ;; 341 346 --enable-plugins) _build_plugins=yes ;; 342 347 --enable-mt32emu) _mt32emu=yes ;; 343 348 --disable-mt32emu) _mt32emu=no ;; 349 --with-fluidsynth-prefix=*) 350 _prefix=`echo $ac_option | cut -d '=' -f 2` 351 FLUIDSYNTH_CFLAGS="-I$_prefix/include" 352 FLUIDSYNTH_LIBS="-L$_prefix/lib" 353 ;; 344 354 --with-mpeg2-prefix=*) 345 355 _prefix=`echo $ac_option | cut -d '=' -f 2` 346 356 MPEG2_CFLAGS="-I$_prefix/include" … … 991 1001 rm -f $TMPC $TMPO$EXEEXT 992 1002 993 1003 # 1004 # Check for libfluidsynth 1005 # 1006 echocheck "libfluidsynth" 1007 if test "$_fluidsynth" = auto ; then 1008 _fluidsynth=no 1009 cat > $TMPC << EOF 1010 #include <fluidsynth.h> 1011 int main(void) { return 0; } 1012 EOF 1013 cc_check $LDFLAGS $CXXFLAGS $FLUIDSYNTH_CFLAGS $FLUIDSYNTH_LIBS -lfluidsynth && _fluidsynth=yes 1014 fi 1015 if test "$_fluidsynth" = yes ; then 1016 _def_fluidsynth='#define USE_FLUIDSYNTH' 1017 LIBS="$LIBS $FLUIDSYNTH_LIBS -lfluidsynth" 1018 INCLUDE="$INCLUDES $FLUIDSYNTH_CFLAGS" 1019 else 1020 _def_fluidsynth='#undef USE_FLUIDSYNTH' 1021 fi 1022 echo "$_fluidsynth" 1023 rm -f $TMPC $TMPO$EXEEXT 1024 1025 # 994 1026 # Check for nasm 995 1027 # 996 1028 if test "$_have_x86" = yes ; then … … 1126 1158 $_def_alsa 1127 1159 $_def_zlib 1128 1160 $_def_mpeg2 1161 $_def_fluidsynth 1129 1162 $_def_mt32emu 1130 1163 1131 1164 /* Whether we should use i386 assembly routines */ -
doc/05_01.tex
diff -urN ScummVM-cvs20050409/doc/05_01.tex ScummVM-cvs20050409+hack/doc/05_01.tex
old new 36 36 &atari, fmtowns, mac, pc, windows)\\ 37 37 --savepath=PATH &Path to where savegames are stored\\ 38 38 --multi-midi &Enable combination of Adlib and native MIDI\\ 39 --soundfont &Select the SoundFont for MIDI playback. (Only\\ 40 &supported by some MIDI drivers.)\\ 39 41 --native-mt32 &True Roland MT-32 (disable GM emulation)\\ 40 42 --output-rate=RATE &Select output sample rate in Hz (e.g. 22050)\\ 41 43 --aspect-ratio &Enable aspect ratio correction\\ -
doc/07.tex
diff -urN ScummVM-cvs20050409/doc/07.tex ScummVM-cvs20050409+hack/doc/07.tex
old new 11 11 choices of output, depending on your operating system and configuration. 12 12 13 13 \begin{tabular}[h]{ll} 14 adlib & Uses internal Adlib Emulation (default)\\ 15 mt32 & Uses internal MT-32 Emulation\\ 16 pcjr & Uses internal PCjr Emulation \\ 17 pcspk & Uses internal PC Speaker Emulation\\ 18 towns & Uses FM-TOWNS YM2612 Emulation\\ 19 windows & Windows MIDI. Uses built-in sequencer, for Windows users\\ 20 seq & Uses /dev/sequencer for MIDI, *nix users. See below.\\ 21 qt & Quicktime sound, for Macintosh users.\\ 22 core & CoreAudio sound, for MacOS X users.\\ 23 amidi & Uses the MorphOS MIDI system, for MorphOS users\\ 24 alsa & Output using ALSA sequencer device. See below.\\ 25 null & Null output. Don't play any music.\\ 14 adlib & Uses internal Adlib Emulation (default)\\ 15 fluidsynth & Uses FluidSynth MIDI Emulation\\ 16 mt32 & Uses internal MT-32 Emulation\\ 17 pcjr & Uses internal PCjr Emulation \\ 18 pcspk & Uses internal PC Speaker Emulation\\ 19 towns & Uses FM-TOWNS YM2612 Emulation\\ 20 windows & Windows MIDI. Uses built-in sequencer, for Windows users\\ 21 seq & Uses /dev/sequencer for MIDI, *nix users. See below.\\ 22 qt & Quicktime sound, for Macintosh users.\\ 23 core & CoreAudio sound, for MacOS X users.\\ 24 amidi & Uses the MorphOS MIDI system, for MorphOS users\\ 25 alsa & Output using ALSA sequencer device. See below.\\ 26 null & Null output. Don't play any music.\\ 26 27 \end{tabular} 27 28 28 29 To select a sound driver, pass its name via the '-e' option to scummvm, … … 32 33 \end{verbatim} 33 34 34 35 \input {07_01.tex} 36 \input {07_02b.tex} 35 37 \input {07_02a.tex} 36 38 \input {07_02.tex} 37 39 \input {07_03.tex} -
doc/07_02b.tex
diff -urN ScummVM-cvs20050409/doc/07_02b.tex ScummVM-cvs20050409+hack/doc/07_02b.tex
old new 1 2 %%% Local Variables: 3 %%% mode: latex 4 %%% TeX-master: "readme" 5 %%% End: 6 7 \subsection{Playing sound with FluidSynth MIDI emulation} 8 9 If ScummVM was build with libfluildsynth support it will be able to play MIDI 10 music through the FluidSynth driver. You will have to specify a SoundFont to 11 use, however. 12 13 \textbf{NOTE:} The processor requirements for FluidSynth can be fairly high in 14 some cases. A fast CPU is recommended. -
doc/08.tex
diff -urN ScummVM-cvs20050409/doc/08.tex ScummVM-cvs20050409+hack/doc/08.tex
old new 98 98 music\_volume &number The music volume setting (0-255)\\ 99 99 multi\_midi &bool If true, enable combination Adlib and native\\ 100 100 & MIDI.\\ 101 soundfont &string The SoundFont to use for MIDI playback. (Only\\ 102 & supported by some MIDI drivers.)\\ 101 103 native\_mt32 &bool If true, disable GM emulation and assume that\\ 102 104 & there is a true Roland MT-32 available.\\ 103 105 sfx\_volume &number The sfx volume setting (0-255)\\ -
gui/browser.cpp
diff -urN ScummVM-cvs20050409/gui/browser.cpp ScummVM-cvs20050409+hack/gui/browser.cpp
old new 34 34 * other operating systems. 35 35 */ 36 36 37 BrowserDialog::BrowserDialog(const char *title)37 DirBrowserDialog::DirBrowserDialog(const char *title) 38 38 : Dialog(20, 10, 320 -2 * 20, 200 - 2 * 10) { 39 39 _titleRef = CFStringCreateWithCString(0, title, CFStringGetSystemEncoding()); 40 40 } 41 41 42 BrowserDialog::~BrowserDialog() {42 DirBrowserDialog::~DirBrowserDialog() { 43 43 CFRelease(_titleRef); 44 44 } 45 45 46 int BrowserDialog::runModal() {46 int DirBrowserDialog::runModal() { 47 47 NavDialogRef dialogRef; 48 48 WindowRef windowRef = 0; 49 49 NavDialogCreationOptions options; … … 125 125 kGoUpCmd = 'GoUp' 126 126 }; 127 127 128 BrowserDialog::BrowserDialog(const char *title)128 DirBrowserDialog::DirBrowserDialog(const char *title) 129 129 : Dialog(20, 10, 320 -2 * 20, 200 - 2 * 10) 130 130 { 131 131 … … 150 150 addButton(_w - (kButtonWidth+10), _h - 24, "Choose", kChooseCmd, 0); 151 151 } 152 152 153 void BrowserDialog::open() {153 void DirBrowserDialog::open() { 154 154 // If no node has been set, or the last used one is now invalid, 155 155 // go back to the root/default dir. 156 156 if (!_node.isValid()) { … … 164 164 Dialog::open(); 165 165 } 166 166 167 void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {167 void DirBrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { 168 168 switch (cmd) { 169 169 case kChooseCmd: { 170 170 // If nothing is selected in the list widget, choose the current dir. … … 193 193 } 194 194 } 195 195 196 void BrowserDialog::updateListing() {196 void DirBrowserDialog::updateListing() { 197 197 // Update the path display 198 198 _currentPath->setLabel(_node.path()); 199 199 … … 216 216 217 217 #endif // MACOSX 218 218 219 FileBrowserDialog::FileBrowserDialog(const char *title) 220 : Dialog(20, 10, 320 -2 * 20, 200 - 2 * 10) 221 { 222 223 _fileList = NULL; 224 _currentPath = NULL; 225 226 // Headline - TODO: should be customizable during creation time 227 new StaticTextWidget(this, 10, 8, _w - 2 * 10, kLineHeight, title, kTextAlignCenter); 228 229 // Current path - TODO: handle long paths ? 230 _currentPath = new StaticTextWidget(this, 10, 20, _w - 2 * 10, kLineHeight, 231 "DUMMY", kTextAlignLeft); 232 233 // Add file list 234 _fileList = new ListWidget(this, 10, 34, _w - 2 * 10, _h - 34 - 24 - 10); 235 _fileList->setNumberingMode(kListNumberingOff); 236 _fileList->setEditable(false); 237 238 // Buttons 239 addButton(10, _h - 24, "Go up", kGoUpCmd, 0); 240 addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); 241 addButton(_w - (kButtonWidth+10), _h - 24, "Choose", kChooseCmd, 0); 242 } 243 244 void FileBrowserDialog::open() { 245 // If no node has been set, or the last used one is now invalid, 246 // go back to the root/default dir. 247 if (!_node.isValid()) { 248 _node = FilesystemNode(); 249 } 250 251 // Alway refresh file list 252 updateListing(); 253 254 // Call super implementation 255 Dialog::open(); 256 } 257 258 void FileBrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { 259 switch (cmd) { 260 case kChooseCmd: { 261 int selection = _fileList->getSelected(); 262 if (selection < 0) 263 break; 264 if (_nodeContent[selection].isDirectory()) { 265 _node = _nodeContent[selection]; 266 updateListing(); 267 } else { 268 _choice = _nodeContent[selection]; 269 setResult(1); 270 close(); 271 } 272 } 273 break; 274 case kGoUpCmd: 275 _node = _node.getParent(); 276 updateListing(); 277 break; 278 case kListItemActivatedCmd: 279 case kListItemDoubleClickedCmd: 280 if (_nodeContent[data].isDirectory()) { 281 _node = _nodeContent[data]; 282 updateListing(); 283 } else { 284 _choice = _nodeContent[data]; 285 setResult(1); 286 close(); 287 } 288 break; 289 default: 290 Dialog::handleCommand(sender, cmd, data); 291 } 292 } 293 294 void FileBrowserDialog::updateListing() { 295 // Update the path display 296 _currentPath->setLabel(_node.path()); 297 298 // Read in the data from the file system 299 _nodeContent = _node.listDir(AbstractFilesystemNode::kListAll); 300 _nodeContent.sort(); 301 302 // Populate the ListWidget 303 Common::StringList list; 304 int size = _nodeContent.size(); 305 int i; 306 307 for (i = 0; i < size; i++) { 308 if (_nodeContent[i].isDirectory()) 309 list.push_back(_nodeContent[i].displayName() + "/"); 310 else 311 list.push_back(_nodeContent[i].displayName()); 312 } 313 314 _fileList->setList(list); 315 _fileList->scrollTo(0); 316 317 // Finally, redraw 318 draw(); 319 } 320 219 321 } // End of namespace GUI -
gui/browser.h
diff -urN ScummVM-cvs20050409/gui/browser.h ScummVM-cvs20050409+hack/gui/browser.h
old new 34 34 class ListWidget; 35 35 class StaticTextWidget; 36 36 37 class BrowserDialog : public Dialog { 37 // TODO: Common parent class for DirBrowserDialog and FileBrowserDialog 38 39 class DirBrowserDialog : public Dialog { 38 40 typedef Common::String String; 39 41 typedef Common::StringList StringList; 40 42 public: 41 BrowserDialog(const char *title);43 DirBrowserDialog(const char *title); 42 44 43 45 #ifdef MACOSX 44 ~ BrowserDialog();46 ~DirBrowserDialog(); 45 47 virtual int runModal(); 46 48 #else 47 49 virtual void open(); … … 50 52 51 53 const FilesystemNode &getResult() { return _choice; } 52 54 53 54 55 protected: 55 56 #ifdef MACOSX 56 57 CFStringRef _titleRef; 57 58 #else 58 59 ListWidget *_fileList; 59 StaticTextWidget *_currentPath;60 StaticTextWidget *_currentPath; 60 61 FilesystemNode _node; 61 62 FSList _nodeContent; 62 63 #endif … … 67 68 #endif 68 69 }; 69 70 71 // TODO: MACOSX version 72 73 class FileBrowserDialog : public Dialog { 74 typedef Common::String String; 75 typedef Common::StringList StringList; 76 public: 77 FileBrowserDialog(const char *title); 78 79 virtual void open(); 80 virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); 81 82 const FilesystemNode &getResult() { return _choice; } 83 84 protected: 85 ListWidget *_fileList; 86 StaticTextWidget *_currentPath; 87 FilesystemNode _node; 88 FSList _nodeContent; 89 FilesystemNode _choice; 90 91 void updateListing(); 92 }; 93 70 94 } // End of namespace GUI 71 95 72 96 #endif -
gui/launcher.cpp
diff -urN ScummVM-cvs20050409/gui/launcher.cpp ScummVM-cvs20050409+hack/gui/launcher.cpp
old new 349 349 350 350 // Change path for the game 351 351 case kCmdGameBrowser: { 352 BrowserDialog *_browser = newBrowserDialog("Select additional game directory");352 DirBrowserDialog *_browser = new DirBrowserDialog("Select additional game directory"); 353 353 if (_browser->runModal() > 0) { 354 354 // User made his choice... 355 355 FilesystemNode dir(_browser->getResult()); … … 366 366 367 367 // Change path for extra game data (eg, using sword cutscenes when playing via CD) 368 368 case kCmdExtraBrowser: { 369 BrowserDialog *_browser = newBrowserDialog("Select additional game directory");369 DirBrowserDialog *_browser = new DirBrowserDialog("Select additional game directory"); 370 370 if (_browser->runModal() > 0) { 371 371 // User made his choice... 372 372 FilesystemNode dir(_browser->getResult()); … … 377 377 } 378 378 // Change path for stored save game (perm and temp) data 379 379 case kCmdSaveBrowser: { 380 BrowserDialog *_browser = newBrowserDialog("Select directory for saved games");380 DirBrowserDialog *_browser = new DirBrowserDialog("Select directory for saved games"); 381 381 if (_browser->runModal() > 0) { 382 382 // User made his choice... 383 383 FilesystemNode dir(_browser->getResult()); … … 449 449 updateButtons(); 450 450 451 451 // Create file browser dialog 452 _browser = new BrowserDialog("Select directory with game data");452 _browser = new DirBrowserDialog("Select directory with game data"); 453 453 } 454 454 455 455 void LauncherDialog::selectGame(const String &name) { -
gui/launcher.h
diff -urN ScummVM-cvs20050409/gui/launcher.h ScummVM-cvs20050409+hack/gui/launcher.h
old new 28 28 29 29 namespace GUI { 30 30 31 class BrowserDialog;31 class DirBrowserDialog; 32 32 class ListWidget; 33 33 34 34 class LauncherDialog : public Dialog { … … 47 47 Widget *_removeButton; 48 48 StringList _domains; 49 49 GameDetector &_detector; 50 BrowserDialog *_browser;50 DirBrowserDialog *_browser; 51 51 52 52 void updateListing(); 53 53 void updateButtons(); -
gui/options.cpp
diff -urN ScummVM-cvs20050409/gui/options.cpp ScummVM-cvs20050409+hack/gui/options.cpp
old new 50 50 namespace GUI { 51 51 52 52 // TODO - allow changing options for: 53 // - the save path (use _ browser!)53 // - the save path (use _dirBrowser!) 54 54 // - music & graphics driver (but see also the comments on EditGameDialog 55 55 // for some techincal difficulties with this) 56 56 // - default volumes (sfx/speech/music) … … 60 60 kMusicVolumeChanged = 'muvc', 61 61 kSfxVolumeChanged = 'sfvc', 62 62 kSpeechVolumeChanged = 'vcvc', 63 kChooseSoundFontCmd = 'chsf', 63 64 kChooseSaveDirCmd = 'chos', 64 65 kChooseExtraDirCmd = 'chex' 65 66 }; … … 343 344 _midiPopUp->appendEntry(md->description, md->id); 344 345 md++; 345 346 } 347 348 // SoundFont 349 new ButtonWidget(boss, x, yoffset, kButtonWidth + 14, 16, "SoundFont: ", kChooseSoundFontCmd, 0); 350 _soundFont = new StaticTextWidget(boss, x + kButtonWidth + 20, yoffset + 3, _w - (x + kButtonWidth + 20) - 10, kLineHeight, "None", kTextAlignLeft); 351 352 yoffset += 18; 346 353 347 354 // Multi midi setting 348 355 _multiMidiCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Mixed Adlib/MIDI mode"); 349 yoffset += 1 6;356 yoffset += 15; 350 357 351 358 // Native mt32 setting 352 359 _mt32Checkbox = new CheckboxWidget(boss, x, yoffset, w, 16, "True Roland MT-32 (disable GM emulation)"); 353 yoffset += 1 6;360 yoffset += 15; 354 361 355 362 // Subtitles on/off 356 363 _subCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Display subtitles"); 357 yoffset += 1 6;364 yoffset += 15; 358 365 359 366 _enableAudioSettings = true; 360 367 … … 448 455 addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); 449 456 addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); 450 457 451 // Create file browser dialog 452 _browser = new BrowserDialog("Select directory for savegames"); 458 // Create file browser dialogs 459 _dirBrowser = new DirBrowserDialog("Select directory for savegames"); 460 _fileBrowser = new FileBrowserDialog("Select SoundFont"); 453 461 454 462 #ifdef _WIN32_WCE 455 463 _keysDialog = new CEKeysDialog(); … … 457 465 } 458 466 459 467 GlobalOptionsDialog::~GlobalOptionsDialog() { 460 delete _browser; 468 delete _dirBrowser; 469 delete _fileBrowser; 461 470 462 471 #ifdef _WIN32_WCE 463 472 delete _keysDialog; … … 471 480 // Set _savePath to the current save path 472 481 Common::String dir(ConfMan.get("savepath", _domain)); 473 482 Common::String extraPath(ConfMan.get("extrapath", _domain)); 483 Common::String soundFont(ConfMan.get("soundfont", _domain)); 474 484 475 485 if (!dir.isEmpty()) { 476 486 _savePath->setLabel(dir); … … 486 496 } else { 487 497 _extraPath->setLabel(extraPath); 488 498 } 499 500 if (soundFont.isEmpty() || !ConfMan.hasKey("soundfont", _domain)) { 501 _soundFont->setLabel("None"); 502 } else { 503 _soundFont->setLabel(soundFont); 504 } 489 505 #endif 490 506 } 491 507 … … 497 513 String extraPath = _extraPath->getLabel(); 498 514 if (!extraPath.isEmpty() && (extraPath != "None")) 499 515 ConfMan.set("extrapath", extraPath, _domain); 516 517 String soundFont = _soundFont->getLabel(); 518 if (!soundFont.isEmpty() && (soundFont != "None")) 519 ConfMan.set("soundfont", soundFont, _domain); 500 520 } 501 521 OptionsDialog::close(); 502 522 } … … 504 524 void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { 505 525 switch (cmd) { 506 526 case kChooseSaveDirCmd: 507 if (_ browser->runModal() > 0) {527 if (_dirBrowser->runModal() > 0) { 508 528 // User made his choice... 509 FilesystemNode dir(_ browser->getResult());529 FilesystemNode dir(_dirBrowser->getResult()); 510 530 _savePath->setLabel(dir.path()); 511 531 // TODO - we should check if the directory is writeable before accepting it 512 532 } 513 533 break; 514 534 case kChooseExtraDirCmd: 515 if (_ browser->runModal() > 0) {535 if (_dirBrowser->runModal() > 0) { 516 536 // User made his choice... 517 FilesystemNode dir(_ browser->getResult());537 FilesystemNode dir(_dirBrowser->getResult()); 518 538 _extraPath->setLabel(dir.path()); 519 539 } 520 540 break; 541 case kChooseSoundFontCmd: 542 if (_fileBrowser->runModal() > 0) { 543 // User made his choice... 544 FilesystemNode file(_fileBrowser->getResult()); 545 _soundFont->setLabel(file.path()); 546 } 547 break; 521 548 #ifdef _WIN32_WCE 522 549 case kChooseKeyMappingCmd: 523 550 _keysDialog->runModal(); -
gui/options.h
diff -urN ScummVM-cvs20050409/gui/options.h ScummVM-cvs20050409+hack/gui/options.h
old new 32 32 33 33 namespace GUI { 34 34 35 class BrowserDialog; 35 class DirBrowserDialog; 36 class FileBrowserDialog; 36 37 class CheckboxWidget; 37 38 class PopUpWidget; 38 39 class SliderWidget; … … 55 56 /** Config domain this dialog is used to edit. */ 56 57 String _domain; 57 58 59 StaticTextWidget *_soundFont; 60 58 61 int addGraphicControls(GuiObject *boss, int yoffset); 59 62 int addMIDIControls(GuiObject *boss, int yoffset); 60 63 int addVolumeControls(GuiObject *boss, int yoffset); … … 109 112 void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); 110 113 111 114 protected: 112 BrowserDialog *_browser; 115 DirBrowserDialog *_dirBrowser; 116 FileBrowserDialog *_fileBrowser; 113 117 #ifdef _WIN32_WCE 114 118 CEKeysDialog *_keysDialog; 115 119 #endif -
sound/mididrv.cpp
diff -urN ScummVM-cvs20050409/sound/mididrv.cpp ScummVM-cvs20050409+hack/sound/mididrv.cpp
old new 58 58 {"towns", "FM Towns", MD_TOWNS}, 59 59 {"pcspk", "PC Speaker", MD_PCSPK}, 60 60 {"pcjr", "IBM PCjr", MD_PCJR}, 61 #ifdef USE_FLUIDSYNTH 62 {"fluidsynth", "FluidSynth", MD_FLUIDSYNTH}, 63 #endif 61 64 #ifdef USE_MT32EMU 62 65 {"mt32", "MT-32", MD_MT32}, 63 66 #endif … … 172 175 // driver. 173 176 case MD_ADLIB: return NULL; 174 177 178 #ifdef USE_FLUIDSYNTH 179 case MD_FLUIDSYNTH: return MidiDriver_FluidSynth_create(g_engine->_mixer); 180 #endif 175 181 #ifdef USE_MT32EMU 176 182 case MD_MT32: return MidiDriver_MT32_create(g_engine->_mixer); 177 183 #endif -
sound/mididrv.h
diff -urN ScummVM-cvs20050409/sound/mididrv.h ScummVM-cvs20050409+hack/sound/mididrv.h
old new 48 48 MD_TOWNS = 13, 49 49 MD_YPA1 = 14, // PalmOS 50 50 MD_ZODIAC = 15, // PalmOS 51 MD_MT32 = 16 51 MD_MT32 = 16, 52 MD_FLUIDSYNTH = 17 52 53 }; 53 54 54 55 enum MidiDriverType { … … 195 196 extern MidiDriver *MidiDriver_ETUDE_create(); 196 197 extern MidiDriver *MidiDriver_ALSA_create(); 197 198 extern MidiDriver *MidiDriver_YM2612_create(SoundMixer *mixer); 199 #ifdef USE_FLUIDSYNTH 200 extern MidiDriver *MidiDriver_FluidSynth_create(SoundMixer *mixer); 201 #endif 198 202 #ifdef USE_MT32EMU 199 203 extern MidiDriver *MidiDriver_MT32_create(SoundMixer *mixer); 200 204 #endif -
sound/module.mk
diff -urN ScummVM-cvs20050409/sound/module.mk ScummVM-cvs20050409+hack/sound/module.mk
old new 18 18 sound/wave.o \ 19 19 sound/softsynth/adlib.o \ 20 20 sound/softsynth/ym2612.o \ 21 sound/softsynth/fluidsynth.o \ 21 22 sound/softsynth/mt32.o \ 22 23 23 24 MODULE_DIRS += \ -
sound/softsynth/fluidsynth.cpp
diff -urN ScummVM-cvs20050409/sound/softsynth/fluidsynth.cpp ScummVM-cvs20050409+hack/sound/softsynth/fluidsynth.cpp
old new 1 /* ScummVM - Scumm Interpreter 2 * Copyright (C) 2001-2005 The ScummVM project 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * $Header$ 19 */ 20 21 #if defined(HAVE_CONFIG_H) 22 #include "config.h" 23 #endif 24 25 #ifdef USE_FLUIDSYNTH 26 27 #include "stdafx.h" 28 #include "common/config-manager.h" 29 #include "sound/mpu401.h" 30 #include "sound/softsynth/emumidi.h" 31 32 #include <fluidsynth.h> 33 34 class MidiDriver_FluidSynth : public MidiDriver_Emulated { 35 private: 36 MidiChannel_MPU401 _midiChannels[16]; 37 fluid_settings_t *_settings; 38 fluid_synth_t *_synth; 39 int _soundFont; 40 int _outputRate; 41 SoundHandle _handle; 42 43 protected: 44 // Because GCC complains about casting from const to non-const... 45 void setInt(const char *name, int val); 46 void setNum(const char *name, double num); 47 void setStr(const char *name, const char *str); 48 49 void generateSamples(int16 *buf, int len); 50 51 public: 52 MidiDriver_FluidSynth(SoundMixer *mixer); 53 54 int open(); 55 void close(); 56 void send(uint32 b); 57 58 MidiChannel *allocateChannel(); 59 MidiChannel *getPercussionChannel(); 60 61 // AudioStream API 62 bool isStereo() const { return true; } 63 int getRate() const { return _outputRate; } 64 }; 65 66 // MidiDriver method implementations 67 68 MidiDriver_FluidSynth::MidiDriver_FluidSynth(SoundMixer *mixer) 69 : MidiDriver_Emulated(mixer) { 70 71 for (int i = 0; i < ARRAYSIZE(_midiChannels); i++) { 72 _midiChannels[i].init(this, i); 73 } 74 75 // It ought to be possible to get FluidSynth to generate samples at 76 // lower 77 78 _outputRate = _mixer->getOutputRate(); 79 if (_outputRate < 22050) 80 _outputRate = 22050; 81 else if (_outputRate > 96000) 82 _outputRate = 96000; 83 } 84 85 void MidiDriver_FluidSynth::setInt(const char *name, int val) { 86 char *name2 = strdup(name); 87 88 fluid_settings_setint(_settings, name2, val); 89 free(name2); 90 } 91 92 void MidiDriver_FluidSynth::setNum(const char *name, double val) { 93 char *name2 = strdup(name); 94 95 fluid_settings_setnum(_settings, name2, val); 96 free(name2); 97 } 98 99 void MidiDriver_FluidSynth::setStr(const char *name, const char *val) { 100 char *name2 = strdup(name); 101 char *val2 = strdup(val); 102 103 fluid_settings_setstr(_settings, name2, val2); 104 free(name2); 105 free(val2); 106 } 107 108 int MidiDriver_FluidSynth::open() { 109 if (_isOpen) 110 return MERR_ALREADY_OPEN; 111 112 if (!ConfMan.hasKey("soundfont")) 113 error("FluidSynth recquires a 'soundfont' setting"); 114 115 _settings = new_fluid_settings(); 116 117 // The default gain setting is ridiculously low, but we can't set it 118 // too high either or sound will be clipped. This may need tuning... 119 120 setNum("synth.gain", 2.1); 121 setNum("synth.sample-rate", _outputRate); 122 123 _synth = new_fluid_synth(_settings); 124 125 // In theory, this ought to reduce CPU load... but it doesn't make any 126 // noticeable difference for me, so disable it for now. 127 128 // fluid_synth_set_interp_method(_synth, -1, FLUID_INTERP_LINEAR); 129 // fluid_synth_set_reverb_on(_synth, 0); 130 // fluid_synth_set_chorus_on(_synth, 0); 131 132 const char *soundfont = ConfMan.get("soundfont").c_str(); 133 134 _soundFont = fluid_synth_sfload(_synth, soundfont, 1); 135 if (_soundFont == -1) 136 error("Failed loading custom sound font '%s'", soundfont); 137 138 MidiDriver_Emulated::open(); 139 140 // The MT-32 emulator uses kSFXSoundType here. I don't know why. 141 _mixer->playInputStream(SoundMixer::kMusicSoundType, &_handle, this, -1, 255, 0, false, true); 142 return 0; 143 } 144 145 void MidiDriver_FluidSynth::close() { 146 if (!_isOpen) 147 return; 148 _isOpen = false; 149 150 _mixer->stopHandle(_handle); 151 152 if (_soundFont != -1) 153 fluid_synth_sfunload(_synth, _soundFont, 1); 154 155 delete_fluid_synth(_synth); 156 delete_fluid_settings(_settings); 157 } 158 159 void MidiDriver_FluidSynth::send(uint32 b) { 160 //byte param3 = (byte) ((b >> 24) & 0xFF); 161 uint param2 = (byte) ((b >> 16) & 0xFF); 162 uint param1 = (byte) ((b >> 8) & 0xFF); 163 byte cmd = (byte) (b & 0xF0); 164 byte chan = (byte) (b & 0x0F); 165 166 switch (cmd) { 167 case 0x80: // Note Off 168 fluid_synth_noteoff(_synth, chan, param1); 169 break; 170 case 0x90: // Note On 171 fluid_synth_noteon(_synth, chan, param1, param2); 172 break; 173 case 0xA0: // Aftertouch 174 break; 175 case 0xB0: // Control Change 176 fluid_synth_cc(_synth, chan, param1, param2); 177 break; 178 case 0xC0: // Program Change 179 fluid_synth_program_change(_synth, chan, param1); 180 break; 181 case 0xD0: // Channel Pressure 182 break; 183 case 0xE0: // Pitch Bend 184 fluid_synth_pitch_bend(_synth, chan, (param2 << 7) | param1); 185 break; 186 case 0xF0: // SysEx 187 // We should never get here! SysEx information has to be 188 // sent via high-level semantic methods. 189 warning("MidiDriver_FluidSynth: Receiving SysEx command on a send() call"); 190 break; 191 default: 192 warning("MidiDriver_FluidSynth: Unknown send() command 0x%02X", cmd); 193 break; 194 } 195 } 196 197 MidiChannel *MidiDriver_FluidSynth::allocateChannel() { 198 for (int i = 0; i < ARRAYSIZE(_midiChannels); i++) { 199 if (i != 9 && _midiChannels[i].allocate()) 200 return &_midiChannels[i]; 201 } 202 return NULL; 203 } 204 205 MidiChannel *MidiDriver_FluidSynth::getPercussionChannel() { 206 return &_midiChannels[9]; 207 } 208 209 MidiDriver *MidiDriver_FluidSynth_create(SoundMixer *mixer) { 210 return new MidiDriver_FluidSynth(mixer); 211 } 212 213 void MidiDriver_FluidSynth::generateSamples(int16 *data, int len) { 214 fluid_synth_write_s16(_synth, len, data, 0, 2, data, 1, 2); 215 } 216 217 #endif