84 #define PMEXPORT __declspec(dllexport)
97 #define PM_DEFAULT_SYSEX_BUFFER_SIZE 1024
107 pmHostError = -10000,
113 pmInsufficientMemory,
171 #define PmStream PortMidiStream
199 #define PM_HOST_ERROR_MSG_LEN 256u
212 #define pmNoDevice -1
217 #define PM_DEVICEINFO_VERS 200
334 typedef PmTimestamp (*PmTimeProcPtr)(
void *time_info);
337 #define PmBefore(t1,t2) ((t1-t2) < 0)
396 PmDeviceID inputDevice,
397 void *inputDriverInfo,
399 PmTimeProcPtr time_proc,
497 PmDeviceID outputDevice,
498 void *outputDriverInfo,
500 PmTimeProcPtr time_proc,
588 #define PM_FILT_ACTIVE (1 << 0x0E)
590 #define PM_FILT_SYSEX (1 << 0x00)
592 #define PM_FILT_CLOCK (1 << 0x08)
594 #define PM_FILT_PLAY ((1 << 0x0A) | (1 << 0x0C) | (1 << 0x0B))
596 #define PM_FILT_TICK (1 << 0x09)
598 #define PM_FILT_FD (1 << 0x0D)
600 #define PM_FILT_UNDEFINED PM_FILT_FD
602 #define PM_FILT_RESET (1 << 0x0F)
604 #define PM_FILT_REALTIME (PM_FILT_ACTIVE | PM_FILT_SYSEX | PM_FILT_CLOCK | \
605 PM_FILT_PLAY | PM_FILT_UNDEFINED | PM_FILT_RESET | PM_FILT_TICK)
607 #define PM_FILT_NOTE ((1 << 0x19) | (1 << 0x18))
609 #define PM_FILT_CHANNEL_AFTERTOUCH (1 << 0x1D)
611 #define PM_FILT_POLY_AFTERTOUCH (1 << 0x1A)
613 #define PM_FILT_AFTERTOUCH (PM_FILT_CHANNEL_AFTERTOUCH | \
614 PM_FILT_POLY_AFTERTOUCH)
616 #define PM_FILT_PROGRAM (1 << 0x1C)
618 #define PM_FILT_CONTROL (1 << 0x1B)
620 #define PM_FILT_PITCHBEND (1 << 0x1E)
622 #define PM_FILT_MTC (1 << 0x01)
624 #define PM_FILT_SONG_POSITION (1 << 0x02)
626 #define PM_FILT_SONG_SELECT (1 << 0x03)
628 #define PM_FILT_TUNE (1 << 0x06)
630 #define PM_FILT_SYSTEMCOMMON (PM_FILT_MTC | PM_FILT_SONG_POSITION | \
631 PM_FILT_SONG_SELECT | PM_FILT_TUNE)
653 PMEXPORT
PmError Pm_SetFilter(PortMidiStream* stream, int32_t filters);
656 #define Pm_Channel(channel) (1<<(channel))
746 #define Pm_Message(status, data1, data2) \
747 ((((data2) << 16) & 0xFF0000) | \
748 (((data1) << 8) & 0xFF00) | \
751 #define Pm_MessageStatus(msg) ((msg) & 0xFF)
753 #define Pm_MessageData1(msg) (((msg) >> 8) & 0xFF)
755 #define Pm_MessageData2(msg) (((msg) >> 16) & 0xFF)
830 PmTimestamp timestamp;
866 PMEXPORT
int Pm_Read(PortMidiStream *stream,
PmEvent *buffer, int32_t length);
void PortMidiStream
Represents an open MIDI device.
Definition: portmidi.h:168
Buffer is already as large as it can be.
Definition: portmidi.h:122
PMEXPORT PmError Pm_Write(PortMidiStream *stream, PmEvent *buffer, int32_t length)
Write MIDI data from a buffer.
Definition: portmidi.c:619
PMEXPORT PmDeviceID Pm_GetDefaultOutputDeviceID(void)
see PmDeviceID Pm_GetDefaultInputDeviceID()
Out of range or output device when input is requested or input device when output is requested or dev...
Definition: portmidi.h:108
Normal return value indicating no error.
Definition: portmidi.h:101
PmError
PortMidi error code; a common return type.
Definition: portmidi.h:100
PMEXPORT PmError Pm_Terminate(void)
Pm_Terminate() is the library termination function - call this after using the library.
Definition: portmidi.c:511
The function is not implemented, nothing was done.
Definition: portmidi.h:123
PMEXPORT int Pm_HasHostError(PortMidiStream *stream)
Test whether stream has a pending host error.
Definition: portmidi.c:486
PMEXPORT PmError Pm_SetChannelMask(PortMidiStream *stream, int mask)
Filter incoming messages based on channel.
Definition: portmidi.c:1089
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:905
PMEXPORT PmError Pm_CreateVirtualInput(const char *name, const char *interf, void *deviceInfo)
Create a virtual input device.
Definition: portmidi.c:1051
PMEXPORT PmDeviceID Pm_GetDefaultInputDeviceID(void)
Return the default device ID or pmNoDevice if there are no devices.
PMEXPORT PmError Pm_CreateVirtualOutput(const char *name, const char *interf, void *deviceInfo)
Create a virtual output device.
Definition: portmidi.c:1058
const char * interf
underlying MIDI API, e.g.
Definition: portmidi.h:220
PMEXPORT int Pm_Read(PortMidiStream *stream, PmEvent *buffer, int32_t length)
Retrieve midi data into a buffer.
Definition: portmidi.c:539
PMEXPORT PmError Pm_WriteSysEx(PortMidiStream *stream, PmTimestamp when, unsigned char *msg)
Write a timestamped system-exclusive midi message.
Definition: portmidi.c:762
char * name
device name, e.g.
Definition: portmidi.h:222
No error, also indicates no data available.
Definition: portmidi.h:102
PMEXPORT void Pm_GetHostErrorText(char *msg, unsigned int len)
Translate portmidi host error into human readable message.
Definition: portmidi.c:469
int opened
used by generic PortMidi for error checking
Definition: portmidi.h:225
Definition: portmidi.h:218
PMEXPORT PmError Pm_Close(PortMidiStream *stream)
Close a midi stream, flush any pending buffers if possible.
Definition: portmidi.c:1119
A "no error" return also indicating data available.
Definition: portmidi.h:106
PMEXPORT const PmDeviceInfo * Pm_GetDeviceInfo(PmDeviceID id)
Get a PmDeviceInfo structure describing a MIDI device.
Definition: portmidi.c:333
PMEXPORT const char * Pm_GetErrorText(PmError errnum)
Translate portmidi error number into human readable message.
Definition: portmidi.c:412
The requested interface is not supported.
Definition: portmidi.h:124
int output
true iff output is available
Definition: portmidi.h:224
All MIDI data comes in the form of PmEvent structures.
Definition: portmidi.h:828
int32_t PmTimestamp
Represents a millisecond clock with arbitrary start time.
Definition: portmidi.h:333
int is_virtual
true iff this is/was a virtual device
Definition: portmidi.h:226
int PmDeviceID
Devices are represented as small integers.
Definition: portmidi.h:206
uint32_t PmMessage
see PmEvent
Definition: portmidi.h:757
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:954
PMEXPORT PmError Pm_Initialize(void)
Pm_Initialize() is the library initialization function - call this before using the library...
Definition: portmidi.c:497
PMEXPORT PmError Pm_WriteShort(PortMidiStream *stream, PmTimestamp when, PmMessage msg)
Write a timestamped non-system-exclusive midi message.
Definition: portmidi.c:751
PMEXPORT int Pm_CountDevices(void)
Get devices count, ids range from 0 to Pm_CountDevices()-1.
Definition: portmidi.c:325
PMEXPORT PmError Pm_Synchronize(PortMidiStream *stream)
(re)synchronize to the time_proc passed when the stream was opened.
Definition: portmidi.c:1152
Illegal midi data, e.g., missing EOX.
Definition: portmidi.h:120
PMEXPORT PmError Pm_Abort(PortMidiStream *stream)
Terminate outgoing messages immediately.
Definition: portmidi.c:1167
PMEXPORT PmError Pm_DeleteVirtualDevice(PmDeviceID device)
Remove a virtual device.
Definition: portmidi.c:1064
Cannot create virtual device because name is taken.
Definition: portmidi.h:125
int structVersion
this internal structure version
Definition: portmidi.h:219
PMEXPORT PmError Pm_Poll(PortMidiStream *stream)
Test whether input is available.
Definition: portmidi.c:579
int input
true iff input is available
Definition: portmidi.h:223
PortMidiStream parameter is NULL or stream is not opened or stream is output when input is required o...
Definition: portmidi.h:116