PortMidi 2.2.x
|
Data Structures | |
struct | PmEvent |
All midi data comes in the form of PmEvent structures. More... | |
Macros | |
#define | PM_FILT_ACTIVE (1 << 0x0E) |
filter active sensing messages (0xFE): | |
#define | PM_FILT_SYSEX (1 << 0x00) |
filter system exclusive messages (0xF0): | |
#define | PM_FILT_CLOCK (1 << 0x08) |
filter MIDI clock message (0xF8) | |
#define | PM_FILT_PLAY ((1 << 0x0A) | (1 << 0x0C) | (1 << 0x0B)) |
filter play messages (start 0xFA, stop 0xFC, continue 0xFB) | |
#define | PM_FILT_TICK (1 << 0x09) |
filter tick messages (0xF9) | |
#define | PM_FILT_FD (1 << 0x0D) |
filter undefined FD messages | |
#define | PM_FILT_UNDEFINED PM_FILT_FD |
filter undefined real-time messages | |
#define | PM_FILT_RESET (1 << 0x0F) |
filter reset messages (0xFF) | |
#define | PM_FILT_REALTIME |
filter all real-time messages | |
#define | PM_FILT_NOTE ((1 << 0x19) | (1 << 0x18)) |
filter note-on and note-off (0x90-0x9F and 0x80-0x8F | |
#define | PM_FILT_CHANNEL_AFTERTOUCH (1 << 0x1D) |
filter channel aftertouch (most midi controllers use this) (0xD0-0xDF) | |
#define | PM_FILT_POLY_AFTERTOUCH (1 << 0x1A) |
per-note aftertouch (0xA0-0xAF) | |
#define | PM_FILT_AFTERTOUCH (PM_FILT_CHANNEL_AFTERTOUCH | PM_FILT_POLY_AFTERTOUCH) |
filter both channel and poly aftertouch | |
#define | PM_FILT_PROGRAM (1 << 0x1C) |
Program changes (0xC0-0xCF) | |
#define | PM_FILT_CONTROL (1 << 0x1B) |
Control Changes (CC's) (0xB0-0xBF) | |
#define | PM_FILT_PITCHBEND (1 << 0x1E) |
Pitch Bender (0xE0-0xEF. | |
#define | PM_FILT_MTC (1 << 0x01) |
MIDI Time Code (0xF1) | |
#define | PM_FILT_SONG_POSITION (1 << 0x02) |
Song Position (0xF2) | |
#define | PM_FILT_SONG_SELECT (1 << 0x03) |
Song Select (0xF3) | |
#define | PM_FILT_TUNE (1 << 0x06) |
Tuning request (0xF6) | |
#define | PM_FILT_SYSTEMCOMMON (PM_FILT_MTC | PM_FILT_SONG_POSITION | PM_FILT_SONG_SELECT | PM_FILT_TUNE) |
All System Common messages (mtc, song position, song select, tune request) | |
#define | Pm_Channel(channel) (1<<(channel)) |
#define | Pm_Message(status, data1, data2) |
Pm_Message() encodes a short Midi message into a 32-bit word. | |
#define | Pm_MessageStatus(msg) ((msg) & 0xFF) |
#define | Pm_MessageData1(msg) (((msg) >> 8) & 0xFF) |
#define | Pm_MessageData2(msg) (((msg) >> 16) & 0xFF) |
Typedefs | |
typedef int32_t | PmMessage |
see PmEvent | |
Functions | |
PMEXPORT PmError | Pm_SetFilter (PortMidiStream *stream, int32_t filters) |
PMEXPORT PmError | Pm_SetChannelMask (PortMidiStream *stream, int mask) |
Pm_SetChannelMask() filters incoming messages based on channel. | |
PMEXPORT PmError | Pm_Abort (PortMidiStream *stream) |
Pm_Abort() terminates outgoing messages immediately The caller should immediately close the output port; this call may result in transmission of a partial midi message. | |
PMEXPORT PmError | Pm_Close (PortMidiStream *stream) |
Pm_Close() closes a midi stream, flushing any pending buffers. | |
PmError | Pm_Synchronize (PortMidiStream *stream) |
Pm_Synchronize() instructs PortMidi to (re)synchronize to the time_proc passed when the stream was opened. | |
#define Pm_Channel | ( | channel | ) | (1<<(channel)) |
Definition at line 435 of file portmidi.h.
#define PM_FILT_ACTIVE (1 << 0x0E) |
filter active sensing messages (0xFE):
Definition at line 389 of file portmidi.h.
Referenced by Pm_OpenInput().
#define PM_FILT_AFTERTOUCH (PM_FILT_CHANNEL_AFTERTOUCH | PM_FILT_POLY_AFTERTOUCH) |
filter both channel and poly aftertouch
Definition at line 414 of file portmidi.h.
#define PM_FILT_CHANNEL_AFTERTOUCH (1 << 0x1D) |
filter channel aftertouch (most midi controllers use this) (0xD0-0xDF)
Definition at line 410 of file portmidi.h.
#define PM_FILT_CLOCK (1 << 0x08) |
filter MIDI clock message (0xF8)
Definition at line 393 of file portmidi.h.
#define PM_FILT_CONTROL (1 << 0x1B) |
Control Changes (CC's) (0xB0-0xBF)
Definition at line 418 of file portmidi.h.
#define PM_FILT_FD (1 << 0x0D) |
filter undefined FD messages
Definition at line 399 of file portmidi.h.
#define PM_FILT_MTC (1 << 0x01) |
MIDI Time Code (0xF1)
Definition at line 422 of file portmidi.h.
#define PM_FILT_NOTE ((1 << 0x19) | (1 << 0x18)) |
filter note-on and note-off (0x90-0x9F and 0x80-0x8F
Definition at line 408 of file portmidi.h.
#define PM_FILT_PITCHBEND (1 << 0x1E) |
Pitch Bender (0xE0-0xEF.
Definition at line 420 of file portmidi.h.
#define PM_FILT_PLAY ((1 << 0x0A) | (1 << 0x0C) | (1 << 0x0B)) |
filter play messages (start 0xFA, stop 0xFC, continue 0xFB)
Definition at line 395 of file portmidi.h.
#define PM_FILT_POLY_AFTERTOUCH (1 << 0x1A) |
per-note aftertouch (0xA0-0xAF)
Definition at line 412 of file portmidi.h.
#define PM_FILT_PROGRAM (1 << 0x1C) |
Program changes (0xC0-0xCF)
Definition at line 416 of file portmidi.h.
#define PM_FILT_REALTIME |
filter all real-time messages
Definition at line 405 of file portmidi.h.
#define PM_FILT_RESET (1 << 0x0F) |
filter reset messages (0xFF)
Definition at line 403 of file portmidi.h.
#define PM_FILT_SONG_POSITION (1 << 0x02) |
Song Position (0xF2)
Definition at line 424 of file portmidi.h.
#define PM_FILT_SONG_SELECT (1 << 0x03) |
Song Select (0xF3)
Definition at line 426 of file portmidi.h.
#define PM_FILT_SYSEX (1 << 0x00) |
filter system exclusive messages (0xF0):
Definition at line 391 of file portmidi.h.
#define PM_FILT_SYSTEMCOMMON (PM_FILT_MTC | PM_FILT_SONG_POSITION | PM_FILT_SONG_SELECT | PM_FILT_TUNE) |
All System Common messages (mtc, song position, song select, tune request)
Definition at line 430 of file portmidi.h.
#define PM_FILT_TICK (1 << 0x09) |
filter tick messages (0xF9)
Definition at line 397 of file portmidi.h.
#define PM_FILT_TUNE (1 << 0x06) |
Tuning request (0xF6)
Definition at line 428 of file portmidi.h.
#define PM_FILT_UNDEFINED PM_FILT_FD |
filter undefined real-time messages
Definition at line 401 of file portmidi.h.
#define Pm_Message | ( | status, | |
data1, | |||
data2 ) |
Pm_Message() encodes a short Midi message into a 32-bit word.
If data1 and/or data2 are not present, use zero.
Pm_MessageStatus(), Pm_MessageData1(), and Pm_MessageData2() extract fields from a 32-bit midi message.
Definition at line 503 of file portmidi.h.
#define Pm_MessageData1 | ( | msg | ) | (((msg) >> 8) & 0xFF) |
Definition at line 508 of file portmidi.h.
#define Pm_MessageData2 | ( | msg | ) | (((msg) >> 16) & 0xFF) |
Definition at line 509 of file portmidi.h.
#define Pm_MessageStatus | ( | msg | ) | ((msg) & 0xFF) |
Definition at line 507 of file portmidi.h.
typedef int32_t PmMessage |
see PmEvent
Definition at line 511 of file portmidi.h.
PMEXPORT PmError Pm_Abort | ( | PortMidiStream * | stream | ) |
Pm_Abort() terminates outgoing messages immediately The caller should immediately close the output port; this call may result in transmission of a partial midi message.
There is no abort for Midi input because the user can simply ignore messages in the buffer and close an input device at any time.
Definition at line 906 of file portmidi.c.
PMEXPORT PmError Pm_Close | ( | PortMidiStream * | stream | ) |
Pm_Close() closes a midi stream, flushing any pending buffers.
(PortMidi attempts to close open streams when the application exits – this is particularly difficult under Windows.)
Definition at line 860 of file portmidi.c.
PMEXPORT PmError Pm_SetChannelMask | ( | PortMidiStream * | stream, |
int | mask ) |
Pm_SetChannelMask() filters incoming messages based on channel.
The mask is a 16-bit bitfield corresponding to appropriate channels. The Pm_Channel macro can assist in calling this function. i.e. to set receive only input on channel 1, call with Pm_SetChannelMask(Pm_Channel(1)); Multiple channels should be OR'd together, like Pm_SetChannelMask(Pm_Channel(10) | Pm_Channel(11))
Note that channels are numbered 0 to 15 (not 1 to 16). Most synthesizer and interfaces number channels starting at 1, but PortMidi numbers channels starting at 0.
All channels are allowed by default
Definition at line 831 of file portmidi.c.
PMEXPORT PmError Pm_SetFilter | ( | PortMidiStream * | stream, |
int32_t | filters ) |
Definition at line 845 of file portmidi.c.
PmError Pm_Synchronize | ( | PortMidiStream * | stream | ) |
Pm_Synchronize() instructs PortMidi to (re)synchronize to the time_proc passed when the stream was opened.
Typically, this is used when the stream must be opened before the time_proc reference is actually advancing. In this case, message timing may be erratic, but since timestamps of zero mean "send immediately," initialization messages with zero timestamps can be written without a functioning time reference and without problems. Before the first MIDI message with a non-zero timestamp is written to the stream, the time reference must begin to advance (for example, if the time_proc computes time based on audio samples, time might begin to advance when an audio stream becomes active). After time_proc return values become valid, and BEFORE writing the first non-zero timestamped MIDI message, call Pm_Synchronize() so that PortMidi can observe the difference between the current time_proc value and its MIDI stream time.
In the more normal case where time_proc values advance continuously, there is no need to call Pm_Synchronize. PortMidi will always synchronize at the first output message and periodically thereafter.
Definition at line 892 of file portmidi.c.