diff options
author | Jordi Vilalta Prat | 2008-06-13 16:04:43 +0000 |
---|---|---|
committer | Jordi Vilalta Prat | 2008-06-13 16:04:43 +0000 |
commit | 8eac3569462c71fdcb7d4d23684a8d5ee34dc8b8 (patch) | |
tree | 5d8f20ef0605e11a65c6bcede9dc91f57fc2cb1b /backends | |
parent | 177993b14530e8c4af6d46be62a11b02719accb9 (diff) | |
download | scummvm-rg350-8eac3569462c71fdcb7d4d23684a8d5ee34dc8b8.tar.gz scummvm-rg350-8eac3569462c71fdcb7d4d23684a8d5ee34dc8b8.tar.bz2 scummvm-rg350-8eac3569462c71fdcb7d4d23684a8d5ee34dc8b8.zip |
Added initial interface to list music devices and their types
svn-id: r32695
Diffstat (limited to 'backends')
-rw-r--r-- | backends/midi/alsa.cpp | 20 | ||||
-rw-r--r-- | backends/midi/camd.cpp | 21 | ||||
-rw-r--r-- | backends/midi/coreaudio.cpp | 19 | ||||
-rw-r--r-- | backends/midi/coremidi.cpp | 19 | ||||
-rw-r--r-- | backends/midi/dmedia.cpp | 19 | ||||
-rw-r--r-- | backends/midi/quicktime.cpp | 19 | ||||
-rw-r--r-- | backends/midi/seq.cpp | 19 | ||||
-rw-r--r-- | backends/midi/timidity.cpp | 17 | ||||
-rw-r--r-- | backends/midi/windows.cpp | 19 | ||||
-rw-r--r-- | backends/midi/ypa1.cpp | 19 | ||||
-rw-r--r-- | backends/midi/zodiac.cpp | 19 |
11 files changed, 126 insertions, 84 deletions
diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index 2b564de294..f997b142df 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -243,21 +243,16 @@ void MidiDriver_ALSA::send_event(int do_flush) { class AlsaMusicPlugin : public MusicPluginObject { public: - virtual const char *getName() const { + const char *getName() const { return "ALSA"; } - virtual const char *getId() const { + const char *getId() const { return "alsa"; } - virtual int getCapabilities() const { - return MDT_MIDI; - } - - virtual Common::StringList getDevices() const; - - virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; + MusicDevices getDevices() const; + PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; }; #define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits)) @@ -271,8 +266,8 @@ static int check_permission(snd_seq_port_info_t *pinfo) return 0; } -Common::StringList AlsaMusicPlugin::getDevices() const { - Common::StringList devices; +MusicDevices AlsaMusicPlugin::getDevices() const { + MusicDevices devices; snd_seq_t *seq; if (snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0) < 0) @@ -292,7 +287,8 @@ Common::StringList AlsaMusicPlugin::getDevices() const { 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)); + // TODO: Return a different music type depending on the configuration + devices.push_back(MusicDevice(this, snd_seq_client_info_get_name(cinfo), MT_GM)); //snd_seq_client_info_get_client(cinfo) : snd_seq_port_info_get_port(pinfo) } } diff --git a/backends/midi/camd.cpp b/backends/midi/camd.cpp index 67600c004a..d6d5819a6e 100644 --- a/backends/midi/camd.cpp +++ b/backends/midi/camd.cpp @@ -168,23 +168,26 @@ void MidiDriver_CAMD::closeAll() { class CamdMusicPlugin : public MusicPluginObject { public: - virtual const char *getName() const { + const char *getName() const { return "CAMD"; } - virtual const char *getId() const { + const char *getId() const { return "camd"; } - virtual int getCapabilities() const { - return MDT_MIDI; - } - - //virtual Common::StringList getDevices() const; - - virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; + MusicDevices getDevices() const; + PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; }; +MusicDevices CamdMusicPlugin::getDevices() const { + MusicDevices devices; + // TODO: Return a different music type depending on the configuration + // TODO: List the available devices + devices.push_back(MusicDevice(this, "", MT_GM)); + return devices; +} + PluginError CamdMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { *mididriver = new MidiDriver_CAMD(); diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp index 62df5a70b4..bf35fb90ba 100644 --- a/backends/midi/coreaudio.cpp +++ b/backends/midi/coreaudio.cpp @@ -209,21 +209,26 @@ void MidiDriver_CORE::sysEx(const byte *msg, uint16 length) { class CoreAudioMusicPlugin : public MusicPluginObject { public: - virtual const char *getName() const { + const char *getName() const { return "CoreAudio"; } - virtual const char *getId() const { + const char *getId() const { return "core"; } - virtual int getCapabilities() const { - return MDT_MIDI; - } - - virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; + MusicDevices getDevices() const; + PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; }; +MusicDevices CoreAudioMusicPlugin::getDevices() const { + MusicDevices devices; + // TODO: Return a different music type depending on the configuration + // TODO: List the available devices + devices.push_back(MusicDevice(this, "", MT_GM)); + return devices; +} + PluginError CoreAudioMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { *mididriver = new MidiDriver_CORE(); diff --git a/backends/midi/coremidi.cpp b/backends/midi/coremidi.cpp index 613534d5b1..da82249792 100644 --- a/backends/midi/coremidi.cpp +++ b/backends/midi/coremidi.cpp @@ -181,21 +181,26 @@ void MidiDriver_CoreMIDI::sysEx(const byte *msg, uint16 length) { class CoreMIDIMusicPlugin : public MusicPluginObject { public: - virtual const char *getName() const { + const char *getName() const { return "CoreMIDI"; } - virtual const char *getId() const { + const char *getId() const { return "coremidi"; } - virtual int getCapabilities() const { - return MDT_MIDI; - } - - virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; + MusicDevices getDevices() const; + PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; }; +MusicDevices CoreMIDIMusicPlugin::getDevices() const { + MusicDevices devices; + // TODO: Return a different music type depending on the configuration + // TODO: List the available devices + devices.push_back(MusicDevice(this, "", MT_GM)); + return devices; +} + PluginError CoreMIDIMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { *mididriver = new MidiDriver_CoreMIDI(); diff --git a/backends/midi/dmedia.cpp b/backends/midi/dmedia.cpp index 257f9ba07c..b4bd426ca4 100644 --- a/backends/midi/dmedia.cpp +++ b/backends/midi/dmedia.cpp @@ -180,21 +180,26 @@ void MidiDriver_DMEDIA::sysEx (const byte *msg, uint16 length) { class DMediaMusicPlugin : public MusicPluginObject { public: - virtual const char *getName() const { + const char *getName() const { return "DMedia"; } - virtual const char *getId() const { + const char *getId() const { return "dmedia"; } - virtual int getCapabilities() const { - return MDT_MIDI; - } - - virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; + MusicDevices getDevices() const; + PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; }; +MusicDevices DMediaMusicPlugin::getDevices() const { + MusicDevices devices; + // TODO: Return a different music type depending on the configuration + // TODO: List the available devices + devices.push_back(MusicDevice(this, "", MT_GM)); + return devices; +} + PluginError DMediaMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { *mididriver = new MidiDriver_DMEDIA(); diff --git a/backends/midi/quicktime.cpp b/backends/midi/quicktime.cpp index 1443f895a6..568adf022b 100644 --- a/backends/midi/quicktime.cpp +++ b/backends/midi/quicktime.cpp @@ -267,21 +267,26 @@ void MidiDriver_QT::dispose() class QuickTimeMusicPlugin : public MusicPluginObject { public: - virtual const char *getName() const { + const char *getName() const { return "QuickTime"; } - virtual const char *getId() const { + const char *getId() const { return "qt"; } - virtual int getCapabilities() const { - return MDT_MIDI; - } - - virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; + MusicDevices getDevices() const; + PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; }; +MusicDevices QuickTimeMusicPlugin::getDevices() const { + MusicDevices devices; + // TODO: Return a different music type depending on the configuration + // TODO: List the available devices + devices.push_back(MusicDevice(this, "", MT_GM)); + return devices; +} + PluginError QuickTimeMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { *mididriver = new MidiDriver_QT(); diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp index fc7ebb060b..57a5a1ea32 100644 --- a/backends/midi/seq.cpp +++ b/backends/midi/seq.cpp @@ -175,21 +175,26 @@ void MidiDriver_SEQ::sysEx (const byte *msg, uint16 length) { class SeqMusicPlugin : public MusicPluginObject { public: - virtual const char *getName() const { + const char *getName() const { return "SEQ"; } - virtual const char *getId() const { + const char *getId() const { return "seq"; } - virtual int getCapabilities() const { - return MDT_MIDI; - } - - virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; + MusicDevices getDevices() const; + PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; }; +MusicDevices SeqMusicPlugin::getDevices() const { + MusicDevices devices; + // TODO: Return a different music type depending on the configuration + // TODO: List the available devices + devices.push_back(MusicDevice(this, "", MT_GM)); + return devices; +} + PluginError SeqMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { *mididriver = new MidiDriver_SEQ(); diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp index 40b684e664..b262fed88c 100644 --- a/backends/midi/timidity.cpp +++ b/backends/midi/timidity.cpp @@ -516,21 +516,24 @@ void MidiDriver_TIMIDITY::sysEx(const byte *msg, uint16 length) { class TimidityMusicPlugin : public MusicPluginObject { public: - virtual const char *getName() const { + const char *getName() const { return "TiMidity"; } - virtual const char *getId() const { + const char *getId() const { return "timidity"; } - virtual int getCapabilities() const { - return MDT_MIDI; - } - - virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; + MusicDevices getDevices() const; + PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; }; +MusicDevices TimidityMusicPlugin::getDevices() const { + MusicDevices devices; + devices.push_back(MusicDevice(this, "", MT_GM)); + return devices; +} + PluginError TimidityMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { *mididriver = new MidiDriver_TIMIDITY(); diff --git a/backends/midi/windows.cpp b/backends/midi/windows.cpp index 8393082fea..c564c124fe 100644 --- a/backends/midi/windows.cpp +++ b/backends/midi/windows.cpp @@ -149,21 +149,26 @@ void MidiDriver_WIN::check_error(MMRESULT result) { class WindowsMusicPlugin : public MusicPluginObject { public: - virtual const char *getName() const { + const char *getName() const { return "Windows MIDI"; } - virtual const char *getId() const { + const char *getId() const { return "windows"; } - virtual int getCapabilities() const { - return MDT_MIDI; - } - - virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; + MusicDevices getDevices() const; + PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; }; +MusicDevices WindowsMusicPlugin::getDevices() const { + MusicDevices devices; + // TODO: Return a different music type depending on the configuration + // TODO: List the available devices + devices.push_back(MusicDevice(this, "", MT_GM)); + return devices; +} + PluginError WindowsMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { *mididriver = new MidiDriver_WIN(); diff --git a/backends/midi/ypa1.cpp b/backends/midi/ypa1.cpp index d2fc6a8c91..88f9c3de8f 100644 --- a/backends/midi/ypa1.cpp +++ b/backends/midi/ypa1.cpp @@ -108,21 +108,26 @@ void MidiDriver_YamahaPa1::send(uint32 b) { class YamahaPa1MusicPlugin : public MusicPluginObject { public: - virtual const char *getName() const { + const char *getName() const { return "Yamaha Pa1"; } - virtual const char *getId() const { + const char *getId() const { return "ypa1"; } - virtual int getCapabilities() const { - return MDT_MIDI; - } - - virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; + MusicDevices getDevices() const; + PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; }; +MusicDevices YamahaPa1MusicPlugin::getDevices() const { + MusicDevices devices; + // TODO: Return a different music type depending on the configuration + // TODO: List the available devices + devices.push_back(MusicDevice(this, "", MT_GM)); + return devices; +} + PluginError YamahaPa1MusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { *mididriver = new MidiDriver_YamahaPa1(); diff --git a/backends/midi/zodiac.cpp b/backends/midi/zodiac.cpp index b210b0cfc3..456e4df43a 100644 --- a/backends/midi/zodiac.cpp +++ b/backends/midi/zodiac.cpp @@ -126,21 +126,26 @@ void MidiDriver_Zodiac::sysEx(const byte *msg, uint16 length) { class ZodiacMusicPlugin : public MusicPluginObject { public: - virtual const char *getName() const { + const char *getName() const { return "Tapwave Zodiac"; } - virtual const char *getId() const { + const char *getId() const { return "zodiac"; } - virtual int getCapabilities() const { - return MDT_MIDI; - } - - virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; + MusicDevices getDevices() const; + PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; }; +MusicDevices ZodiacMusicPlugin::getDevices() const { + MusicDevices devices; + // TODO: Return a different music type depending on the configuration + // TODO: List the available devices + devices.push_back(MusicDevice(this, "", MT_GM)); + return devices; +} + PluginError ZodiacMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { *mididriver = new MidiDriver_Zodiac(); |