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
35extern "C" {
36#endif
37
41 void* ptr;
42 void* data;
43
45 bool ok;
46
48 const char* msg;
49};
50
52typedef struct RtMidiWrapper* RtMidiPtr;
53
55typedef struct RtMidiWrapper* RtMidiInPtr;
56
58typedef struct RtMidiWrapper* RtMidiOutPtr;
59
73
88
97typedef void(* RtMidiCCallback) (double timeStamp, const unsigned char* message,
98 size_t messageSize, void *userData);
99
100
101/* RtMidi API */
102
106RTMIDIAPI const char* rtmidi_get_version();
107
121RTMIDIAPI int rtmidi_get_compiled_api (enum RtMidiApi *apis, unsigned int apis_size);
122
125RTMIDIAPI const char *rtmidi_api_name(enum RtMidiApi api);
126
129RTMIDIAPI const char *rtmidi_api_display_name(enum RtMidiApi api);
130
133RTMIDIAPI enum RtMidiApi rtmidi_compiled_api_by_name(const char *name);
134
136RTMIDIAPI void rtmidi_error (enum RtMidiErrorType type, const char* errorString);
137
145RTMIDIAPI void rtmidi_open_port (RtMidiPtr device, unsigned int portNumber, const char *portName);
146
154RTMIDIAPI void rtmidi_open_virtual_port (RtMidiPtr device, const char *portName);
155
159RTMIDIAPI void rtmidi_close_port (RtMidiPtr device);
160
164RTMIDIAPI unsigned int rtmidi_get_port_count (RtMidiPtr device);
165
173RTMIDIAPI int rtmidi_get_port_name (RtMidiPtr device, unsigned int portNumber, char * bufOut, int * bufLen);
174
175/* RtMidiIn API */
176
178RTMIDIAPI RtMidiInPtr rtmidi_in_create_default (void);
179
191RTMIDIAPI RtMidiInPtr rtmidi_in_create (enum RtMidiApi api, const char *clientName, unsigned int queueSizeLimit);
192
194RTMIDIAPI void rtmidi_in_free (RtMidiInPtr device);
195
198RTMIDIAPI enum RtMidiApi rtmidi_in_get_current_api (RtMidiPtr device);
199
202RTMIDIAPI void rtmidi_in_set_callback (RtMidiInPtr device, RtMidiCCallback callback, void *userData);
203
206RTMIDIAPI void rtmidi_in_cancel_callback (RtMidiInPtr device);
207
210RTMIDIAPI void rtmidi_in_ignore_types (RtMidiInPtr device, bool midiSysex, bool midiTime, bool midiSense);
211
224RTMIDIAPI double rtmidi_in_get_message (RtMidiInPtr device, unsigned char *message, size_t *size);
225
226/* RtMidiOut API */
227
229RTMIDIAPI RtMidiOutPtr rtmidi_out_create_default (void);
230
240RTMIDIAPI RtMidiOutPtr rtmidi_out_create (enum RtMidiApi api, const char *clientName);
241
243RTMIDIAPI void rtmidi_out_free (RtMidiOutPtr device);
244
247RTMIDIAPI enum RtMidiApi rtmidi_out_get_current_api (RtMidiPtr device);
248
251RTMIDIAPI int rtmidi_out_send_message (RtMidiOutPtr device, const unsigned char *message, int length);
252
253
254#ifdef __cplusplus
255}
256#endif
257#endif
258
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().
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
MIDI API specifier arguments. See RtMidi::Api.
Definition rtmidi_c.h:61
void * ptr
The wrapped RtMidi object.
Definition rtmidi_c.h:41
RtMidiErrorType
Defined RtMidiError types. See RtMidiError::Type.
Definition rtmidi_c.h:75
RTMIDIAPI void rtmidi_open_virtual_port(RtMidiPtr device, const char *portName)
Creates a virtual MIDI port to which other software applications can connect.
RTMIDIAPI double rtmidi_in_get_message(RtMidiInPtr device, unsigned char *message, size_t *size)
RTMIDIAPI RtMidiInPtr rtmidi_in_create_default(void)
Create a default RtMidiInPtr value, with no initialization.
RTMIDIAPI void rtmidi_close_port(RtMidiPtr device)
Close a MIDI connection. See RtMidi::closePort().
const char * msg
If an error occurred (ok != true), set to an error message.
Definition rtmidi_c.h:48
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....
RTMIDIAPI int rtmidi_get_compiled_api(enum RtMidiApi *apis, unsigned int apis_size)
Determine the available compiled MIDI APIs.
RTMIDIAPI RtMidiOutPtr rtmidi_out_create(enum RtMidiApi api, const char *clientName)
Create a RtMidiOutPtr value, with given and clientName.
bool ok
True when the last function call was OK.
Definition rtmidi_c.h:45
RTMIDIAPI void rtmidi_in_cancel_callback(RtMidiInPtr device)
Cancel use of the current callback function (if one exists). See RtMidiIn::cancelCallback().
RTMIDIAPI void rtmidi_open_port(RtMidiPtr device, unsigned int portNumber, const char *portName)
Open a MIDI port.
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().
RTMIDIAPI void rtmidi_out_free(RtMidiOutPtr device)
Free the given RtMidiOutPtr.
RTMIDIAPI const char * rtmidi_get_version()
Return the current RtMidi version. ! See RtMidi::getVersion().
RTMIDIAPI RtMidiInPtr rtmidi_in_create(enum RtMidiApi api, const char *clientName, unsigned int queueSizeLimit)
Create a RtMidiInPtr value, with given api, clientName and queueSizeLimit.
RTMIDIAPI void rtmidi_in_free(RtMidiInPtr device)
Free the given RtMidiInPtr.
void(* RtMidiCCallback)(double timeStamp, const unsigned char *message, size_t messageSize, void *userData)
The type of a RtMidi callback function.
Definition rtmidi_c.h:97
RTMIDIAPI unsigned int rtmidi_get_port_count(RtMidiPtr device)
Return the number of available MIDI ports. See RtMidi::getPortCount().
RTMIDIAPI enum RtMidiApi rtmidi_out_get_current_api(RtMidiPtr device)
Returns the MIDI API specifier for the given instance of RtMidiOut. See RtMidiOut::getCurrentApi().
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.
RTMIDIAPI const char * rtmidi_api_name(enum RtMidiApi api)
Return the name of a specified compiled MIDI API. See RtMidi::getApiName().
RTMIDIAPI enum RtMidiApi rtmidi_compiled_api_by_name(const char *name)
Return the compiled MIDI API having the given name. See RtMidi::getCompiledApiByName().
RTMIDIAPI const char * rtmidi_api_display_name(enum RtMidiApi api)
Return the display name of a specified compiled MIDI API. See RtMidi::getApiDisplayName().
RTMIDIAPI RtMidiOutPtr rtmidi_out_create_default(void)
Create a default RtMidiInPtr value, with no initialization.
@ RTMIDI_API_NUM
Definition rtmidi_c.h:71
@ RTMIDI_API_LINUX_ALSA
Definition rtmidi_c.h:64
@ RTMIDI_API_WINDOWS_MM
Definition rtmidi_c.h:66
@ RTMIDI_API_MACOSX_CORE
Definition rtmidi_c.h:63
@ RTMIDI_API_RTMIDI_DUMMY
Definition rtmidi_c.h:67
@ RTMIDI_API_WINDOWS_UWP
Definition rtmidi_c.h:69
@ RTMIDI_API_WEB_MIDI_API
Definition rtmidi_c.h:68
@ RTMIDI_API_UNSPECIFIED
Definition rtmidi_c.h:62
@ RTMIDI_API_UNIX_JACK
Definition rtmidi_c.h:65
@ RTMIDI_API_ANDROID
Definition rtmidi_c.h:70
@ RTMIDI_ERROR_INVALID_PARAMETER
Definition rtmidi_c.h:82
@ RTMIDI_ERROR_MEMORY_ERROR
Definition rtmidi_c.h:81
@ RTMIDI_ERROR_UNSPECIFIED
Definition rtmidi_c.h:78
@ RTMIDI_ERROR_INVALID_USE
Definition rtmidi_c.h:83
@ RTMIDI_ERROR_DRIVER_ERROR
Definition rtmidi_c.h:84
@ RTMIDI_ERROR_DEBUG_WARNING
Definition rtmidi_c.h:77
@ RTMIDI_ERROR_WARNING
Definition rtmidi_c.h:76
@ RTMIDI_ERROR_SYSTEM_ERROR
Definition rtmidi_c.h:85
@ RTMIDI_ERROR_NO_DEVICES_FOUND
Definition rtmidi_c.h:79
@ RTMIDI_ERROR_INVALID_DEVICE
Definition rtmidi_c.h:80
@ RTMIDI_ERROR_THREAD_ERROR
Definition rtmidi_c.h:86
Wraps an RtMidi object for C function return statuses.
Definition rtmidi_c.h:39

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