84#define PMEXPORT __declspec(dllexport)
97#define PM_DEFAULT_SYSEX_BUFFER_SIZE 1024
107 pmHostError = -10000,
113 pmInsufficientMemory,
154#define PmStream PortMidiStream
182#define PM_HOST_ERROR_MSG_LEN 256u
200#define PM_DEVICEINFO_VERS 200
317typedef PmTimestamp (*PmTimeProcPtr)(
void *time_info);
320#define PmBefore(t1,t2) ((t1-t2) < 0)
380 void *inputDriverInfo,
382 PmTimeProcPtr time_proc,
481 void *outputDriverInfo,
483 PmTimeProcPtr time_proc,
571#define PM_FILT_ACTIVE (1 << 0x0E)
573#define PM_FILT_SYSEX (1 << 0x00)
575#define PM_FILT_CLOCK (1 << 0x08)
577#define PM_FILT_PLAY ((1 << 0x0A) | (1 << 0x0C) | (1 << 0x0B))
579#define PM_FILT_TICK (1 << 0x09)
581#define PM_FILT_FD (1 << 0x0D)
583#define PM_FILT_UNDEFINED PM_FILT_FD
585#define PM_FILT_RESET (1 << 0x0F)
587#define PM_FILT_REALTIME (PM_FILT_ACTIVE | PM_FILT_SYSEX | PM_FILT_CLOCK | \
588 PM_FILT_PLAY | PM_FILT_UNDEFINED | PM_FILT_RESET | PM_FILT_TICK)
590#define PM_FILT_NOTE ((1 << 0x19) | (1 << 0x18))
592#define PM_FILT_CHANNEL_AFTERTOUCH (1 << 0x1D)
594#define PM_FILT_POLY_AFTERTOUCH (1 << 0x1A)
596#define PM_FILT_AFTERTOUCH (PM_FILT_CHANNEL_AFTERTOUCH | \
597 PM_FILT_POLY_AFTERTOUCH)
599#define PM_FILT_PROGRAM (1 << 0x1C)
601#define PM_FILT_CONTROL (1 << 0x1B)
603#define PM_FILT_PITCHBEND (1 << 0x1E)
605#define PM_FILT_MTC (1 << 0x01)
607#define PM_FILT_SONG_POSITION (1 << 0x02)
609#define PM_FILT_SONG_SELECT (1 << 0x03)
611#define PM_FILT_TUNE (1 << 0x06)
613#define PM_FILT_SYSTEMCOMMON (PM_FILT_MTC | PM_FILT_SONG_POSITION | \
614 PM_FILT_SONG_SELECT | PM_FILT_TUNE)
639#define Pm_Channel(channel) (1<<(channel))
729#define Pm_Message(status, data1, data2) \
730 ((((data2) << 16) & 0xFF0000) | \
731 (((data1) << 8) & 0xFF00) | \
734#define Pm_MessageStatus(msg) ((msg) & 0xFF)
736#define Pm_MessageData1(msg) (((msg) >> 8) & 0xFF)
738#define Pm_MessageData2(msg) (((msg) >> 16) & 0xFF)
PMEXPORT const char * Pm_GetErrorText(PmError errnum)
Translate portmidi error number into human readable message.
Definition: portmidi.c:402
PMEXPORT PmError Pm_Initialize(void)
Pm_Initialize() is the library initialization function - call this before using the library.
Definition: portmidi.c:487
PMEXPORT PmDeviceID Pm_GetDefaultOutputDeviceID(void)
see PmDeviceID Pm_GetDefaultInputDeviceID()
PmError
PortMidi error code; a common return type.
Definition: portmidi.h:100
int PmDeviceID
Devices are represented as small integers.
Definition: portmidi.h:189
PMEXPORT PmError Pm_Terminate(void)
Pm_Terminate() is the library termination function - call this after using the library.
Definition: portmidi.c:501
PMEXPORT int Pm_CountDevices(void)
Get devices count, ids range from 0 to Pm_CountDevices()-1.
Definition: portmidi.c:315
PMEXPORT int Pm_HasHostError(PortMidiStream *stream)
Test whether stream has a pending host error.
Definition: portmidi.c:476
int32_t PmTimestamp
Represents a millisecond clock with arbitrary start time.
Definition: portmidi.h:316
PMEXPORT void Pm_GetHostErrorText(char *msg, unsigned int len)
Translate portmidi host error into human readable message.
Definition: portmidi.c:459
PMEXPORT PmDeviceID Pm_GetDefaultInputDeviceID(void)
Return the default device ID or pmNoDevice if there are no devices.
void PortMidiStream
Represents an open MIDI device.
Definition: portmidi.h:151
@ pmInterfaceNotSupported
The requested interface is not supported.
Definition: portmidi.h:124
@ pmNotImplemented
The function is not implemented, nothing was done.
Definition: portmidi.h:123
@ pmNameConflict
Cannot create virtual device because name is taken.
Definition: portmidi.h:125
@ pmGotData
A "no error" return also indicating data available.
Definition: portmidi.h:106
@ pmInvalidDeviceId
Out of range or output device when input is requested or input device when output is requested or dev...
Definition: portmidi.h:108
@ pmNoData
No error, also indicates no data available.
Definition: portmidi.h:102
@ pmNoError
Normal return value indicating no error.
Definition: portmidi.h:101
@ pmBufferMaxSize
Buffer is already as large as it can be.
Definition: portmidi.h:122
@ pmBadPtr
PortMidiStream parameter is NULL or stream is not opened or stream is output when input is required o...
Definition: portmidi.h:116
@ pmBadData
Illegal midi data, e.g., missing EOX.
Definition: portmidi.h:120
PMEXPORT PmError Pm_OpenOutput(PortMidiStream **stream, PmDeviceID outputDevice, void *outputDriverInfo, int32_t bufferSize, PmTimeProcPtr time_proc, void *time_info, int32_t latency)
Open a MIDI device for output.
Definition: portmidi.c:943
PMEXPORT const PmDeviceInfo * Pm_GetDeviceInfo(PmDeviceID id)
Get a PmDeviceInfo structure describing a MIDI device.
Definition: portmidi.c:323
PMEXPORT PmError Pm_OpenInput(PortMidiStream **stream, PmDeviceID inputDevice, void *inputDriverInfo, int32_t bufferSize, PmTimeProcPtr time_proc, void *time_info)
Open a MIDI device for input.
Definition: portmidi.c:894
PMEXPORT PmError Pm_CreateVirtualOutput(const char *name, const char *interf, void *deviceInfo)
Create a virtual output device.
Definition: portmidi.c:1047
PMEXPORT PmError Pm_DeleteVirtualDevice(PmDeviceID device)
Remove a virtual device.
Definition: portmidi.c:1053
PMEXPORT PmError Pm_CreateVirtualInput(const char *name, const char *interf, void *deviceInfo)
Create a virtual input device.
Definition: portmidi.c:1040
PMEXPORT PmError Pm_Close(PortMidiStream *stream)
Close a midi stream, flush any pending buffers if possible.
Definition: portmidi.c:1108
PMEXPORT PmError Pm_SetChannelMask(PortMidiStream *stream, int mask)
Filter incoming messages based on channel.
Definition: portmidi.c:1078
PMEXPORT PmError Pm_Abort(PortMidiStream *stream)
Terminate outgoing messages immediately.
Definition: portmidi.c:1156
PMEXPORT PmError Pm_Synchronize(PortMidiStream *stream)
(re)synchronize to the time_proc passed when the stream was opened.
Definition: portmidi.c:1141
int32_t PmMessage
see PmEvent
Definition: portmidi.h:740
PMEXPORT int Pm_Read(PortMidiStream *stream, PmEvent *buffer, int32_t length)
Retrieve midi data into a buffer.
Definition: portmidi.c:529
PMEXPORT PmError Pm_WriteSysEx(PortMidiStream *stream, PmTimestamp when, unsigned char *msg)
Write a timestamped system-exclusive midi message.
Definition: portmidi.c:752
PMEXPORT PmError Pm_Poll(PortMidiStream *stream)
Test whether input is available.
Definition: portmidi.c:569
PMEXPORT PmError Pm_WriteShort(PortMidiStream *stream, PmTimestamp when, PmMessage msg)
Write a timestamped non-system-exclusive midi message.
Definition: portmidi.c:741
PMEXPORT PmError Pm_Write(PortMidiStream *stream, PmEvent *buffer, int32_t length)
Write MIDI data from a buffer.
Definition: portmidi.c:609
Definition: portmidi.h:201
int structVersion
this internal structure version
Definition: portmidi.h:202
const char * interf
underlying MIDI API, e.g.
Definition: portmidi.h:203
char * name
device name, e.g.
Definition: portmidi.h:205
int output
true iff output is available
Definition: portmidi.h:207
int is_virtual
true iff this is/was a virtual device
Definition: portmidi.h:209
int input
true iff input is available
Definition: portmidi.h:206
int opened
used by generic PortMidi for error checking
Definition: portmidi.h:208
All midi data comes in the form of PmEvent structures.
Definition: portmidi.h:806