Tutorial Class/Enum List File List Compound Members C interface

rtmidi_c.h
Go to the documentation of this file.
1 /************************************************************************/
13 /************************************************************************/
14
19 #include <stdbool.h>
20 #include <stddef.h>
21 #ifndef RTMIDI_C_H
22 #define RTMIDI_C_H
23
24 #if defined(RTMIDI_EXPORT)
25 #if defined _WIN32 || defined __CYGWIN__
26 #define RTMIDIAPI __declspec(dllexport)
27 #else
28 #define RTMIDIAPI __attribute__((visibility("default")))
29 #endif
30 #else
31 #define RTMIDIAPI //__declspec(dllimport)
32 #endif
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
39 struct RtMidiWrapper {
41 void* ptr;
42 void* data;
43
45 bool ok;
46
48 const char* msg;
49 };
50
52 typedef struct RtMidiWrapper* RtMidiPtr;
53
55 typedef struct RtMidiWrapper* RtMidiInPtr;
56
58 typedef struct RtMidiWrapper* RtMidiOutPtr;
59
61 enum RtMidiApi {
62 RTMIDI_API_UNSPECIFIED,
63 RTMIDI_API_MACOSX_CORE,
64 RTMIDI_API_LINUX_ALSA,
65 RTMIDI_API_UNIX_JACK,
66 RTMIDI_API_WINDOWS_MM,
67 RTMIDI_API_RTMIDI_DUMMY,
68 RTMIDI_API_NUM
69 };
70
72 enum RtMidiErrorType {
73 RTMIDI_ERROR_WARNING,
74 RTMIDI_ERROR_DEBUG_WARNING,
75 RTMIDI_ERROR_UNSPECIFIED,
76 RTMIDI_ERROR_NO_DEVICES_FOUND,
77 RTMIDI_ERROR_INVALID_DEVICE,
78 RTMIDI_ERROR_MEMORY_ERROR,
79 RTMIDI_ERROR_INVALID_PARAMETER,
80 RTMIDI_ERROR_INVALID_USE,
81 RTMIDI_ERROR_DRIVER_ERROR,
82 RTMIDI_ERROR_SYSTEM_ERROR,
83 RTMIDI_ERROR_THREAD_ERROR
84 };
85
94 typedef void(* RtMidiCCallback) (double timeStamp, const unsigned char* message,
95 size_t messageSize, void *userData);
96
97
98 /* RtMidi API */
99
113 RTMIDIAPI int rtmidi_get_compiled_api (enum RtMidiApi *apis, unsigned int apis_size);
114
117 RTMIDIAPI const char *rtmidi_api_name(enum RtMidiApi api);
118
121 RTMIDIAPI const char *rtmidi_api_display_name(enum RtMidiApi api);
122
125 RTMIDIAPI enum RtMidiApi rtmidi_compiled_api_by_name(const char *name);
126
128 RTMIDIAPI void rtmidi_error (enum RtMidiErrorType type, const char* errorString);
129
137 RTMIDIAPI void rtmidi_open_port (RtMidiPtr device, unsigned int portNumber, const char *portName);
138
146 RTMIDIAPI void rtmidi_open_virtual_port (RtMidiPtr device, const char *portName);
147
151 RTMIDIAPI void rtmidi_close_port (RtMidiPtr device);
152
156 RTMIDIAPI unsigned int rtmidi_get_port_count (RtMidiPtr device);
157
165 RTMIDIAPI int rtmidi_get_port_name (RtMidiPtr device, unsigned int portNumber, char * bufOut, int * bufLen);
166
167 /* RtMidiIn API */
168
170 RTMIDIAPI RtMidiInPtr rtmidi_in_create_default (void);
171
183 RTMIDIAPI RtMidiInPtr rtmidi_in_create (enum RtMidiApi api, const char *clientName, unsigned int queueSizeLimit);
184
186 RTMIDIAPI void rtmidi_in_free (RtMidiInPtr device);
187
190 RTMIDIAPI enum RtMidiApi rtmidi_in_get_current_api (RtMidiPtr device);
191
194 RTMIDIAPI void rtmidi_in_set_callback (RtMidiInPtr device, RtMidiCCallback callback, void *userData);
195
198 RTMIDIAPI void rtmidi_in_cancel_callback (RtMidiInPtr device);
199
202 RTMIDIAPI void rtmidi_in_ignore_types (RtMidiInPtr device, bool midiSysex, bool midiTime, bool midiSense);
203
216 RTMIDIAPI double rtmidi_in_get_message (RtMidiInPtr device, unsigned char *message, size_t *size);
217
218 /* RtMidiOut API */
219
221 RTMIDIAPI RtMidiOutPtr rtmidi_out_create_default (void);
222
232 RTMIDIAPI RtMidiOutPtr rtmidi_out_create (enum RtMidiApi api, const char *clientName);
233
235 RTMIDIAPI void rtmidi_out_free (RtMidiOutPtr device);
236
239 RTMIDIAPI enum RtMidiApi rtmidi_out_get_current_api (RtMidiPtr device);
240
243 RTMIDIAPI int rtmidi_out_send_message (RtMidiOutPtr device, const unsigned char *message, int length);
244
245
246 #ifdef __cplusplus
247 }
248 #endif
249 #endif
250
rtmidi_in_set_callback
RTMIDIAPI void rtmidi_in_set_callback(RtMidiInPtr device, RtMidiCCallback callback, void *userData)
Set a callback function to be invoked for incoming MIDI messages. See RtMidiIn::setCallback().
rtmidi_in_get_current_api
RTMIDIAPI enum RtMidiApi rtmidi_in_get_current_api(RtMidiPtr device)
Returns the MIDI API specifier for the given instance of RtMidiIn. See RtMidiIn::getCurrentApi().
RtMidiApi
RtMidiApi
MIDI API specifier arguments. See RtMidi::Api.
Definition: rtmidi_c.h:61
rtmidi_api_name
RTMIDIAPI const char * rtmidi_api_name(enum RtMidiApi api)
Return the name of a specified compiled MIDI API. See RtMidi::getApiName().
RtMidiWrapper::ptr
void * ptr
The wrapped RtMidi object.
Definition: rtmidi_c.h:41
RtMidiErrorType
RtMidiErrorType
Defined RtMidiError types. See RtMidiError::Type.
Definition: rtmidi_c.h:72
rtmidi_open_virtual_port
RTMIDIAPI void rtmidi_open_virtual_port(RtMidiPtr device, const char *portName)
Creates a virtual MIDI port to which other software applications can connect.
rtmidi_in_get_message
RTMIDIAPI double rtmidi_in_get_message(RtMidiInPtr device, unsigned char *message, size_t *size)
rtmidi_in_create_default
RTMIDIAPI RtMidiInPtr rtmidi_in_create_default(void)
Create a default RtMidiInPtr value, with no initialization.
rtmidi_close_port
RTMIDIAPI void rtmidi_close_port(RtMidiPtr device)
Close a MIDI connection. See RtMidi::closePort().
RtMidiWrapper::msg
const char * msg
If an error occured (ok != true), set to an error message.
Definition: rtmidi_c.h:48
rtmidi_in_ignore_types
RTMIDIAPI void rtmidi_in_ignore_types(RtMidiInPtr device, bool midiSysex, bool midiTime, bool midiSense)
Specify whether certain MIDI message types should be queued or ignored during input....
rtmidi_get_compiled_api
RTMIDIAPI int rtmidi_get_compiled_api(enum RtMidiApi *apis, unsigned int apis_size)
Determine the available compiled MIDI APIs.
rtmidi_out_create
RTMIDIAPI RtMidiOutPtr rtmidi_out_create(enum RtMidiApi api, const char *clientName)
Create a RtMidiOutPtr value, with given and clientName.
RtMidiWrapper::ok
bool ok
True when the last function call was OK.
Definition: rtmidi_c.h:45
rtmidi_in_cancel_callback
RTMIDIAPI void rtmidi_in_cancel_callback(RtMidiInPtr device)
Cancel use of the current callback function (if one exists). See RtMidiIn::cancelCallback().
rtmidi_open_port
RTMIDIAPI void rtmidi_open_port(RtMidiPtr device, unsigned int portNumber, const char *portName)
Open a MIDI port.
rtmidi_out_send_message
RTMIDIAPI int rtmidi_out_send_message(RtMidiOutPtr device, const unsigned char *message, int length)
Immediately send a single message out an open MIDI output port. See RtMidiOut::sendMessage().
rtmidi_out_free
RTMIDIAPI void rtmidi_out_free(RtMidiOutPtr device)
Free the given RtMidiOutPtr.
rtmidi_in_create
RTMIDIAPI RtMidiInPtr rtmidi_in_create(enum RtMidiApi api, const char *clientName, unsigned int queueSizeLimit)
Create a RtMidiInPtr value, with given api, clientName and queueSizeLimit.
rtmidi_in_free
RTMIDIAPI void rtmidi_in_free(RtMidiInPtr device)
Free the given RtMidiInPtr.
rtmidi_api_display_name
RTMIDIAPI const char * rtmidi_api_display_name(enum RtMidiApi api)
Return the display name of a specified compiled MIDI API. See RtMidi::getApiDisplayName().
RtMidiCCallback
void(* RtMidiCCallback)(double timeStamp, const unsigned char *message, size_t messageSize, void *userData)
The type of a RtMidi callback function.
Definition: rtmidi_c.h:94
rtmidi_get_port_count
RTMIDIAPI unsigned int rtmidi_get_port_count(RtMidiPtr device)
Return the number of available MIDI ports. See RtMidi::getPortCount().
rtmidi_out_get_current_api
RTMIDIAPI enum RtMidiApi rtmidi_out_get_current_api(RtMidiPtr device)
Returns the MIDI API specifier for the given instance of RtMidiOut. See RtMidiOut::getCurrentApi().
rtmidi_get_port_name
RTMIDIAPI int rtmidi_get_port_name(RtMidiPtr device, unsigned int portNumber, char *bufOut, int *bufLen)
Access a string identifier for the specified MIDI input port number.
rtmidi_compiled_api_by_name
RTMIDIAPI enum RtMidiApi rtmidi_compiled_api_by_name(const char *name)
Return the compiled MIDI API having the given name. See RtMidi::getCompiledApiByName().
rtmidi_out_create_default
RTMIDIAPI RtMidiOutPtr rtmidi_out_create_default(void)
Create a default RtMidiInPtr value, with no initialization.
RTMIDI_API_NUM
@ RTMIDI_API_NUM
Definition: rtmidi_c.h:68
RTMIDI_API_LINUX_ALSA
@ RTMIDI_API_LINUX_ALSA
Definition: rtmidi_c.h:64
RTMIDI_API_WINDOWS_MM
@ RTMIDI_API_WINDOWS_MM
Definition: rtmidi_c.h:66
RTMIDI_API_MACOSX_CORE
@ RTMIDI_API_MACOSX_CORE
Definition: rtmidi_c.h:63
RTMIDI_API_RTMIDI_DUMMY
@ RTMIDI_API_RTMIDI_DUMMY
Definition: rtmidi_c.h:67
RTMIDI_API_UNSPECIFIED
@ RTMIDI_API_UNSPECIFIED
Definition: rtmidi_c.h:62
RTMIDI_API_UNIX_JACK
@ RTMIDI_API_UNIX_JACK
Definition: rtmidi_c.h:65
RTMIDI_ERROR_INVALID_PARAMETER
@ RTMIDI_ERROR_INVALID_PARAMETER
Definition: rtmidi_c.h:79
RTMIDI_ERROR_MEMORY_ERROR
@ RTMIDI_ERROR_MEMORY_ERROR
Definition: rtmidi_c.h:78
RTMIDI_ERROR_UNSPECIFIED
@ RTMIDI_ERROR_UNSPECIFIED
Definition: rtmidi_c.h:75
RTMIDI_ERROR_INVALID_USE
@ RTMIDI_ERROR_INVALID_USE
Definition: rtmidi_c.h:80
RTMIDI_ERROR_DRIVER_ERROR
@ RTMIDI_ERROR_DRIVER_ERROR
Definition: rtmidi_c.h:81
RTMIDI_ERROR_DEBUG_WARNING
@ RTMIDI_ERROR_DEBUG_WARNING
Definition: rtmidi_c.h:74
RTMIDI_ERROR_WARNING
@ RTMIDI_ERROR_WARNING
Definition: rtmidi_c.h:73
RTMIDI_ERROR_SYSTEM_ERROR
@ RTMIDI_ERROR_SYSTEM_ERROR
Definition: rtmidi_c.h:82
RTMIDI_ERROR_NO_DEVICES_FOUND
@ RTMIDI_ERROR_NO_DEVICES_FOUND
Definition: rtmidi_c.h:76
RTMIDI_ERROR_INVALID_DEVICE
@ RTMIDI_ERROR_INVALID_DEVICE
Definition: rtmidi_c.h:77
RTMIDI_ERROR_THREAD_ERROR
@ RTMIDI_ERROR_THREAD_ERROR
Definition: rtmidi_c.h:83
RtMidiWrapper
Wraps an RtMidi object for C function return statuses.
Definition: rtmidi_c.h:39

| ©2003-2021 Gary P. Scavone, McGill University. All Rights Reserved. Maintained by Gary P. Scavone, gary at music.mcgill.ca