ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

mididrv.cpp

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "common/config-manager.h"
00024 #include "common/error.h"
00025 #include "common/gui_options.h"
00026 #include "common/str.h"
00027 #include "common/system.h"
00028 #include "common/textconsole.h"
00029 #include "common/translation.h"
00030 #include "common/util.h"
00031 #include "common/file.h"
00032 #include "gui/message.h"
00033 #include "audio/mididrv.h"
00034 #include "audio/musicplugin.h"
00035 
00036 const byte MidiDriver::_mt32ToGm[128] = {
00037 //    0    1    2    3    4    5    6    7    8    9    A    B    C    D    E    F
00038       0,   1,   0,   2,   4,   4,   5,   3,  16,  17,  18,  16,  16,  19,  20,  21, // 0x
00039       6,   6,   6,   7,   7,   7,   8, 112,  62,  62,  63,  63,  38,  38,  39,  39, // 1x
00040      88,  95,  52,  98,  97,  99,  14,  54, 102,  96,  53, 102,  81, 100,  14,  80, // 2x
00041      48,  48,  49,  45,  41,  40,  42,  42,  43,  46,  45,  24,  25,  28,  27, 104, // 3x
00042      32,  32,  34,  33,  36,  37,  35,  35,  79,  73,  72,  72,  74,  75,  64,  65, // 4x
00043      66,  67,  71,  71,  68,  69,  70,  22,  56,  59,  57,  57,  60,  60,  58,  61, // 5x
00044      61,  11,  11,  98,  14,   9,  14,  13,  12, 107, 107,  77,  78,  78,  76,  76, // 6x
00045      47, 117, 127, 118, 118, 116, 115, 119, 115, 112,  55, 124, 123,   0,  14, 117  // 7x
00046 };
00047 
00048 const byte MidiDriver::_gmToMt32[128] = {
00049 //    0    1    2    3    4    5    6    7    8    9    A    B    C    D    E    F
00050       5,   1,   2,   7,   3,   5,  16,  21,  22, 101, 101,  97, 104, 103, 102,  20, // 0x
00051       8,   9,  11,  12,  14,  15,  87,  15,  59,  60,  61,  62,  67,  44,  79,  23, // 1x
00052      64,  67,  66,  70,  68,  69,  28,  31,  52,  54,  55,  56,  49,  51,  57, 112, // 2x
00053      48,  50,  45,  26,  34,  35,  45, 122,  89,  90,  94,  81,  92,  95,  24,  25, // 3x
00054      80,  78,  79,  78,  84,  85,  86,  82,  74,  72,  76,  77, 110, 107, 108,  76, // 4x
00055      47,  44, 111,  45,  44,  34,  44,  30,  32,  33,  88,  34,  35,  35,  38,  33, // 5x
00056      41,  36, 100,  37,  40,  34,  43,  40,  63,  21,  99, 105, 103,  86,  55,  84, // 6x
00057     101, 103, 100, 120, 117, 113,  99, 128, 128, 128, 128, 124, 123, 128, 128, 128, // 7x
00058 };
00059 
00060 // These are the power-on default instruments of the Roland MT-32 family.
00061 const byte MidiDriver::_mt32DefaultInstruments[8] = {
00062     0x44, 0x30, 0x5F, 0x4E, 0x29, 0x03, 0x6E, 0x7A
00063 };
00064 
00065 // These are the power-on default panning settings for channels 2-9 of the Roland MT-32 family.
00066 // Internally, the MT-32 has 15 panning positions (0-E with 7 being center).
00067 // This has been translated to the equivalent MIDI panning values (0-127).
00068 // These are used for setting default panning on GM devices when using them with MT-32 data.
00069 // Note that MT-32 panning is reversed compared to the MIDI specification. This is not reflected
00070 // here; the driver is expected to flip these values based on the _reversePanning variable.
00071 const byte MidiDriver::_mt32DefaultPanning[8] = {
00072     // 7,    8,    7,    8,    4,    A,    0,    E 
00073     0x40, 0x49, 0x40, 0x49, 0x25, 0x5B, 0x00, 0x7F
00074 };
00075 
00076 // This is the drum map for the Roland Sound Canvas SC-55 v1.xx. It had a fallback mechanism 
00077 // to correct invalid drumkit selections. Some games rely on this mechanism to select the 
00078 // correct Roland GS drumkit. Use this map to emulate this mechanism.
00079 // E.g. correct invalid drumkit 50: _gsDrumkitFallbackMap[50] == 48
00080 const uint8 MidiDriver::_gsDrumkitFallbackMap[128] = {
00081      0,  0,  0,  0,  0,  0,  0,  0, // STANDARD
00082      8,  8,  8,  8,  8,  8,  8,  8, // ROOM
00083     16, 16, 16, 16, 16, 16, 16, 16, // POWER
00084     24, 25, 24, 24, 24, 24, 24, 24, // ELECTRONIC; TR-808 (25)
00085     32, 32, 32, 32, 32, 32, 32, 32, // JAZZ
00086     40, 40, 40, 40, 40, 40, 40, 40, // BRUSH
00087     48, 48, 48, 48, 48, 48, 48, 48, // ORCHESTRA
00088     56, 56, 56, 56, 56, 56, 56, 56, // SFX
00089      0,  0,  0,  0,  0,  0,  0,  0, // No drumkit defined (fall back to STANDARD)
00090      0,  0,  0,  0,  0,  0,  0,  0, // No drumkit defined
00091      0,  0,  0,  0,  0,  0,  0,  0, // No drumkit defined
00092      0,  0,  0,  0,  0,  0,  0,  0, // No drumkit defined
00093      0,  0,  0,  0,  0,  0,  0,  0, // No drumkit defined
00094      0,  0,  0,  0,  0,  0,  0,  0, // No drumkit defined
00095      0,  0,  0,  0,  0,  0,  0,  0, // No drumkit defined
00096      0,  0,  0,  0,  0,  0,  0, 127 // No drumkit defined; CM-64/32L (127)
00097 };
00098 
00099 static const struct {
00100     uint32      type;
00101     const char *guio;
00102 } GUIOMapping[] = {
00103     { MT_PCSPK,     GUIO_MIDIPCSPK },
00104     { MT_CMS,       GUIO_MIDICMS },
00105     { MT_PCJR,      GUIO_MIDIPCJR },
00106     { MT_ADLIB,     GUIO_MIDIADLIB },
00107     { MT_C64,       GUIO_MIDIC64 },
00108     { MT_AMIGA,     GUIO_MIDIAMIGA },
00109     { MT_APPLEIIGS, GUIO_MIDIAPPLEIIGS },
00110     { MT_TOWNS,     GUIO_MIDITOWNS },
00111     { MT_PC98,      GUIO_MIDIPC98 },
00112     { MT_GM,        GUIO_MIDIGM },
00113     { MT_MT32,      GUIO_MIDIMT32 },
00114     { 0,            0 },
00115 };
00116 
00117 Common::String MidiDriver::musicType2GUIO(uint32 musicType) {
00118     Common::String res;
00119 
00120     for (int i = 0; GUIOMapping[i].guio; i++) {
00121         if (musicType == GUIOMapping[i].type || musicType == (uint32)-1)
00122             res += GUIOMapping[i].guio;
00123     }
00124 
00125     return res;
00126 }
00127 
00128 bool MidiDriver::_forceTypeMT32 = false;
00129 
00130 MusicType MidiDriver::getMusicType(MidiDriver::DeviceHandle handle) {
00131     if (_forceTypeMT32)
00132         return MT_MT32;
00133 
00134     if (handle) {
00135         const PluginList p = MusicMan.getPlugins();
00136         for (PluginList::const_iterator m = p.begin(); m != p.end(); m++) {
00137             MusicDevices i = (*m)->get<MusicPluginObject>().getDevices();
00138             for (MusicDevices::iterator d = i.begin(); d != i.end(); d++) {
00139                 if (handle == d->getHandle())
00140                     return d->getMusicType();
00141             }
00142         }
00143     }
00144 
00145     return MT_INVALID;
00146 }
00147 
00148 Common::String MidiDriver::getDeviceString(DeviceHandle handle, DeviceStringType type) {
00149     if (handle) {
00150         const PluginList p = MusicMan.getPlugins();
00151         for (PluginList::const_iterator m = p.begin(); m != p.end(); m++) {
00152             MusicDevices i = (*m)->get<MusicPluginObject>().getDevices();
00153             for (MusicDevices::iterator d = i.begin(); d != i.end(); d++) {
00154                 if (handle == d->getHandle()) {
00155                     if (type == kDriverName)
00156                         return d->getMusicDriverName();
00157                     else if (type == kDriverId)
00158                         return d->getMusicDriverId();
00159                     else if (type == kDeviceName)
00160                         return d->getCompleteName();
00161                     else if (type == kDeviceId)
00162                         return d->getCompleteId();
00163                     else
00164                         return Common::String("auto");
00165                 }
00166             }
00167         }
00168     }
00169 
00170     return Common::String("auto");
00171 }
00172 
00173 MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) {
00174     // Query the selected music device (defaults to MT_AUTO device).
00175     Common::String selDevStr = ConfMan.hasKey("music_driver") ? ConfMan.get("music_driver") : Common::String("auto");
00176     if ((flags & MDT_PREFER_FLUID) && selDevStr == "auto") {
00177         selDevStr = "fluidsynth";
00178     }
00179     DeviceHandle hdl = getDeviceHandle(selDevStr.empty() ? Common::String("auto") : selDevStr);
00180     DeviceHandle reslt = 0;
00181 
00182     _forceTypeMT32 = false;
00183 
00184     // Check whether the selected music driver is compatible with the
00185     // given flags.
00186     switch (getMusicType(hdl)) {
00187     case MT_PCSPK:
00188         if (flags & MDT_PCSPK)
00189             reslt = hdl;
00190         break;
00191 
00192     case MT_PCJR:
00193         if (flags & MDT_PCJR)
00194             reslt = hdl;
00195         break;
00196 
00197     case MT_CMS:
00198         if (flags & MDT_CMS)
00199             reslt = hdl;
00200         break;
00201 
00202     case MT_ADLIB:
00203         if (flags & MDT_ADLIB)
00204             reslt = hdl;
00205         break;
00206 
00207     case MT_C64:
00208         if (flags & MDT_C64)
00209             reslt = hdl;
00210         break;
00211 
00212     case MT_AMIGA:
00213         if (flags & MDT_AMIGA)
00214             reslt = hdl;
00215         break;
00216 
00217     case MT_APPLEIIGS:
00218         if (flags & MDT_APPLEIIGS)
00219             reslt = hdl;
00220         break;
00221 
00222     case MT_TOWNS:
00223         if (flags & MDT_TOWNS)
00224             reslt = hdl;
00225         break;
00226 
00227     case MT_PC98:
00228         if (flags & MDT_PC98)
00229             reslt = hdl;
00230         break;
00231 
00232     case MT_GM:
00233     case MT_GS:
00234     case MT_MT32:
00235         if (flags & MDT_MIDI)
00236             reslt = hdl;
00237         break;
00238 
00239     case MT_NULL:
00240         reslt = hdl;
00241         break;
00242 
00243     default:
00244         break;
00245     }
00246 
00247     Common::String failedDevStr;
00248     if (getMusicType(hdl) == MT_INVALID) {
00249         // If the expressly selected driver or device cannot be found (no longer compiled in, turned off, etc.)
00250         // we display a warning and continue.
00251         failedDevStr = selDevStr;
00252         Common::String warningMsg = Common::String::format(_("The selected audio device '%s' was not found (e.g. might be turned off or disconnected)."), failedDevStr.c_str()) + " " + _("Attempting to fall back to the next available device...");
00253         GUI::MessageDialog dialog(warningMsg);
00254         dialog.runModal();
00255     }
00256 
00257     MusicType tp = getMusicType(reslt);
00258     if (tp != MT_INVALID && tp != MT_AUTO) {
00259         if (checkDevice(reslt)) {
00260             return reslt;
00261         } else {
00262             // If the expressly selected device cannot be used we display a warning and continue.
00263             failedDevStr = getDeviceString(hdl, MidiDriver::kDeviceName);
00264             Common::String warningMsg = Common::String::format(_("The selected audio device '%s' cannot be used. See log file for more information."), failedDevStr.c_str()) + " " + _("Attempting to fall back to the next available device...");
00265             GUI::MessageDialog dialog(warningMsg);
00266             dialog.runModal();
00267         }
00268     }
00269 
00270     // If the selected driver did not match the flags setting,
00271     // we try to determine a suitable and "optimal" music driver.
00272     const PluginList p = MusicMan.getPlugins();
00273     // If only MDT_MIDI but not MDT_PREFER_MT32 or MDT_PREFER_GM is set we prefer the other devices (which will always be
00274     // detected since they are hard coded and cannot be disabled).
00275     bool skipMidi = !(flags & (MDT_PREFER_GM | MDT_PREFER_MT32));
00276     while (flags != MDT_NONE) {
00277         if ((flags & MDT_MIDI) && !skipMidi) {
00278             // If a preferred MT32 or GM device has been selected that device gets returned if available.
00279             Common::String devStr;
00280             if (flags & MDT_PREFER_MT32)
00281                 devStr = ConfMan.hasKey("mt32_device") ? ConfMan.get("mt32_device") : Common::String("null");
00282             else if (flags & MDT_PREFER_GM)
00283                 devStr = ConfMan.hasKey("gm_device") ? ConfMan.get("gm_device") : Common::String("null");
00284             else
00285                 devStr = "auto";
00286 
00287             // Default to Null device here, since we also register a default null setting for
00288             // the MT32 or GM device in the config manager.
00289             hdl = getDeviceHandle(devStr.empty() ? Common::String("null") : devStr);
00290             const MusicType type = getMusicType(hdl);
00291 
00292             // If we have a "Don't use GM/MT-32" setting we skip this part and jump
00293             // to AdLib, PC Speaker etc. detection right away.
00294             if (type != MT_NULL) {
00295                 if (type == MT_INVALID) {
00296                     // If the preferred (expressly requested) selected driver or device cannot be found (no longer compiled in, turned off, etc.)
00297                     // we display a warning and continue. Don't warn about the missing device if we did already (this becomes relevant if the
00298                     // missing device is selected as preferred device and also as GM or MT-32 device).
00299                     if (failedDevStr != devStr) {
00300                         Common::String warningMsg = Common::String::format(_("The preferred audio device '%s' was not found (e.g. might be turned off or disconnected)."), devStr.c_str()) + " " + _("Attempting to fall back to the next available device...");
00301                         GUI::MessageDialog dialog(warningMsg);
00302                         dialog.runModal();
00303                     }
00304                 } else if (type != MT_AUTO) {
00305                     if (checkDevice(hdl)) {
00306                         if (flags & MDT_PREFER_MT32)
00307                             // If we have a preferred MT32 device we disable the gm/mt32 mapping (more about this in mididrv.h).
00308                             _forceTypeMT32 = true;
00309                         return hdl;
00310                     } else {
00311                         // If the preferred (expressly requested) device cannot be used we display a warning and continue.
00312                         // Don't warn about the failing device if we did already (this becomes relevant if the failing
00313                         // device is selected as preferred device and also as GM or MT-32 device).
00314                         if (failedDevStr != getDeviceString(hdl, MidiDriver::kDeviceName)) {
00315                             Common::String warningMsg = Common::String::format(_("The preferred audio device '%s' cannot be used. See log file for more information."), getDeviceString(hdl, MidiDriver::kDeviceName).c_str()) + " " + _("Attempting to fall back to the next available device...");
00316                             GUI::MessageDialog dialog(warningMsg);
00317                             dialog.runModal();
00318                         }
00319                     }
00320                 }
00321 
00322                 // If no specific device is selected (neither in the scummvm nor in the game domain)
00323                 // and there is no preferred MT32 or GM device selected either or if the detected device is unavailable we arrive here.
00324                 // If MT32 is preferred we try for the first available device with music type 'MT_MT32' (usually the mt32 emulator).
00325                 if (flags & MDT_PREFER_MT32) {
00326                     for (PluginList::const_iterator m = p.begin(); m != p.end(); ++m) {
00327                         MusicDevices i = (*m)->get<MusicPluginObject>().getDevices();
00328                         for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
00329                             if (d->getMusicType() == MT_MT32) {
00330                                 hdl = d->getHandle();
00331                                 if (checkDevice(hdl))
00332                                     return hdl;
00333                             }
00334                         }
00335                     }
00336                 }
00337 
00338                 // Now we default to the first available device with music type 'MT_GM' if not
00339                 // MT-32 is preferred or if MT-32 is preferred but all other devices have failed.
00340                 if (!(flags & MDT_PREFER_MT32) || flags == (MDT_PREFER_MT32 | MDT_MIDI)) {
00341                     for (PluginList::const_iterator m = p.begin(); m != p.end(); ++m) {
00342                         MusicDevices i = (*m)->get<MusicPluginObject>().getDevices();
00343                         for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
00344                             if (d->getMusicType() == MT_GM || d->getMusicType() == MT_GS) {
00345                                 hdl = d->getHandle();
00346                                 if (checkDevice(hdl))
00347                                     return hdl;
00348                             }
00349                         }
00350                     }
00351                     // Detection flags get removed after final detection attempt to avoid further attempts.
00352                     flags &= ~(MDT_MIDI | MDT_PREFER_GM | MDT_PREFER_MT32);
00353                 }
00354             }
00355         }
00356 
00357         // The order in this list is important, since this is the order of preference
00358         // (e.g. MT_ADLIB is checked before MT_PCJR and MT_PCSPK for a good reason).
00359         // Detection flags get removed after detection attempt to avoid further attempts.
00360         if (flags & MDT_TOWNS) {
00361             tp = MT_TOWNS;
00362             flags &= ~MDT_TOWNS;
00363         } else if (flags & MDT_PC98) {
00364             tp = MT_PC98;
00365             flags &= ~MDT_PC98;
00366         } else if (flags & MDT_ADLIB) {
00367             tp = MT_ADLIB;
00368             flags &= ~MDT_ADLIB;
00369         } else if (flags & MDT_PCJR) {
00370             tp = MT_PCJR;
00371             flags &= ~MDT_PCJR;
00372         } else if (flags & MDT_PCSPK) {
00373             tp = MT_PCSPK;
00374             flags &= ~MDT_PCSPK;
00375         } else if (flags & MDT_C64) {
00376             tp = MT_C64;
00377             flags &= ~MDT_C64;
00378         } else if (flags & MDT_AMIGA) {
00379             tp = MT_AMIGA;
00380             flags &= ~MDT_AMIGA;
00381         } else if (flags & MDT_APPLEIIGS) {
00382             tp = MT_APPLEIIGS;
00383             flags &= ~MDT_APPLEIIGS;
00384         } else if (flags & MDT_MIDI) {
00385             // If we haven't tried to find a MIDI device yet we do this now.
00386             skipMidi = false;
00387             continue;
00388         } else if (flags) {
00389             // Invalid flags. Set them to MDT_NONE to leave detection loop.
00390             flags = MDT_NONE;
00391             tp = MT_AUTO;
00392         }
00393 
00394         for (PluginList::const_iterator m = p.begin(); m != p.end(); ++m) {
00395             MusicDevices i = (*m)->get<MusicPluginObject>().getDevices();
00396             for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
00397                 if (d->getMusicType() == tp) {
00398                     hdl = d->getHandle();
00399                     if (checkDevice(hdl))
00400                         return hdl;
00401                 }
00402             }
00403         }
00404     }
00405 
00406     return 0;
00407 }
00408 
00409 MidiDriver *MidiDriver::createMidi(MidiDriver::DeviceHandle handle) {
00410     MidiDriver *driver = 0;
00411     const PluginList p = MusicMan.getPlugins();
00412     for (PluginList::const_iterator m = p.begin(); m != p.end(); m++) {
00413         const MusicPluginObject &musicPlugin = (*m)->get<MusicPluginObject>();
00414         if (getDeviceString(handle, MidiDriver::kDriverId).equals(musicPlugin.getId()))
00415             musicPlugin.createInstance(&driver, handle);
00416     }
00417 
00418     return driver;
00419 }
00420 
00421 bool MidiDriver::checkDevice(MidiDriver::DeviceHandle handle) {
00422     const PluginList p = MusicMan.getPlugins();
00423     for (PluginList::const_iterator m = p.begin(); m != p.end(); m++) {
00424         const MusicPluginObject &musicPlugin = (*m)->get<MusicPluginObject>();
00425         if (getDeviceString(handle, MidiDriver::kDriverId).equals(musicPlugin.getId()))
00426             return musicPlugin.checkDevice(handle);
00427     }
00428 
00429     return false;
00430 }
00431 
00432 MidiDriver::DeviceHandle MidiDriver::getDeviceHandle(const Common::String &identifier) {
00433     const PluginList p = MusicMan.getPlugins();
00434 
00435     if (p.begin() == p.end())
00436         error("MidiDriver::getDeviceHandle: Music plugins must be loaded prior to calling this method");
00437 
00438     for (PluginList::const_iterator m = p.begin(); m != p.end(); m++) {
00439         MusicDevices i = (*m)->get<MusicPluginObject>().getDevices();
00440         for (MusicDevices::iterator d = i.begin(); d != i.end(); d++) {
00441             // The music driver id isn't unique, but it will match
00442             // driver's first device. This is useful when selecting
00443             // the driver from the command line.
00444             if (identifier.equals(d->getMusicDriverId()) || identifier.equals(d->getCompleteId()) || identifier.equals(d->getCompleteName())) {
00445                 return d->getHandle();
00446             }
00447         }
00448     }
00449 
00450     return 0;
00451 }
00452 
00453 void MidiDriver::initMT32(bool initForGM) {
00454     sendMT32Reset();
00455 
00456     if (initForGM) {
00457         // Set up MT-32 for GM data.
00458         // This is based on Roland's GM settings for MT-32.
00459         debug("Initializing MT-32 for General MIDI data");
00460 
00461         byte buffer[17];
00462 
00463         // Roland MT-32 SysEx for system area
00464         memcpy(&buffer[0], "\x41\x10\x16\x12\x10\x00", 6);
00465 
00466         // Set reverb parameters:
00467         // - Mode 2 (Plate)
00468         // - Time 3
00469         // - Level 4
00470         memcpy(&buffer[6], "\x01\x02\x03\x04\x66", 5);
00471         sysEx(buffer, 11);
00472 
00473         // Set partial reserve to match SC-55
00474         memcpy(&buffer[6], "\x04\x08\x04\x04\x03\x03\x03\x03\x02\x02\x4C", 11);
00475         sysEx(buffer, 17);
00476 
00477         // Use MIDI instrument channels 1-8 instead of 2-9
00478         memcpy(&buffer[6], "\x0D\x00\x01\x02\x03\x04\x05\x06\x07\x09\x3E", 11);
00479         sysEx(buffer, 17);
00480 
00481         // The MT-32 has reversed stereo panning compared to the MIDI spec.
00482         // GM does use panning as specified by the MIDI spec.
00483         _reversePanning = true;
00484 
00485         int i;
00486 
00487         // Set default GM panning (center on all channels)
00488         for (i = 0; i < 8; ++i) {
00489             send((0x40 << 16) | (10 << 8) | (0xB0 | i));
00490         }
00491 
00492         // Set default GM instruments (0 on all channels).
00493         // This is expected to be mapped to the MT-32 equivalent by the driver.
00494         for (i = 0; i < 8; ++i) {
00495             send((0 << 8) | (0xC0 | i));
00496         }
00497 
00498         // Set Pitch Bend Sensitivity to 2 semitones.
00499         for (i = 0; i < 8; ++i) {
00500             setPitchBendRange(i, 2);
00501         }
00502         setPitchBendRange(9, 2);
00503     }
00504 }
00505 
00506 void MidiDriver::sendMT32Reset() {
00507     static const byte resetSysEx[] = { 0x41, 0x10, 0x16, 0x12, 0x7F, 0x00, 0x00, 0x01, 0x00 };
00508     sysEx(resetSysEx, sizeof(resetSysEx));
00509     g_system->delayMillis(100);
00510 }
00511 
00512 void MidiDriver::initGM(bool initForMT32, bool enableGS) {
00513 // ResidualVM - not used
00514 }
00515 
00516 void MidiDriver::sendGMReset() {
00517 // ResidualVM - not used
00518 }
00519 
00520 byte MidiDriver::correctInstrumentBank(byte outputChannel, byte patchId) {
00521 // ResidualVM - not used
00522         return 0xFF;
00523 
00524 }
00525 void MidiDriver_BASE::midiDumpInit() {
00526 // ResidualVM - not used
00527 }
00528 
00529 int MidiDriver_BASE::midiDumpVarLength(const uint32 &delta) {
00530 // ResidualVM - not used
00531     return 0;
00532 }
00533 
00534 void MidiDriver_BASE::midiDumpDelta() {
00535 // ResidualVM - not used
00536 }
00537 
00538 void MidiDriver_BASE::midiDumpDo(uint32 b) {
00539 // ResidualVM - not used
00540 }
00541 
00542 void MidiDriver_BASE::midiDumpSysEx(const byte *msg, uint16 length) {
00543 // ResidualVM - not used
00544 }
00545 
00546 
00547 void MidiDriver_BASE::midiDumpFinish() {
00548 // ResidualVM - not used
00549 }
00550 
00551 MidiDriver_BASE::MidiDriver_BASE() {
00552 // ResidualVM - not used
00553 }
00554 
00555 MidiDriver_BASE::~MidiDriver_BASE() {
00556 // ResidualVM - not used
00557 }
00558 
00559 void MidiDriver_BASE::send(byte status, byte firstOp, byte secondOp) {
00560     send(status | ((uint32)firstOp << 8) | ((uint32)secondOp << 16));
00561 }
00562 
00563 void MidiDriver_BASE::send(int8 source, byte status, byte firstOp, byte secondOp) {
00564     send(source, status | ((uint32)firstOp << 8) | ((uint32)secondOp << 16));
00565 }
00566 
00567 void MidiDriver::midiDriverCommonSend(uint32 b) {
00568 // ResidualVM - not used
00569 }
00570 
00571 void MidiDriver::midiDriverCommonSysEx(const byte *msg, uint16 length) {
00572 // ResidualVM - not used
00573 }
00574 
00575 


Generated on Sat Jul 4 2020 05:01:03 for ResidualVM by doxygen 1.7.1
curved edge   curved edge