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 "zix/ring.h"
15# include <rtmidi_c.h>
16# include <stdint.h>
17
18typedef struct Port Port;
19
26# define MIDI_BUFFER_SIZE 32768
27
32enum RtMidiDeviceFlow
33{
34 RTMIDI_DEVICE_FLOW_OUTPUT,
35 RTMIDI_DEVICE_FLOW_INPUT,
36};
37
38typedef struct RtMidiDevice
39{
41 int is_input;
42
44 unsigned int id;
45
46 char * name;
47
49 int opened;
50
52 int started;
53
54 /* ---- INPUT ---- */
55 RtMidiInPtr in_handle;
56
57 /* ---- OUTPUT ---- */
58 RtMidiOutPtr out_handle;
59
61 Port * port;
62
64 ZixRing * midi_ring;
65
68 MidiEvents * events;
69
72 ZixSem midi_ring_sem;
73
74} RtMidiDevice;
75
80RtMidiDevice *
81rtmidi_device_new (
82 bool is_input,
83 const char * name,
84 unsigned int device_id,
85 Port * port);
86
95int
96rtmidi_device_open (RtMidiDevice * dev, int start);
97
103int
104rtmidi_device_close (RtMidiDevice * self, int free);
105
106int
107rtmidi_device_start (RtMidiDevice * self);
108
109int
110rtmidi_device_stop (RtMidiDevice * self);
111
112void
113rtmidi_device_free (RtMidiDevice * self);
114
119#endif // HAVE_RTMIDI
120#endif
Container for passing midi events through ports.
Definition midi_event.h:62
Must ONLY be created via port_new()
Definition port.h:136