[Scummvm-cvs-logs] CVS: scummvm/sound mididrv.h,1.11,1.12 mpu401.h,1.1,1.2 mpu401.cpp,1.1,1.2
Jamieson Christian
jamieson630 at users.sourceforge.net
Tue Dec 17 23:14:02 CET 2002
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv21639/scummvm/sound
Modified Files:
mididrv.h mpu401.h mpu401.cpp
Log Message:
Initial framework for SysEx output support.
Index: mididrv.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mididrv.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mididrv.h 11 Dec 2002 16:09:56 -0000 1.11
+++ mididrv.h 18 Dec 2002 07:13:42 -0000 1.12
@@ -36,17 +36,15 @@
class MidiDriver {
public:
- /* Special events that can be inserted in a MidiEvent.
- * event = (ME_xxx<<24) | <24-bit data associated with event>
- */
+ // Special events that can be inserted in a MidiEvent.
+ // event = (ME_xxx<<24) | <24-bit data associated with event>
enum {
ME_NONE = 0,
ME_TEMPO = 1,
};
- /* 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,
@@ -60,20 +58,20 @@
};
- // open the midi driver.
- // returns 0 if successful, otherwise an error code.
+ // Open the midi driver.
+ // Returns 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);
- /* 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
@@ -85,6 +83,7 @@
send(( 0 << 16) | ( 38 << 8) | (0xB0 | channel));
}
+ virtual void sysEx (byte *msg, uint16 length) { }
virtual void sysEx_customInstrument (byte channel, uint32 type, byte *instr) { }
// Timing functions - MidiDriver now operates timers
@@ -100,6 +99,7 @@
class MidiChannel {
public:
+ virtual MidiDriver *device() = 0;
virtual void release() = 0;
// Regular messages
@@ -143,8 +143,7 @@
};
-/* Factory functions => no need to include the specific classes
- * in this header => faster compile */
+// Factory functions, for faster compile
extern MidiDriver *MidiDriver_NULL_create();
extern MidiDriver *MidiDriver_ADLIB_create();
extern MidiDriver *MidiDriver_WIN_create();
Index: mpu401.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mpu401.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- mpu401.h 8 Dec 2002 20:19:01 -0000 1.1
+++ mpu401.h 18 Dec 2002 07:13:42 -0000 1.2
@@ -46,6 +46,7 @@
void allocate() { _allocated = true; }
public:
+ MidiDriver *device();
void release() { _allocated = false; }
// Regular messages
Index: mpu401.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mpu401.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- mpu401.cpp 8 Dec 2002 20:19:01 -0000 1.1
+++ mpu401.cpp 18 Dec 2002 07:13:42 -0000 1.2
@@ -31,6 +31,7 @@
_allocated = false;
}
+MidiDriver *MidiChannel_MPU401::device() { return _owner; }
void MidiChannel_MPU401::noteOff (byte note) { _owner->send(note << 8 | 0x80 | _channel); }
void MidiChannel_MPU401::noteOn (byte note, byte velocity) { _owner->send (velocity << 16 | note << 8 | 0x90 | _channel); }
void MidiChannel_MPU401::programChange (byte program) { _owner->send(program << 8 | 0xC0 | _channel); }
More information about the Scummvm-git-logs
mailing list