aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2003-10-02 22:52:57 +0000
committerMax Horn2003-10-02 22:52:57 +0000
commitbb6765f85d6272f736fa9bbe0981582fa7679ef5 (patch)
tree11f5ee1e2c310da73ccd29b016c951733108e186 /sound
parent3f55f2669d560489ee017d64f5bdd0f785cf796e (diff)
downloadscummvm-rg350-bb6765f85d6272f736fa9bbe0981582fa7679ef5.tar.gz
scummvm-rg350-bb6765f85d6272f736fa9bbe0981582fa7679ef5.tar.bz2
scummvm-rg350-bb6765f85d6272f736fa9bbe0981582fa7679ef5.zip
cleanup & restructuring; in particular move the midi driver list to its own source file
svn-id: r10550
Diffstat (limited to 'sound')
-rw-r--r--sound/mididrv.cpp68
-rw-r--r--sound/mididrv.h78
-rw-r--r--sound/module.mk1
3 files changed, 120 insertions, 27 deletions
diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp
new file mode 100644
index 0000000000..3f175ce1f6
--- /dev/null
+++ b/sound/mididrv.cpp
@@ -0,0 +1,68 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001 Ludvig Strigeus
+ * Copyright (C) 2001-2003 The ScummVM project
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#include "stdafx.h"
+#include "sound/mididrv.h"
+
+
+/** Internal list of all available 'midi' drivers. */
+static const struct MidiDriverDescription midiDrivers[] = {
+ {"auto", "Default", MD_AUTO},
+ {"null", "No music", MD_NULL},
+
+#if defined(WIN32) && !defined(_WIN32_WCE)
+ {"windows", "Windows MIDI", MD_WINDOWS},
+#endif
+
+#if defined(UNIX) && !defined(__BEOS__) && !defined(MACOSX)
+ {"seq", "SEQ", MD_SEQ},
+#endif
+
+#if defined(MACOSX)
+ {"qt", "QuickTime", MD_QTMUSIC},
+ {"core", "CoreAudio", MD_COREAUDIO},
+#endif
+
+#if defined(__MORPHOS__)
+ {"etude", "Etude", MD_ETUDE},
+#endif
+
+#if defined(UNIX) && defined(USE_ALSA)
+ {"alsa", "ALSA", MD_ALSA},
+#endif
+
+#if !defined(__PALM_OS__)
+ {"adlib", "Adlib", MD_ADLIB},
+ {"pcspk", "PC Speaker", MD_PCSPK},
+ {"pcjr", "IBM PCjr", MD_PCJR},
+#endif
+
+#if defined(__PALM_OS__)
+ {"ypa1", "Yamaha Pa1", MD_YPA1},
+#endif
+ {0, 0, 0}
+};
+
+
+const MidiDriverDescription *getAvailableMidiDrivers() {
+ return midiDrivers;
+}
diff --git a/sound/mididrv.h b/sound/mididrv.h
index f9164cb3fb..65043ff5f9 100644
--- a/sound/mididrv.h
+++ b/sound/mididrv.h
@@ -28,13 +28,53 @@
class MidiChannel;
class SoundMixer;
-// Abstract MIDI Driver Class
+
+/** MIDI Driver Types */
+enum {
+ MD_AUTO = 0,
+ MD_NULL = 1,
+ MD_WINDOWS = 2,
+ MD_TIMIDITY = 3,
+ MD_SEQ = 4,
+ MD_QTMUSIC = 5,
+ MD_ETUDE = 6,
+ MD_COREAUDIO = 7,
+ MD_MIDIEMU = 8,
+ MD_ALSA = 9,
+ MD_ADLIB = 10,
+ MD_PCSPK = 11,
+ MD_PCJR = 12,
+
+ MD_YPA1 = 100 // palmos
+};
+
+/**
+ * Abstract description of a MIDI driver. Used by the config file and command
+ * line parsing code, and also to be able to give the user a list of available
+ * drivers.
+ */
+struct MidiDriverDescription {
+ const char *name;
+ const char *description;
+ int id;
+};
+
+/**
+ * Get a list of all available MidiDriver types.
+ * @return list of all available midi drivers, terminated by a zero entry
+ */
+extern const MidiDriverDescription *getAvailableMidiDrivers();
+
+
+/** Abstract MIDI Driver Class */
class MidiDriver {
public:
virtual ~MidiDriver() { }
- // Error codes returned by open.
- // Can be converted to a string with getErrorName()
+ /**
+ * Error codes returned by open.
+ * Can be converted to a string with getErrorName().
+ */
enum {
MERR_CANNOT_CONNECT = 1,
// MERR_STREAMING_NOT_AVAILABLE = 2,
@@ -48,20 +88,22 @@ public:
PROP_CHANNEL_MASK = 3
};
- // Open the midi driver.
- // Returns 0 if successful, otherwise an error code.
+ /**
+ * Open the midi driver.
+ * @return 0 if successful, otherwise an error code.
+ */
virtual int open() = 0;
- // Close the midi driver
+ /** Close the midi driver. */
virtual void close() = 0;
- // Output a packed midi command to the midi stream
+ /** Output a packed midi command to the midi stream. */
virtual void send(uint32 b) = 0;
- // Get or set a property
+ /** Get or set a property. */
virtual uint32 property(int prop, uint32 param) { return 0; }
- // Retrieve a string representation of an error code
+ /** Retrieve a string representation of an error code. */
static const char *getErrorName(int error_code);
// HIGH-LEVEL SEMANTIC METHODS
@@ -117,24 +159,6 @@ public:
virtual void sysEx_customInstrument (uint32 type, byte *instr) = 0;
};
-// MIDI Driver Types
-enum {
- MD_AUTO = 0,
- MD_NULL = 1,
- MD_WINDOWS = 2,
- MD_TIMIDITY = 3,
- MD_SEQ = 4,
- MD_QTMUSIC = 5,
- MD_ETUDE = 6,
- MD_COREAUDIO = 7,
- MD_MIDIEMU = 8,
- MD_ALSA = 9,
- MD_ADLIB = 10,
- MD_PCSPK = 11,
- MD_PCJR = 12,
-
- MD_YPA1 = 100 // palmos
-};
// Factory functions, for faster compile
extern MidiDriver *MidiDriver_NULL_create();
diff --git a/sound/module.mk b/sound/module.mk
index 50072c0b5b..e0974162a5 100644
--- a/sound/module.mk
+++ b/sound/module.mk
@@ -3,6 +3,7 @@ MODULE := sound
MODULE_OBJS := \
sound/audiostream.o \
sound/fmopl.o \
+ sound/mididrv.o \
sound/midiparser.o \
sound/midiparser_smf.o \
sound/midiparser_xmidi.o \