104 typedef unsigned int uint32_t;
105 #define INT32_DEFINED 110 #define PMEXPORT __declspec(dllexport) 123 #define PM_DEFAULT_SYSEX_BUFFER_SIZE 1024 130 pmHostError = -10000,
136 pmInsufficientMemory,
153 PMEXPORT PmError Pm_Initialize(
void );
159 PMEXPORT PmError Pm_Terminate(
void );
163 typedef void PortMidiStream;
164 #define PmStream PortMidiStream 180 PMEXPORT
int Pm_HasHostError( PortMidiStream * stream );
187 PMEXPORT
const char *Pm_GetErrorText( PmError errnum );
193 PMEXPORT
void Pm_GetHostErrorText(
char * msg,
unsigned int len);
196 #define PM_HOST_ERROR_MSG_LEN 256u 205 typedef int PmDeviceID;
206 #define pmNoDevice -1 218 PMEXPORT
int Pm_CountDevices(
void );
261 PMEXPORT PmDeviceID Pm_GetDefaultInputDeviceID(
void );
263 PMEXPORT PmDeviceID Pm_GetDefaultOutputDeviceID(
void );
269 typedef int32_t PmTimestamp;
270 typedef PmTimestamp (*PmTimeProcPtr)(
void *time_info);
273 #define PmBefore(t1,t2) ((t1-t2) < 0) 354 PmDeviceID inputDevice,
355 void *inputDriverInfo,
357 PmTimeProcPtr time_proc,
360 PMEXPORT PmError Pm_OpenOutput( PortMidiStream** stream,
361 PmDeviceID outputDevice,
362 void *outputDriverInfo,
364 PmTimeProcPtr time_proc,
390 #define PM_FILT_ACTIVE (1 << 0x0E) 392 #define PM_FILT_SYSEX (1 << 0x00) 394 #define PM_FILT_CLOCK (1 << 0x08) 396 #define PM_FILT_PLAY ((1 << 0x0A) | (1 << 0x0C) | (1 << 0x0B)) 398 #define PM_FILT_TICK (1 << 0x09) 400 #define PM_FILT_FD (1 << 0x0D) 402 #define PM_FILT_UNDEFINED PM_FILT_FD 404 #define PM_FILT_RESET (1 << 0x0F) 406 #define PM_FILT_REALTIME (PM_FILT_ACTIVE | PM_FILT_SYSEX | PM_FILT_CLOCK | \ 407 PM_FILT_PLAY | PM_FILT_UNDEFINED | PM_FILT_RESET | PM_FILT_TICK) 409 #define PM_FILT_NOTE ((1 << 0x19) | (1 << 0x18)) 411 #define PM_FILT_CHANNEL_AFTERTOUCH (1 << 0x1D) 413 #define PM_FILT_POLY_AFTERTOUCH (1 << 0x1A) 415 #define PM_FILT_AFTERTOUCH (PM_FILT_CHANNEL_AFTERTOUCH | PM_FILT_POLY_AFTERTOUCH) 417 #define PM_FILT_PROGRAM (1 << 0x1C) 419 #define PM_FILT_CONTROL (1 << 0x1B) 421 #define PM_FILT_PITCHBEND (1 << 0x1E) 423 #define PM_FILT_MTC (1 << 0x01) 425 #define PM_FILT_SONG_POSITION (1 << 0x02) 427 #define PM_FILT_SONG_SELECT (1 << 0x03) 429 #define PM_FILT_TUNE (1 << 0x06) 431 #define PM_FILT_SYSTEMCOMMON (PM_FILT_MTC | PM_FILT_SONG_POSITION | PM_FILT_SONG_SELECT | PM_FILT_TUNE) 434 PMEXPORT PmError Pm_SetFilter( PortMidiStream* stream, int32_t filters );
436 #define Pm_Channel(channel) (1<<(channel)) 462 PMEXPORT PmError
Pm_Abort( PortMidiStream* stream );
469 PMEXPORT PmError
Pm_Close( PortMidiStream* stream );
504 #define Pm_Message(status, data1, data2) \ 505 ((((data2) << 16) & 0xFF0000) | \ 506 (((data1) << 8) & 0xFF00) | \ 508 #define Pm_MessageStatus(msg) ((msg) & 0xFF) 509 #define Pm_MessageData1(msg) (((msg) >> 8) & 0xFF) 510 #define Pm_MessageData2(msg) (((msg) >> 16) & 0xFF) 580 PmTimestamp timestamp;
613 PMEXPORT
int Pm_Read( PortMidiStream *stream,
PmEvent *buffer, int32_t length );
619 PMEXPORT PmError
Pm_Poll( PortMidiStream *stream);
634 PMEXPORT PmError
Pm_Write( PortMidiStream *stream,
PmEvent *buffer, int32_t length );
642 PMEXPORT PmError
Pm_WriteShort( PortMidiStream *stream, PmTimestamp when, int32_t msg);
647 PMEXPORT PmError
Pm_WriteSysEx( PortMidiStream *stream, PmTimestamp when,
unsigned char *msg);
PMEXPORT PmError Pm_Write(PortMidiStream *stream, PmEvent *buffer, int32_t length)
Pm_Write() writes midi data from a buffer.
PMEXPORT PmError Pm_SetChannelMask(PortMidiStream *stream, int mask)
Pm_SetChannelMask() filters incoming messages based on channel.
PMEXPORT PmError Pm_OpenInput(PortMidiStream **stream, PmDeviceID inputDevice, void *inputDriverInfo, int32_t bufferSize, PmTimeProcPtr time_proc, void *time_info)
Pm_OpenInput() and Pm_OpenOutput() open devices.
int32_t PmMessage
see PmEvent
const char * interf
underlying MIDI API, e.g.
int opened
used by generic PortMidi code to do error checking on arguments
PMEXPORT int Pm_Read(PortMidiStream *stream, PmEvent *buffer, int32_t length)
Pm_Read() retrieves midi data into a buffer, and returns the number of events read.
PMEXPORT PmError Pm_WriteSysEx(PortMidiStream *stream, PmTimestamp when, unsigned char *msg)
Pm_WriteSysEx() writes a timestamped system-exclusive midi message.
int input
true iff input is available
PMEXPORT PmError Pm_WriteShort(PortMidiStream *stream, PmTimestamp when, int32_t msg)
Pm_WriteShort() writes a timestamped non-system-exclusive midi message.
PMEXPORT PmError Pm_Close(PortMidiStream *stream)
Pm_Close() closes a midi stream, flushing any pending buffers.
int structVersion
this internal structure version
const char * name
device name, e.g.
All midi data comes in the form of PmEvent structures.
PMEXPORT const PmDeviceInfo * Pm_GetDeviceInfo(PmDeviceID id)
Pm_GetDeviceInfo() returns a pointer to a PmDeviceInfo structure referring to the device specified by...
PmError Pm_Synchronize(PortMidiStream *stream)
Pm_Synchronize() instructs PortMidi to (re)synchronize to the time_proc passed when the stream was op...
int output
true iff output is available
PMEXPORT PmError Pm_Abort(PortMidiStream *stream)
Pm_Abort() terminates outgoing messages immediately The caller should immediately close the output po...
PMEXPORT PmError Pm_Poll(PortMidiStream *stream)
Pm_Poll() tests whether input is available, returning TRUE, FALSE, or an error value.