Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
rtaudio_device.h
1/*
2 * SPDX-FileCopyrightText: © 2020 Alexandros Theodotou <alex@zrythm.org>
3 *
4 * SPDX-License-Identifier: LicenseRef-ZrythmLicense
5 */
6
7#ifndef __AUDIO_RTAUDIO_DEVICE_H__
8#define __AUDIO_RTAUDIO_DEVICE_H__
9
10#include "zrythm-config.h"
11
12#ifdef HAVE_RTAUDIO
13
14# define RTAUDIO_DEVICE_BUFFER_SIZE 32000
15
16# include <stdint.h>
17
18# include "zix/ring.h"
19# include <rtaudio_c.h>
20
21typedef struct Port Port;
22
33enum RtAudioDeviceFlow
34{
35 RTAUDIO_DEVICE_FLOW_OUTPUT,
36 RTAUDIO_DEVICE_FLOW_INPUT,
37};
38
42typedef struct RtAudioDevice
43{
44 int is_input;
45
47 unsigned int channel_idx;
48
50 unsigned int id;
51
52 char * name;
53
55 int opened;
56
58 int started;
59
60 rtaudio_t handle;
61
63 Port * port;
64
69 float buf[16000];
70
72 ZixRing * audio_ring;
73
76 ZixSem audio_ring_sem;
77
78} RtAudioDevice;
79
80RtAudioDevice *
81rtaudio_device_new (
82 int is_input,
83 const char * device_name,
84 unsigned int device_id,
85 unsigned int channel_idx,
86 Port * port);
87
96int
97rtaudio_device_open (RtAudioDevice * self, int start);
98
104int
105rtaudio_device_close (RtAudioDevice * self, int free);
106
107int
108rtaudio_device_start (RtAudioDevice * self);
109
110int
111rtaudio_device_stop (RtAudioDevice * self);
112
113void
114rtaudio_device_print_dev_info (rtaudio_device_info_t * nfo);
115
116void
117rtaudio_device_free (RtAudioDevice * self);
118
123#endif // HAVE_RTAUDIO
124#endif
Must ONLY be created via port_new()
Definition port.h:139