Ticket #8967: backends_midi_dmedia.patch
File backends_midi_dmedia.patch, 4.2 KB (added by , 15 years ago) |
---|
-
README
51 51 * 7.3 MT-32 emulation 52 52 * 7.4 MIDI emulation 53 53 * 7.5 Native MIDI support 54 * 7.6 UNIX native and ALSAsequencer support54 * 7.6 UNIX native, ALSA and dmedia sequencer support 55 55 * 7.7 TiMidity++ MIDI server support 56 56 * 7.8 Using compressed audio files (MP3, Ogg Vorbis, Flac) 57 57 * 7.9 Output sample rate … … 1523 1523 command as described earlier in this section. 1524 1524 1525 1525 1526 7.6.2) Playing sound with IRIX dmedia sequencer: [UNIX ONLY] 1527 ---- ------------------------------------------ 1528 If you are using IRIX, driver with the sequencer support, you can 1529 set the environment variable SCUMMVM_PORT or the config file parameter 1530 dmedia_port to your sequencer port. The default is to use the first port. 1531 1532 To get a list of configured midi interfaces on your system, run startmidi 1533 without parameters. Exaple output: 1534 1535 2 MIDI interfaces configured: 1536 Serial Port 2 1537 Software Synth 1538 1539 In this example, you can configure ScummVM to use the "Software Synth" 1540 instead of the default "Serial Port 2" by adding a line 1541 1542 dmedia_port=Software Synth 1543 1544 to your configuration file in the section [scummvm], or setting 1545 SCUMMVM_PORT=Software Synth in your environment. 1546 1547 1526 1548 7.7) Using TiMidity++ MIDI server: 1527 1549 ---- ----------------------------- 1528 1550 If you system lacks any MIDI sequencer, but you still want better MIDI -
backends/midi/dmedia.cpp
31 31 32 32 #include "common/scummsys.h" 33 33 #include "common/util.h" 34 #include "common/config-manager.h" 34 35 #include "sound/musicplugin.h" 35 36 #include "sound/mpu401.h" 36 37 … … 71 72 72 73 int MidiDriver_DMEDIA::open() { 73 74 int numinterfaces; 75 int i; 76 const char *var; 77 char *portName; 74 78 75 79 if (_isOpen) 76 80 return MERR_ALREADY_OPEN; 77 81 _isOpen = true; 78 82 79 warning("dmedia init");80 83 numinterfaces = mdInit(); 81 84 if (numinterfaces <= 0) { 82 fprintf(stderr, "No MIDI interfaces configured.\n");85 fprintf(stderr, "No MIDI interfaces configured.\n"); 83 86 perror("Cannot initialize libmd for sound output"); 84 87 return -1; 85 88 } … … 87 90 if (getenv("SCUMMVM_MIDIPORT")) { 88 91 _deviceNum = atoi(getenv("SCUMMVM_MIDIPORT")); 89 92 _midiportName = mdGetName(_deviceNum); 93 } else { 94 var = ConfMan.get("dmedia_port").c_str(); 95 if (strlen(var) > 0) { 96 for (i = 0; i < numinterfaces; i++) { 97 portName = mdGetName(i); 98 if (strcmp(var, portName) == 0) { 99 _deviceNum = i; 100 _midiportName = portName; 101 } 102 } 103 104 } 90 105 } 91 else92 {93 _midiportName = mdGetName(0);94 warning("SCUMMVM_MIDIPORT environment variable not set, using Port %s", _midiportName);95 _deviceNum = 0;96 }97 106 98 107 _midiPort = mdOpenOutPort(_midiportName); 99 108 if (!_midiPort) { … … 152 161 if (mdSend(_midiPort, &event, 1) != 1) { 153 162 warning("failed sending MIDI event (dump follows...)"); 154 163 warning("MIDI Event (len=%u):", event.msglen); 155 for (int i =0; i<event.msglen; i++) warning("%02x ",(int)event.msg[i]);164 for (int i = 0; i < event.msglen; i++) warning("%02x ", (int)event.msg[i]); 156 165 } 157 166 } 158 167 … … 171 180 event.msg[2] = 0; 172 181 173 182 if (mdSend(_midiPort, &event, 1) != 1) { 174 fprintf(stderr,"failed sending MIDI SYSEX event (dump follows...)\n"); 183 fprintf(stderr, "failed sending MIDI SYSEX event (dump follows...)\n"); 184 for (int i = 0; i < event.msglen; i++) warning("%02x ", (int)event.msg[i]); 175 185 } 176 186 } 177 187 … … 193 203 }; 194 204 195 205 MusicDevices DMediaMusicPlugin::getDevices() const { 206 int numinterfaces; 207 int i; 208 char *portName; 196 209 MusicDevices devices; 210 197 211 // TODO: Return a different music type depending on the configuration 198 // TODO: List the available devices 199 devices.push_back(MusicDevice(this, "", MT_GM)); 212 213 numinterfaces = mdInit(); 214 if (numinterfaces <= 0) { 215 fprintf(stderr, "No MIDI interfaces configured.\n"); 216 } 217 218 for (i=0; i<numinterfaces; i++) { 219 portName = mdGetName(0); 220 fprintf(stderr, "device %i %s\n", i, portName); 221 devices.push_back(MusicDevice(this, portName, MT_GM)); 222 } 223 200 224 return devices; 201 225 } 202 226