Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
PortMidi.SetFilter
Sets filters on an open input stream to drop selected input types.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
PortMidi | 4.2 | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |
MBS( "PortMidi.SetFilter"; StreamRef; Filter ) More
Parameters
Parameter | Description | Example |
---|---|---|
StreamRef | The reference to the midi stream. You create those with PortMidi.OpenInput or PortMidi.OpenOutput and finally close them with PortMidi.Close. | $stream |
Filter | The new filter value. | 0 |
Result
Returns OK or error.
Description
Sets filters on an open input stream to drop selected input types.By default, only active sensing messages are filtered.
Filtering is useful when midi routing or midi thru functionality is being provided by the user application.
For example, you may want to exclude timing messages (clock, MTC, start/stop/continue), while allowing note-related messages to pass. Or you may be using a sequencer or drum-machine for MIDI clock information but want to exclude any notes it may play.
Filter values (can be ORed):
Filter active sensing messages (0xFE) | PM_FILT_ACTIVE | 16384 |
Filter system exclusive messages (0xF0) | PM_FILT_SYSEX | 1 |
Filter clock messages (CLOCK 0xF8, START 0xFA, STOP 0xFC, and CONTINUE 0xFB) | PM_FILT_CLOCK | 7424 |
Filter play messages (start 0xFA, stop 0xFC, continue 0xFB) | PM_FILT_PLAY | 1024 |
Filter tick messages (0xF9) | PM_FILT_TICK | 512 |
Filter undefined FD messages | PM_FILT_FD | 8192 |
Filter undefined real-time messages | PM_FILT_UNDEFINED | 8192 |
Filter reset messages (0xFF) | PM_FILT_RESET | 32768 |
Filter all real-time messages | PM_FILT_REALTIME | 65281 |
Filter note-on and note-off (0x90-0x9F and 0x80-0x8F | PM_FILT_NOTE | 50331648 |
Filter channel aftertouch (most midi controllers use this) (0xD0-0xDF) | PM_FILT_CHANNEL_AFTERTOUCH | 536870912 |
Per-note aftertouch (0xA0-0xAF) | PM_FILT_POLY_AFTERTOUCH | 67108864 |
Filter both channel and poly aftertouch | PM_FILT_AFTERTOUCH | 603979776 |
Program changes (0xC0-0xCF) | PM_FILT_PROGRAM | 268435456 |
Control Changes (CC's) (0xB0-0xBF) | PM_FILT_CONTROL | 134217728 |
Pitch Bender (0xE0-0xEF | PM_FILT_PITCHBEND | 1073741824 |
MIDI Time Code (0xF1) | PM_FILT_MTC | 2 |
Song Position (0xF2) | PM_FILT_SONG_POSITION | 4 |
Song Select (0xF3) | PM_FILT_SONG_SELECT | 8 |
Tuning request (0xF6) | PM_FILT_TUNE | 64 |
All System Common messages (mtc, song position, song select, tune request) | PM_FILT_SYSTEMCOMMON | 78 |
Examples
To prohibit, say, active sensing and sysex messages, call:
MBS( "PortMidi.SetFilter"; $StreamRef; 16384 + 1 )
See also
This function checks for a license.
Created 18th August 2014, last changed 18th August 2014