Copyright © 2013-2014 MultiMedia Soft

MidiDevices.InputEventFilterSet method

Previous pageReturn to chapter overviewNext page



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 ClassMidiDevices class section and the How to manage MIDI devices tutorial.





[Visual Basic]

MidiDevices.MidiDevices.InputEventFilterSet (

nDeviceUniqueId as Int16,

pBuffer() as Byte,

nBufferLen as Int32

) as enumDjcErrorCodes



public enumDjcErrorCodes MidiDevices.InputEventFilterSet (

Int16 nDeviceUniqueId,

char[] pBuffer,

Int32 nBufferLen




public: enumDjcErrorCodes MidiDevices.InputEventFilterSet (

Int16 nDeviceUniqueId,

char __gc[] pBuffer,

Int32 nBufferLen








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


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


Length in bytes of the given buffer



Return value






Negative value

An error occurred. Check the LastError property value in order to see the last error.

enumDjcErrorCodes.ERR_DJC_NOERROR (0)

The method call was successful.




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);