Copyright © 2013-2014 MultiMedia Soft

MidiDevices.InputEventFilterSet method

Previous pageReturn to chapter overviewNext page

Remarks

 

Allows filtering one or more MIDI events incoming from the given MIDI input device. Filtered MIDI events will be ignored and will not generate the MidiDevicesEventReceived event.

 

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.InputEventFilterSet (

nDeviceUniqueId as Integer,

pBuffer as Variant,

nBufferLen as Long

) as enumDjcErrorCodes


 

[C++]

short control.MidiDevices.InputEventFilterSet (

short nDeviceUniqueId,

const VARIANT FAR& pBuffer,

long nBufferLen

);


 

Parameter

Description

 

 

nDeviceUniqueId

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

pBuffer

Variant parameter containing the pointer to a buffer that contains inside each byte the MIDI command to be filtered.

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 filter the "Note On" and "Note Off" commands incoming from a MIDI input device (represented by the m_nIdInputDevice variable filled by a previous call to the MidiDevices.Open method) in Visual Basic 6 and Visual C++ 6:

 

Visual Basic 6

 

 

Private Sub CommandSetFilter_Click()

 ' allocate and fill the buffer

 Dim FilterBuffer(2) As Byte

 FilterBuffer(0) = &H90   ' Note On MIDI command

 FilterBuffer(1) = &H80   ' Note Off MIDI command

 

 ' send the filter to the control

 ActiveDjConsole1.MidiDevices.InputEventFilterSet m_nIdInputDevice, VarPtr(FilterBuffer(0)), 2

End Sub

 

 

 

Visual C++ 6 with MFC

 

 

void CMyDialog::OnButtonSetFilter()

{

 // allocate and fill the buffer

 BYTE    FilterBuffer[2];

 FilterBuffer[0] = 0x90;   // Note On MIDI command

 FilterBuffer[1] = 0x80;   // Note Off MIDI command

 

 // prepare the variant buffer

       VARIANT      va;

 VariantInit (&va);

 va.vt = VT_BYREF | VT_UI1;

 va.pbVal = (BYTE *) FilterBuffer;

 

 // send the filter to the control

 m_ctrlActiveDjConsole1.GetMidiDevices().InputEventFilterSet (m_nIdInputDevice, va, 2);

}