02-25-2010, 07:37 AM
Macro Macro1282
int handle;
MIDIHDR midiHdr;
int e;
str sysEx.decrypt(8 "F0 06 09 00 06 03 00 02 00 00 00 00 00 00 00 01 00 00 00 F7") ;;this is easiest way to fill str with binary data
;outb sysEx sysEx.len
;
;/* Open default MIDI Out device */
if !midiOutOpen(&handle, 0, 0, 0, CALLBACK_NULL)
;{
;;;;;/* Store pointer in MIDIHDR */
,midiHdr.lpData=sysEx
;
;;;;;/* Store its size in the MIDIHDR */
,midiHdr.dwBufferLength=sysEx.len
;
;;;;;/* Flags must be set to 0 */
;;;;;midiHdr.dwFlags = 0;
;
;;;;;/* Prepare the buffer and MIDIHDR */
,e = midiOutPrepareHeader(handle, &midiHdr, sizeof(MIDIHDR));
,if !e
;;;;;{
,,;/* Output the SysEx message */
,,e = midiOutLongMsg(handle, &midiHdr, sizeof(MIDIHDR));
,,if e
;;;;;;;;;{
,,,str errMsg.all(120);
;
,,,midiOutGetErrorText(e, errMsg, 120);
,,,out "Error: %s", errMsg
;;;;;;;;;}
;
;;;;;;;;;/* Unprepare the buffer and MIDIHDR */
,,rep
,,,if(MIDIERR_STILLPLAYING != midiOutUnprepareHeader(handle, &midiHdr, sizeof(MIDIHDR))) break
;;;;;;;;;{
;;;;;;;;;;;;;/* Should put a delay in here rather than a busy-wait */
,,,1
;;;;;;;;;}
;;;;;}
;
;;;;;/* Close the MIDI device */
,midiOutClose(handle);