Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
rtmidi_device.h
1/*
2 * SPDX-FileCopyrightText: © 2020 Alexandros Theodotou <alex@zrythm.org>
3 *
4 * SPDX-License-Identifier: LicenseRef-ZrythmLicense
5 */
6
7#ifndef __AUDIO_RTMIDI_DEVICE_H__
8#define __AUDIO_RTMIDI_DEVICE_H__
9
10#include "zrythm-config.h"
11
12#ifdef HAVE_RTMIDI
13
14# include <stdint.h>
15
16# include "zix/ring.h"
17# include <rtmidi_c.h>
18
19typedef struct Port Port;
20
27# define MIDI_BUFFER_SIZE 32768
28
33enum RtMidiDeviceFlow
34{
35 RTMIDI_DEVICE_FLOW_OUTPUT,
36 RTMIDI_DEVICE_FLOW_INPUT,
37};
38
39typedef struct RtMidiDevice
40{
42 int is_input;
43
45 unsigned int id;
46
47 char * name;
48
50 int opened;
51
53 int started;
54
55 /* ---- INPUT ---- */
56 RtMidiInPtr in_handle;
57
58 /* ---- OUTPUT ---- */
59 RtMidiOutPtr out_handle;
60
62 Port * port;
63
65 ZixRing * midi_ring;
66
69 MidiEvents * events;
70
73 ZixSem midi_ring_sem;
74
75} RtMidiDevice;
76
81RtMidiDevice *
82rtmidi_device_new (
83 bool is_input,
84 const char * name,
85 unsigned int device_id,
86 Port * port);
87
96int
97rtmidi_device_open (RtMidiDevice * dev, int start);
98
104int
105rtmidi_device_close (RtMidiDevice * self, int free);
106
107int
108rtmidi_device_start (RtMidiDevice * self);
109
110int
111rtmidi_device_stop (RtMidiDevice * self);
112
113void
114rtmidi_device_free (RtMidiDevice * self);
115
120#endif // HAVE_RTMIDI
121#endif
Container for passing midi events through ports.
Definition midi_event.h:68
Must ONLY be created via port_new()
Definition port.h:139