From 70783268093f00a61d3673f729a3aa113b5ad43a Mon Sep 17 00:00:00 2001 From: Jamieson Christian Date: Wed, 18 Dec 2002 07:37:47 +0000 Subject: Experimental SysEx implementation for the -eseq driver. svn-id: r6011 --- sound/mididrv.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'sound') diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp index d8d0db83ac..e5947acffb 100644 --- a/sound/mididrv.cpp +++ b/sound/mididrv.cpp @@ -142,6 +142,7 @@ public: int open(); void close(); void send(uint32 b); + void sysEx (byte *msg, uint16 length); private: bool _isOpen; @@ -233,6 +234,28 @@ void MidiDriver_SEQ::send(uint32 b) write(device, buf, position); } +void MidiDriver_SEQ::sysEx (byte *msg, uint16 length) +{ + if (length > 256) { + warning ("Cannot send SysEx block - data too large"); + return; + } + + unsigned char buf [1024]; + int position = 0; + byte *chr = msg; + + // Should be we using EV_SYSEX instead of SEQ_MIDIPUTC? + // I'm not sure how to send EV_SYSEX. + for (; length; --length) { + buf[position++] = SEQ_MIDIPUTC; + buf[position++] = (unsigned char) *chr; + buf[position++] = _device_num; + buf[position++] = 0; + } + write (device, buf, position); +} + MidiDriver *MidiDriver_SEQ_create() { return new MidiDriver_SEQ(); -- cgit v1.2.3