Copyright © 2013-2015 MultiMedia Soft

MidiDevices.EventWriteRaw method

Previous pageReturn to chapter overviewNext page

Remarks

 

Sends a raw MIDI event to the MIDI output device previously opened through the MidiDevices.Open method.

 

For further details about the use of MIDI devices see the MidiDevices object section and the How to manage MIDI devices tutorial.

 

 

Syntax

 

[Visual Basic]

control.MidiDevices.EventWriteRaw (

nDeviceUniqueId as Integer,

pBuffer as Variant,

nBufferLen as Long

) as enumDjcErrorCodes


 

[C++]

short control.MidiDevices.EventWriteRaw (

short nDeviceUniqueId,

const VARIANT FAR& pBuffer,

long nBufferLen

);


 

Parameter

Description

 

 

nDeviceUniqueId

The unique identifier of the MIDI output device returned by a previous call to the MidiDevices.Open method

pBuffer

Variant parameter containing the pointer to MIDI data previously loaded in memory.

nBufferLen

Length in bytes of the given buffer

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred, check the LastError property value in order to get the error code

enumErrorCodes.ERR_NOERROR (0)

The method call was successful

 

 

Samples

 

Below you can find a couple of samples that demonstrate how to send a raw MIDI message (a SysEx message in this case) to a MIDI output device (represented by the m_nIdOutputDevice variable filled by a previous call to the MidiDevices.Open method) in Visual Basic 6 and Visual C++ 6:

 

Visual Basic 6

 

 

Private Sub CommandSendSysExId_Click()

 ' allocate and fill the buffer

 Dim SysExBuffer(6) As Byte

 SysExBuffer(0) = &HF0

 SysExBuffer(1) = &H7E

 SysExBuffer(2) = &H7F

 SysExBuffer(3) = &H6

 SysExBuffer(4) = &H1

 SysExBuffer(5) = &HF7

 

 ' send the raw SysSex MIDI message

 ActiveDjConsole1.MidiDevices.EventWriteRaw m_nIdOutputDevice, VarPtr(SysExBuffer(0)), 6

End Sub

 

 

 

Visual C++ 6 with MFC

 

 

void CMyDialog::OnButtonSendSysExId()

{

 // allocate and fill the buffer

 BYTE    SysExBuffer[6];

 SysExBuffer[0] = 0xF0;

 SysExBuffer[1] = 0x7E;

 SysExBuffer[2] = 0x7F;

 SysExBuffer[3] = 0x06;

 SysExBuffer[4] = 0x01;

 SysExBuffer[5] = 0xF7;

 

 // prepare the variant buffer

       VARIANT      va;

 VariantInit (&va);

 va.vt = VT_BYREF | VT_UI1;

 va.pbVal = (BYTE *) SysExBuffer;

 

 // send the raw SysSex MIDI message

 m_ctrlActiveDjConsole1.GetMidiDevices().EventWriteRaw (m_nIdOutputDevice, va, 6);

}