Added the MidiPlugin interface (first step towards the MIDI plugins)
svn-id: r31993
This commit is contained in:
parent
257aaa3ced
commit
d696ed6ea2
14 changed files with 427 additions and 58 deletions
|
@ -26,10 +26,10 @@
|
||||||
|
|
||||||
#if defined(UNIX) && defined(USE_ALSA)
|
#if defined(UNIX) && defined(USE_ALSA)
|
||||||
|
|
||||||
#include "sound/mpu401.h"
|
#include "backends/midi/midiplugin.h"
|
||||||
|
|
||||||
#include "common/util.h"
|
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
|
#include "common/util.h"
|
||||||
|
#include "sound/mpu401.h"
|
||||||
|
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
|
|
||||||
|
@ -238,8 +238,75 @@ void MidiDriver_ALSA::send_event(int do_flush) {
|
||||||
snd_seq_flush_output(seq_handle);
|
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
|
#endif
|
||||||
|
|
|
@ -26,9 +26,10 @@
|
||||||
|
|
||||||
#if defined(__amigaos4__)
|
#if defined(__amigaos4__)
|
||||||
|
|
||||||
#include "sound/mpu401.h"
|
#include "backends/midi/midiplugin.h"
|
||||||
#include "common/util.h"
|
|
||||||
#include "common/endian.h"
|
#include "common/endian.h"
|
||||||
|
#include "common/util.h"
|
||||||
|
#include "sound/mpu401.h"
|
||||||
|
|
||||||
#include <proto/camd.h>
|
#include <proto/camd.h>
|
||||||
#include <proto/exec.h>
|
#include <proto/exec.h>
|
||||||
|
@ -162,8 +163,33 @@ void MidiDriver_CAMD::closeAll() {
|
||||||
_isOpen = false;
|
_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
|
#endif
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
|
|
||||||
|
#include "backends/midi/midiplugin.h"
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "sound/mpu401.h"
|
#include "sound/mpu401.h"
|
||||||
|
@ -192,8 +193,31 @@ void MidiDriver_CORE::sysEx(const byte *msg, uint16 length) {
|
||||||
MusicDeviceSysEx(_synth, buf, length+2);
|
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
|
#endif // MACOSX
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
|
|
||||||
|
#include "backends/midi/midiplugin.h"
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "sound/mpu401.h"
|
#include "sound/mpu401.h"
|
||||||
|
@ -175,8 +176,31 @@ void MidiDriver_CoreMIDI::sysEx(const byte *msg, uint16 length) {
|
||||||
MIDISend(mOutPort, mDest, packetList);
|
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
|
#endif // MACOSX
|
||||||
|
|
|
@ -29,9 +29,10 @@
|
||||||
|
|
||||||
#if defined(IRIX)
|
#if defined(IRIX)
|
||||||
|
|
||||||
|
#include "backends/midi/midiplugin.h"
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
#include "sound/mpu401.h"
|
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "sound/mpu401.h"
|
||||||
|
|
||||||
#include <dmedia/midi.h>
|
#include <dmedia/midi.h>
|
||||||
#include <sys/types.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
|
#endif
|
||||||
|
|
62
backends/midi/midiplugin.h
Normal file
62
backends/midi/midiplugin.h
Normal file
|
@ -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
|
|
@ -24,10 +24,10 @@
|
||||||
|
|
||||||
#if defined(MACOSX) || defined(macintosh)
|
#if defined(MACOSX) || defined(macintosh)
|
||||||
|
|
||||||
|
#include "backends/midi/midiplugin.h"
|
||||||
#include "sound/mpu401.h"
|
|
||||||
#include "common/endian.h"
|
#include "common/endian.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "sound/mpu401.h"
|
||||||
|
|
||||||
#if defined(MACOSX)
|
#if defined(MACOSX)
|
||||||
#include <QuickTime/QuickTimeComponents.h>
|
#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
|
#endif // MACOSX || macintosh
|
||||||
|
|
|
@ -30,8 +30,9 @@
|
||||||
|
|
||||||
#if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__)
|
#if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__)
|
||||||
|
|
||||||
#include "sound/mpu401.h"
|
#include "backends/midi/midiplugin.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "sound/mpu401.h"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -169,8 +170,31 @@ void MidiDriver_SEQ::sysEx (const byte *msg, uint16 length) {
|
||||||
write (device, buf, position);
|
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
|
#endif
|
||||||
|
|
|
@ -36,8 +36,9 @@
|
||||||
|
|
||||||
#if defined (UNIX)
|
#if defined (UNIX)
|
||||||
|
|
||||||
#include "sound/mpu401.h"
|
#include "backends/midi/midiplugin.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "sound/mpu401.h"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -510,8 +511,31 @@ void MidiDriver_TIMIDITY::sysEx(const byte *msg, uint16 length) {
|
||||||
timidity_write_data(buf, position);
|
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)
|
#endif // defined (UNIX)
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(_WIN32_WCE)
|
#if defined(WIN32) && !defined(_WIN32_WCE)
|
||||||
|
|
||||||
|
#include "backends/midi/midiplugin.h"
|
||||||
|
#include "sound/mpu401.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <mmsystem.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
|
#endif
|
||||||
|
|
|
@ -22,8 +22,9 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sound/mpu401.h"
|
#include "backends/midi/midiplugin.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "sound/mpu401.h"
|
||||||
|
|
||||||
#include "Pa1Lib.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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,9 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sound/mpu401.h"
|
#include "backends/midi/midiplugin.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "sound/mpu401.h"
|
||||||
|
|
||||||
#ifndef DISABLE_TAPWAVE
|
#ifndef DISABLE_TAPWAVE
|
||||||
|
|
||||||
|
@ -120,8 +121,31 @@ void MidiDriver_Zodiac::sysEx(const byte *msg, uint16 length) {
|
||||||
TwMidiSysEx(_midiHandle, 0, (byte *)buf, length + 2);
|
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
|
#endif
|
||||||
|
|
|
@ -238,34 +238,34 @@ MidiDriver *MidiDriver::createMidi(int midiDriver) {
|
||||||
|
|
||||||
#if defined(PALMOS_MODE)
|
#if defined(PALMOS_MODE)
|
||||||
#if defined(COMPILE_CLIE)
|
#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))
|
#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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
|
#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
|
#endif
|
||||||
#if defined(UNIX) && !defined(__BEOS__) && !defined(MACOSX) && !defined(__MAEMO__)
|
#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
|
#endif
|
||||||
#if defined(UNIX)
|
#if defined(UNIX)
|
||||||
case MD_TIMIDITY: return MidiDriver_TIMIDITY_create();
|
case MD_TIMIDITY: return MidiDriver_TIMIDITY_create(g_system->getMixer());
|
||||||
#endif
|
#endif
|
||||||
#if defined(IRIX)
|
#if defined(IRIX)
|
||||||
case MD_DMEDIA: return MidiDriver_DMEDIA_create();
|
case MD_DMEDIA: return MidiDriver_DMEDIA_create(g_system->getMixer());
|
||||||
#endif
|
#endif
|
||||||
#if defined(MACOSX)
|
#if defined(MACOSX)
|
||||||
case MD_QTMUSIC: return MidiDriver_QT_create();
|
case MD_QTMUSIC: return MidiDriver_QT_create(g_system->getMixer());
|
||||||
case MD_COREAUDIO: return MidiDriver_CORE_create();
|
case MD_COREAUDIO: return MidiDriver_CORE_create(g_system->getMixer());
|
||||||
case MD_COREMIDI: return MidiDriver_CoreMIDI_create();
|
case MD_COREMIDI: return MidiDriver_CoreMIDI_create(g_system->getMixer());
|
||||||
#endif
|
#endif
|
||||||
#if defined(UNIX) && defined(USE_ALSA)
|
#if defined(UNIX) && defined(USE_ALSA)
|
||||||
case MD_ALSA: return MidiDriver_ALSA_create();
|
case MD_ALSA: return MidiDriver_ALSA_create(g_system->getMixer());
|
||||||
#endif
|
#endif
|
||||||
#if defined(__amigaos4__)
|
#if defined(__amigaos4__)
|
||||||
case MD_CAMD: return MidiDriver_CAMD_create();
|
case MD_CAMD: return MidiDriver_CAMD_create(g_system->getMixer());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -273,16 +273,16 @@ public:
|
||||||
// Factory functions, for faster compile
|
// Factory functions, for faster compile
|
||||||
extern MidiDriver *MidiDriver_NULL_create();
|
extern MidiDriver *MidiDriver_NULL_create();
|
||||||
extern MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer);
|
extern MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_WIN_create();
|
extern MidiDriver *MidiDriver_WIN_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_SEQ_create();
|
extern MidiDriver *MidiDriver_SEQ_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_TIMIDITY_create();
|
extern MidiDriver *MidiDriver_TIMIDITY_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_QT_create();
|
extern MidiDriver *MidiDriver_QT_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_CORE_create();
|
extern MidiDriver *MidiDriver_CORE_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_CoreMIDI_create();
|
extern MidiDriver *MidiDriver_CoreMIDI_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_ETUDE_create();
|
extern MidiDriver *MidiDriver_ETUDE_create();
|
||||||
extern MidiDriver *MidiDriver_ALSA_create();
|
extern MidiDriver *MidiDriver_ALSA_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_DMEDIA_create();
|
extern MidiDriver *MidiDriver_DMEDIA_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_CAMD_create();
|
extern MidiDriver *MidiDriver_CAMD_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_YM2612_create(Audio::Mixer *mixer);
|
extern MidiDriver *MidiDriver_YM2612_create(Audio::Mixer *mixer);
|
||||||
#ifdef USE_FLUIDSYNTH
|
#ifdef USE_FLUIDSYNTH
|
||||||
extern MidiDriver *MidiDriver_FluidSynth_create(Audio::Mixer *mixer);
|
extern MidiDriver *MidiDriver_FluidSynth_create(Audio::Mixer *mixer);
|
||||||
|
@ -290,7 +290,7 @@ extern MidiDriver *MidiDriver_FluidSynth_create(Audio::Mixer *mixer);
|
||||||
#ifdef USE_MT32EMU
|
#ifdef USE_MT32EMU
|
||||||
extern MidiDriver *MidiDriver_MT32_create(Audio::Mixer *mixer);
|
extern MidiDriver *MidiDriver_MT32_create(Audio::Mixer *mixer);
|
||||||
#endif
|
#endif
|
||||||
extern MidiDriver *MidiDriver_YamahaPa1_create();
|
extern MidiDriver *MidiDriver_YamahaPa1_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_Zodiac_create();
|
extern MidiDriver *MidiDriver_Zodiac_create(Audio::Mixer *mixer);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue