Ticket #9056: scummvm_midi_device.patch
File scummvm_midi_device.patch, 2.8 KB (added by , 15 years ago) |
---|
-
backends/midi/windows.cpp
30 30 31 31 #include "sound/musicplugin.h" 32 32 #include "sound/mpu401.h" 33 #include "common/config-manager.h" 33 34 34 35 #include <mmsystem.h> 35 36 … … 46 47 HANDLE _streamEvent; 47 48 HMIDIOUT _mo; 48 49 bool _isOpen; 50 UINT _device; 49 51 50 52 void check_error(MMRESULT result); 51 53 52 54 public: 53 MidiDriver_WIN( ) :_isOpen(false) { }55 MidiDriver_WIN(UINT device = MIDI_MAPPER) : _device(device), _isOpen(false) { } 54 56 int open(); 55 57 void close(); 56 58 void send(uint32 b); … … 61 63 if (_isOpen) 62 64 return MERR_ALREADY_OPEN; 63 65 66 if(_device < 0 || _device >= midiOutGetNumDevs()) 67 _device = MIDI_MAPPER; 68 64 69 _streamEvent = CreateEvent(NULL, true, true, NULL); 65 MMRESULT res = midiOutOpen((HMIDIOUT *)&_mo, MIDI_MAPPER, (DWORD_PTR)_streamEvent, 0, CALLBACK_EVENT);70 MMRESULT res = midiOutOpen((HMIDIOUT *)&_mo, _device, (DWORD_PTR)_streamEvent, 0, CALLBACK_EVENT); 66 71 if (res != MMSYSERR_NOERROR) { 67 72 check_error(res); 68 73 CloseHandle(_streamEvent); … … 170 175 } 171 176 172 177 Common::Error WindowsMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { 173 *mididriver = new MidiDriver_WIN();174 178 179 *mididriver = new MidiDriver_WIN(ConfMan.getInt("midi_device")); 175 180 return Common::kNoError; 176 181 } 177 182 -
base/commandLine.cpp
100 100 " --extrapath=PATH Extra path to additional game data\n" 101 101 " --soundfont=FILE Select the SoundFont for MIDI playback (only\n" 102 102 " supported by some MIDI drivers)\n" 103 104 #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) 105 " --midi-device=DEVICE Select a specific midi device\n" 106 #endif 103 107 " --multi-midi Enable combination AdLib and native MIDI\n" 104 108 " --native-mt32 True Roland MT-32 (disable GM emulation)\n" 105 109 " --enable-gs Enable Roland GS mode for MIDI playback\n" … … 167 171 ConfMan.registerDefault("sfx_mute", false); 168 172 ConfMan.registerDefault("speech_mute", false); 169 173 174 #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) 175 ConfMan.registerDefault("midi_device", -1); 176 #endif 170 177 ConfMan.registerDefault("multi_midi", false); 171 178 ConfMan.registerDefault("native_mt32", false); 172 179 ConfMan.registerDefault("enable_gs", false); … … 445 452 DO_LONG_OPTION_BOOL("disable-sdl-parachute") 446 453 END_OPTION 447 454 455 #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) 456 DO_LONG_OPTION_INT("midi-device") 457 END_OPTION 458 #endif 459 448 460 DO_LONG_OPTION_BOOL("multi-midi") 449 461 END_OPTION 450 462