Events and Filters Handling


Data Structures

struct  PmEvent
 All midi data comes in the form of PmEvent structures. More...

Defines

#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 long word.
#define Pm_MessageStatus(msg)   ((msg) & 0xFF)
#define Pm_MessageData1(msg)   (((msg) >> 8) & 0xFF)
#define Pm_MessageData2(msg)   (((msg) >> 16) & 0xFF)

Typedefs

typedef long PmMessage
 see PmEvent

Functions

PmError Pm_SetFilter (PortMidiStream *stream, long filters)
PmError Pm_SetChannelMask (PortMidiStream *stream, int mask)
 Pm_SetChannelMask() filters incoming messages based on channel.
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.
PmError Pm_Close (PortMidiStream *stream)
 Pm_Close() closes a midi stream, flushing any pending buffers.

Define Documentation

#define PM_FILT_REALTIME

Value:

filter all real-time messages

Definition at line 386 of file portmidi.h.

#define Pm_Message ( status,
data1,
data2   ) 

Value:

((((data2) << 16) & 0xFF0000) | \
          (((data1) << 8) & 0xFF00) | \
          ((status) & 0xFF))
Pm_Message() encodes a short Midi message into a long word.

If data1 and/or data2 are not present, use zero.

Pm_MessageStatus(), Pm_MessageData1(), and Pm_MessageData2() extract fields from a long-encoded midi message.

Definition at line 454 of file portmidi.h.


Function Documentation

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 888 of file portmidi.c.

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 855 of file portmidi.c.

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

All channels are allowed by default

Definition at line 826 of file portmidi.c.


Generated on Fri Jan 2 15:04:05 2009 for PortMidi by  doxygen 1.5.7