aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordi Vilalta Prat2008-05-11 02:10:05 +0000
committerJordi Vilalta Prat2008-05-11 02:10:05 +0000
commitd696ed6ea26172396badc9d8a10b2d4d05d5d8e4 (patch)
treeae2ec4b4f5f39f6f3b959482d870e7edf741843c
parent257aaa3ced14645d4410a272e89cafb7282836ac (diff)
downloadscummvm-rg350-d696ed6ea26172396badc9d8a10b2d4d05d5d8e4.tar.gz
scummvm-rg350-d696ed6ea26172396badc9d8a10b2d4d05d5d8e4.tar.bz2
scummvm-rg350-d696ed6ea26172396badc9d8a10b2d4d05d5d8e4.zip
Added the MidiPlugin interface (first step towards the MIDI plugins)
svn-id: r31993
-rw-r--r--backends/midi/alsa.cpp77
-rw-r--r--backends/midi/camd.cpp34
-rw-r--r--backends/midi/coreaudio.cpp28
-rw-r--r--backends/midi/coremidi.cpp28
-rw-r--r--backends/midi/dmedia.cpp30
-rw-r--r--backends/midi/midiplugin.h62
-rw-r--r--backends/midi/quicktime.cpp31
-rw-r--r--backends/midi/seq.cpp30
-rw-r--r--backends/midi/timidity.cpp30
-rw-r--r--backends/midi/windows.cpp31
-rw-r--r--backends/midi/ypa1.cpp30
-rw-r--r--backends/midi/zodiac.cpp30
-rw-r--r--sound/mididrv.cpp22
-rw-r--r--sound/mididrv.h22
14 files changed, 427 insertions, 58 deletions
diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp
index 174bb73f65..3139fadf24 100644
--- a/backends/midi/alsa.cpp
+++ b/backends/midi/alsa.cpp
@@ -26,10 +26,10 @@
#if defined(UNIX) && defined(USE_ALSA)
-#include "sound/mpu401.h"
-
-#include "common/util.h"
+#include "backends/midi/midiplugin.h"
#include "common/config-manager.h"
+#include "common/util.h"
+#include "sound/mpu401.h"
#include <alsa/asoundlib.h>
@@ -238,8 +238,75 @@ void MidiDriver_ALSA::send_event(int do_flush) {
snd_seq_flush_output(seq_handle);
}
-MidiDriver *MidiDriver_ALSA_create() {
- return new MidiDriver_ALSA();
+
+// Plugin interface
+
+class AlsaMidiPlugin : public MidiPlugin {
+public:
+ virtual const char *getName() const {
+ return "ALSA";
+ }
+
+ virtual Common::StringList getDevices() const;
+
+ virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+};
+
+#define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits))
+
+static int check_permission(snd_seq_port_info_t *pinfo)
+{
+ if (perm_ok(pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE)) {
+ if (!(snd_seq_port_info_get_capability(pinfo) & SND_SEQ_PORT_CAP_NO_EXPORT))
+ return 1;
+ }
+ return 0;
+}
+
+Common::StringList AlsaMidiPlugin::getDevices() const {
+ Common::StringList devices;
+
+ snd_seq_t *seq;
+ if (snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0) < 0)
+ return devices; // can't open sequencer
+
+ snd_seq_client_info_t *cinfo;
+ snd_seq_client_info_alloca(&cinfo);
+ snd_seq_port_info_t *pinfo;
+ snd_seq_port_info_alloca(&pinfo);
+ snd_seq_client_info_set_client(cinfo, -1);
+ while (snd_seq_query_next_client(seq, cinfo) >= 0) {
+ bool found_valid_port = false;
+
+ /* reset query info */
+ snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo));
+ snd_seq_port_info_set_port(pinfo, -1);
+ while (!found_valid_port && snd_seq_query_next_port(seq, pinfo) >= 0) {
+ if (check_permission(pinfo)) {
+ found_valid_port = true;
+ devices.push_back(snd_seq_client_info_get_name(cinfo));
+ //snd_seq_client_info_get_client(cinfo) : snd_seq_port_info_get_port(pinfo)
+ }
+ }
+ }
+ snd_seq_close(seq);
+
+ return devices;
+}
+
+PluginError AlsaMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+ *mididriver = new MidiDriver_ALSA();
+
+ return kNoError;
+}
+
+MidiDriver *MidiDriver_ALSA_create(Audio::Mixer *mixer) {
+ MidiDriver *mididriver;
+
+ AlsaMidiPlugin p;
+ p.createInstance(mixer, &mididriver);
+
+ return mididriver;
}
#endif
diff --git a/backends/midi/camd.cpp b/backends/midi/camd.cpp
index 25dc00bf63..11459af4f3 100644
--- a/backends/midi/camd.cpp
+++ b/backends/midi/camd.cpp
@@ -26,9 +26,10 @@
#if defined(__amigaos4__)
-#include "sound/mpu401.h"
-#include "common/util.h"
+#include "backends/midi/midiplugin.h"
#include "common/endian.h"
+#include "common/util.h"
+#include "sound/mpu401.h"
#include <proto/camd.h>
#include <proto/exec.h>
@@ -162,8 +163,33 @@ void MidiDriver_CAMD::closeAll() {
_isOpen = false;
}
-MidiDriver *MidiDriver_CAMD_create() {
- return new MidiDriver_CAMD();
+
+// Plugin interface
+
+class CamdMidiPlugin : public MidiPlugin {
+public:
+ virtual const char *getName() const {
+ return "CAMD";
+ }
+
+ //virtual Common::StringList getDevices() const;
+
+ virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+};
+
+PluginError CamdMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+ *mididriver = new MidiDriver_CAMD();
+
+ return kNoError;
+}
+
+MidiDriver *MidiDriver_CAMD_create(Audio::Mixer *mixer) {
+ MidiDriver *mididriver;
+
+ CamdMidiPlugin p;
+ p.createInstance(mixer, &mididriver);
+
+ return mididriver;
}
#endif
diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp
index c338678036..1ff4a56a6b 100644
--- a/backends/midi/coreaudio.cpp
+++ b/backends/midi/coreaudio.cpp
@@ -24,6 +24,7 @@
#ifdef MACOSX
+#include "backends/midi/midiplugin.h"
#include "common/config-manager.h"
#include "common/util.h"
#include "sound/mpu401.h"
@@ -192,8 +193,31 @@ void MidiDriver_CORE::sysEx(const byte *msg, uint16 length) {
MusicDeviceSysEx(_synth, buf, length+2);
}
-MidiDriver *MidiDriver_CORE_create() {
- return new MidiDriver_CORE();
+
+// Plugin interface
+
+class CoreAudioMidiPlugin : public MidiPlugin {
+public:
+ virtual const char *getName() const {
+ return "CoreAudio";
+ }
+
+ virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+};
+
+PluginError CoreAudioMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+ *mididriver = new MidiDriver_CORE();
+
+ return kNoError;
+}
+
+MidiDriver *MidiDriver_CORE_create(Audio::Mixer *mixer) {
+ MidiDriver *mididriver;
+
+ CoreAudioMidiPlugin p;
+ p.createInstance(mixer, &mididriver);
+
+ return mididriver;
}
#endif // MACOSX
diff --git a/backends/midi/coremidi.cpp b/backends/midi/coremidi.cpp
index 251b41a986..8df9ef79f4 100644
--- a/backends/midi/coremidi.cpp
+++ b/backends/midi/coremidi.cpp
@@ -24,6 +24,7 @@
#ifdef MACOSX
+#include "backends/midi/midiplugin.h"
#include "common/config-manager.h"
#include "common/util.h"
#include "sound/mpu401.h"
@@ -175,8 +176,31 @@ void MidiDriver_CoreMIDI::sysEx(const byte *msg, uint16 length) {
MIDISend(mOutPort, mDest, packetList);
}
-MidiDriver *MidiDriver_CoreMIDI_create() {
- return new MidiDriver_CoreMIDI();
+
+// Plugin interface
+
+class CoreMIDIMidiPlugin : public MidiPlugin {
+public:
+ virtual const char *getName() const {
+ return "CoreMIDI";
+ }
+
+ virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+};
+
+PluginError CoreMIDIMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+ *mididriver = new MidiDriver_CoreMIDI();
+
+ return kNoError;
+}
+
+MidiDriver *MidiDriver_CoreMIDI_create(Audio::Mixer *mixer) {
+ MidiDriver *mididriver;
+
+ CoreMIDIMidiPlugin p;
+ p.createInstance(mixer, &mididriver);
+
+ return mididriver;
}
#endif // MACOSX
diff --git a/backends/midi/dmedia.cpp b/backends/midi/dmedia.cpp
index 1904eaf647..f67784be7e 100644
--- a/backends/midi/dmedia.cpp
+++ b/backends/midi/dmedia.cpp
@@ -29,9 +29,10 @@
#if defined(IRIX)
+#include "backends/midi/midiplugin.h"
#include "common/scummsys.h"
-#include "sound/mpu401.h"
#include "common/util.h"
+#include "sound/mpu401.h"
#include <dmedia/midi.h>
#include <sys/types.h>
@@ -174,8 +175,31 @@ void MidiDriver_DMEDIA::sysEx (const byte *msg, uint16 length) {
}
}
-MidiDriver *MidiDriver_DMEDIA_create() {
- return new MidiDriver_DMEDIA();
+
+// Plugin interface
+
+class DMediaMidiPlugin : public MidiPlugin {
+public:
+ virtual const char *getName() const {
+ return "DMedia";
+ }
+
+ virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+};
+
+PluginError DMediaMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+ *mididriver = new MidiDriver_DMEDIA();
+
+ return kNoError;
+}
+
+MidiDriver *MidiDriver_DMEDIA_create(Audio::Mixer *mixer) {
+ MidiDriver *mididriver;
+
+ DMediaMidiPlugin p;
+ p.createInstance(mixer, &mididriver);
+
+ return mididriver;
}
#endif
diff --git a/backends/midi/midiplugin.h b/backends/midi/midiplugin.h
new file mode 100644
index 0000000000..0de14e8d55
--- /dev/null
+++ b/backends/midi/midiplugin.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#ifndef BACKENDS_MIDI_MIDIPLUGIN_H
+#define BACKENDS_MIDI_MIDIPLUGIN_H
+
+#include "base/plugins.h"
+#include "sound/mididrv.h"
+
+/**
+ * A MidiPlugin is essentially a factory for MidiDriver instances with the
+ * added ability of listing the available devices and their capabilities.
+ */
+class MidiPlugin : public PluginObject {
+public:
+ virtual ~MidiPlugin() {}
+
+ /**
+ * Returns a list of the available devices. The empty string means the
+ * default device.
+ */
+ virtual Common::StringList getDevices() const {
+ Common::StringList dev;
+ dev.push_back("");
+ return dev;
+ }
+
+ /**
+ * Tries to instantiate an engine instance based on the settings of
+ * the currently active ConfMan target. That is, the MidiPlugin should
+ * query the ConfMan singleton for the device name, port, etc.
+ *
+ * @param mixer Pointer to the global Mixer object
+ * @param mididriver Pointer to a pointer which the MidiPlugin sets to
+ * the newly create MidiDriver, or 0 in case of an error
+ * @return a PluginError describing the error which occurred, or kNoError
+ */
+ virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const = 0;
+};
+
+#endif
diff --git a/backends/midi/quicktime.cpp b/backends/midi/quicktime.cpp
index 3267bb3415..e22c99504b 100644
--- a/backends/midi/quicktime.cpp
+++ b/backends/midi/quicktime.cpp
@@ -24,10 +24,10 @@
#if defined(MACOSX) || defined(macintosh)
-
-#include "sound/mpu401.h"
+#include "backends/midi/midiplugin.h"
#include "common/endian.h"
#include "common/util.h"
+#include "sound/mpu401.h"
#if defined(MACOSX)
#include <QuickTime/QuickTimeComponents.h>
@@ -250,8 +250,31 @@ void MidiDriver_QT::dispose()
}
}
-MidiDriver *MidiDriver_QT_create() {
- return new MidiDriver_QT();
+
+// Plugin interface
+
+class QuickTimeMidiPlugin : public MidiPlugin {
+public:
+ virtual const char *getName() const {
+ return "QuickTime";
+ }
+
+ virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+};
+
+PluginError QuicktimeMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+ *mididriver = new MidiDriver_QT();
+
+ return kNoError;
+}
+
+MidiDriver *MidiDriver_QT_create(Audio::Mixer *mixer) {
+ MidiDriver *mididriver;
+
+ QuickTimeMidiPlugin p;
+ p.createInstance(mixer, &mididriver);
+
+ return mididriver;
}
#endif // MACOSX || macintosh
diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp
index 39c61dd85b..ec7f6b2f27 100644
--- a/backends/midi/seq.cpp
+++ b/backends/midi/seq.cpp
@@ -30,8 +30,9 @@
#if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__)
-#include "sound/mpu401.h"
+#include "backends/midi/midiplugin.h"
#include "common/util.h"
+#include "sound/mpu401.h"
#include <fcntl.h>
#include <unistd.h>
@@ -169,8 +170,31 @@ void MidiDriver_SEQ::sysEx (const byte *msg, uint16 length) {
write (device, buf, position);
}
-MidiDriver *MidiDriver_SEQ_create() {
- return new MidiDriver_SEQ();
+
+// Plugin interface
+
+class SeqMidiPlugin : public MidiPlugin {
+public:
+ virtual const char *getName() const {
+ return "SEQ";
+ }
+
+ virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+};
+
+PluginError SeqMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+ *mididriver = new MidiDriver_SEQ();
+
+ return kNoError;
+}
+
+MidiDriver *MidiDriver_SEQ_create(Audio::Mixer *mixer) {
+ MidiDriver *mididriver;
+
+ SeqMidiPlugin p;
+ p.createInstance(mixer, &mididriver);
+
+ return mididriver;
}
#endif
diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp
index 8b10cf07a4..8fc6fefd4d 100644
--- a/backends/midi/timidity.cpp
+++ b/backends/midi/timidity.cpp
@@ -36,8 +36,9 @@
#if defined (UNIX)
-#include "sound/mpu401.h"
+#include "backends/midi/midiplugin.h"
#include "common/util.h"
+#include "sound/mpu401.h"
#include <fcntl.h>
#include <unistd.h>
@@ -510,8 +511,31 @@ void MidiDriver_TIMIDITY::sysEx(const byte *msg, uint16 length) {
timidity_write_data(buf, position);
}
-MidiDriver *MidiDriver_TIMIDITY_create() {
- return new MidiDriver_TIMIDITY();
+
+// Plugin interface
+
+class TimidityMidiPlugin : public MidiPlugin {
+public:
+ virtual const char *getName() const {
+ return "TiMidity";
+ }
+
+ virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+};
+
+PluginError TimidityMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+ *mididriver = new MidiDriver_TIMIDITY();
+
+ return kNoError;
+}
+
+MidiDriver *MidiDriver_TIMIDITY_create(Audio::Mixer *mixer) {
+ MidiDriver *mididriver;
+
+ TimidityMidiPlugin p;
+ p.createInstance(mixer, &mididriver);
+
+ return mididriver;
}
#endif // defined (UNIX)
diff --git a/backends/midi/windows.cpp b/backends/midi/windows.cpp
index db3ed50165..17a5e7be47 100644
--- a/backends/midi/windows.cpp
+++ b/backends/midi/windows.cpp
@@ -24,11 +24,11 @@
#if defined(WIN32) && !defined(_WIN32_WCE)
+#include "backends/midi/midiplugin.h"
+#include "sound/mpu401.h"
#include <windows.h>
#include <mmsystem.h>
-#include "sound/mpu401.h"
-#include "common/util.h"
////////////////////////////////////////
//
@@ -141,8 +141,31 @@ void MidiDriver_WIN::check_error(MMRESULT result) {
}
}
-MidiDriver *MidiDriver_WIN_create() {
- return new MidiDriver_WIN();
+
+// Plugin interface
+
+class WindowsMidiPlugin : public MidiPlugin {
+public:
+ virtual const char *getName() const {
+ return "Windows MIDI";
+ }
+
+ virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+};
+
+PluginError WindowsMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+ *mididriver = new MidiDriver_WIN();
+
+ return kNoError;
+}
+
+MidiDriver *MidiDriver_WIN_create(Audio::Mixer *mixer) {
+ MidiDriver *mididriver;
+
+ WindowsMidiPlugin p;
+ p.createInstance(mixer, &mididriver);
+
+ return mididriver;
}
#endif
diff --git a/backends/midi/ypa1.cpp b/backends/midi/ypa1.cpp
index ca77de7300..3ea7d2170f 100644
--- a/backends/midi/ypa1.cpp
+++ b/backends/midi/ypa1.cpp
@@ -22,8 +22,9 @@
* $Id$
*/
-#include "sound/mpu401.h"
+#include "backends/midi/midiplugin.h"
#include "common/util.h"
+#include "sound/mpu401.h"
#include "Pa1Lib.h"
@@ -102,6 +103,29 @@ void MidiDriver_YamahaPa1::send(uint32 b) {
}
}
-MidiDriver *MidiDriver_YamahaPa1_create() {
- return new MidiDriver_YamahaPa1();
+
+// Plugin interface
+
+class YamahaPa1MidiPlugin : public MidiPlugin {
+public:
+ virtual const char *getName() const {
+ return "Yamaha Pa1";
+ }
+
+ virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+};
+
+PluginError YamahaPa1MidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+ *mididriver = new MidiDriver_YamahaPa1();
+
+ return kNoError;
+}
+
+MidiDriver *MidiDriver_YamahaPa1_create(Audio::Mixer *mixer) {
+ MidiDriver *mididriver;
+
+ YamahaPa1MidiPlugin p;
+ p.createInstance(mixer, &mididriver);
+
+ return mididriver;
}
diff --git a/backends/midi/zodiac.cpp b/backends/midi/zodiac.cpp
index b1c2aa61c7..55148b113b 100644
--- a/backends/midi/zodiac.cpp
+++ b/backends/midi/zodiac.cpp
@@ -22,8 +22,9 @@
* $Id$
*/
-#include "sound/mpu401.h"
+#include "backends/midi/midiplugin.h"
#include "common/util.h"
+#include "sound/mpu401.h"
#ifndef DISABLE_TAPWAVE
@@ -120,8 +121,31 @@ void MidiDriver_Zodiac::sysEx(const byte *msg, uint16 length) {
TwMidiSysEx(_midiHandle, 0, (byte *)buf, length + 2);
}
-MidiDriver *MidiDriver_Zodiac_create() {
- return new MidiDriver_Zodiac();
+
+// Plugin interface
+
+class ZodiacMidiPlugin : public MidiPlugin {
+public:
+ virtual const char *getName() const {
+ return "Tapwave Zodiac";
+ }
+
+ virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+};
+
+PluginError ZodiacMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+ *mididriver = new MidiDriver_Zodiac();
+
+ return kNoError;
+}
+
+MidiDriver *MidiDriver_Zodiac_create(Audio::Mixer *mixer) {
+ MidiDriver *mididriver;
+
+ ZodiacMidiPlugin p;
+ p.createInstance(mixer, &mididriver);
+
+ return mididriver;
}
#endif
diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp
index 53bc224180..52cf5d0e65 100644
--- a/sound/mididrv.cpp
+++ b/sound/mididrv.cpp
@@ -238,34 +238,34 @@ MidiDriver *MidiDriver::createMidi(int midiDriver) {
#if defined(PALMOS_MODE)
#if defined(COMPILE_CLIE)
- case MD_YPA1: return MidiDriver_YamahaPa1_create();
+ case MD_YPA1: return MidiDriver_YamahaPa1_create(g_system->getMixer());
#elif defined(COMPILE_ZODIAC) && (!defined(ENABLE_SCUMM) || !defined(PALMOS_ARM))
- case MD_ZODIAC: return MidiDriver_Zodiac_create();
+ case MD_ZODIAC: return MidiDriver_Zodiac_create(g_system->getMixer());
#endif
#endif
#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
- case MD_WINDOWS: return MidiDriver_WIN_create();
+ case MD_WINDOWS: return MidiDriver_WIN_create(g_system->getMixer());
#endif
#if defined(UNIX) && !defined(__BEOS__) && !defined(MACOSX) && !defined(__MAEMO__)
- case MD_SEQ: return MidiDriver_SEQ_create();
+ case MD_SEQ: return MidiDriver_SEQ_create(g_system->getMixer());
#endif
#if defined(UNIX)
- case MD_TIMIDITY: return MidiDriver_TIMIDITY_create();
+ case MD_TIMIDITY: return MidiDriver_TIMIDITY_create(g_system->getMixer());
#endif
#if defined(IRIX)
- case MD_DMEDIA: return MidiDriver_DMEDIA_create();
+ case MD_DMEDIA: return MidiDriver_DMEDIA_create(g_system->getMixer());
#endif
#if defined(MACOSX)
- case MD_QTMUSIC: return MidiDriver_QT_create();
- case MD_COREAUDIO: return MidiDriver_CORE_create();
- case MD_COREMIDI: return MidiDriver_CoreMIDI_create();
+ case MD_QTMUSIC: return MidiDriver_QT_create(g_system->getMixer());
+ case MD_COREAUDIO: return MidiDriver_CORE_create(g_system->getMixer());
+ case MD_COREMIDI: return MidiDriver_CoreMIDI_create(g_system->getMixer());
#endif
#if defined(UNIX) && defined(USE_ALSA)
- case MD_ALSA: return MidiDriver_ALSA_create();
+ case MD_ALSA: return MidiDriver_ALSA_create(g_system->getMixer());
#endif
#if defined(__amigaos4__)
- case MD_CAMD: return MidiDriver_CAMD_create();
+ case MD_CAMD: return MidiDriver_CAMD_create(g_system->getMixer());
#endif
}
diff --git a/sound/mididrv.h b/sound/mididrv.h
index 38621530a4..e72e430747 100644
--- a/sound/mididrv.h
+++ b/sound/mididrv.h
@@ -273,16 +273,16 @@ public:
// Factory functions, for faster compile
extern MidiDriver *MidiDriver_NULL_create();
extern MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer);
-extern MidiDriver *MidiDriver_WIN_create();
-extern MidiDriver *MidiDriver_SEQ_create();
-extern MidiDriver *MidiDriver_TIMIDITY_create();
-extern MidiDriver *MidiDriver_QT_create();
-extern MidiDriver *MidiDriver_CORE_create();
-extern MidiDriver *MidiDriver_CoreMIDI_create();
+extern MidiDriver *MidiDriver_WIN_create(Audio::Mixer *mixer);
+extern MidiDriver *MidiDriver_SEQ_create(Audio::Mixer *mixer);
+extern MidiDriver *MidiDriver_TIMIDITY_create(Audio::Mixer *mixer);
+extern MidiDriver *MidiDriver_QT_create(Audio::Mixer *mixer);
+extern MidiDriver *MidiDriver_CORE_create(Audio::Mixer *mixer);
+extern MidiDriver *MidiDriver_CoreMIDI_create(Audio::Mixer *mixer);
extern MidiDriver *MidiDriver_ETUDE_create();
-extern MidiDriver *MidiDriver_ALSA_create();
-extern MidiDriver *MidiDriver_DMEDIA_create();
-extern MidiDriver *MidiDriver_CAMD_create();
+extern MidiDriver *MidiDriver_ALSA_create(Audio::Mixer *mixer);
+extern MidiDriver *MidiDriver_DMEDIA_create(Audio::Mixer *mixer);
+extern MidiDriver *MidiDriver_CAMD_create(Audio::Mixer *mixer);
extern MidiDriver *MidiDriver_YM2612_create(Audio::Mixer *mixer);
#ifdef USE_FLUIDSYNTH
extern MidiDriver *MidiDriver_FluidSynth_create(Audio::Mixer *mixer);
@@ -290,7 +290,7 @@ extern MidiDriver *MidiDriver_FluidSynth_create(Audio::Mixer *mixer);
#ifdef USE_MT32EMU
extern MidiDriver *MidiDriver_MT32_create(Audio::Mixer *mixer);
#endif
-extern MidiDriver *MidiDriver_YamahaPa1_create();
-extern MidiDriver *MidiDriver_Zodiac_create();
+extern MidiDriver *MidiDriver_YamahaPa1_create(Audio::Mixer *mixer);
+extern MidiDriver *MidiDriver_Zodiac_create(Audio::Mixer *mixer);
#endif