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 "zix/ring.h"
17# include <rtaudio_c.h>
18# include <stdint.h>
19
20typedef struct Port Port;
21
32enum RtAudioDeviceFlow
33{
34 RTAUDIO_DEVICE_FLOW_OUTPUT,
35 RTAUDIO_DEVICE_FLOW_INPUT,
36};
37
41typedef struct RtAudioDevice
42{
43 int is_input;
44
46 unsigned int channel_idx;
47
49 unsigned int id;
50
51 char * name;
52
54 int opened;
55
57 int started;
58
59 rtaudio_t handle;
60
62 Port * port;
63
68 float buf[16000];
69
71 ZixRing * audio_ring;
72
75 ZixSem audio_ring_sem;
76
77} RtAudioDevice;
78
79RtAudioDevice *
80rtaudio_device_new (
81 int is_input,
82 const char * device_name,
83 unsigned int device_id,
84 unsigned int channel_idx,
85 Port * port);
86
95int
96rtaudio_device_open (RtAudioDevice * self, int start);
97
103int
104rtaudio_device_close (RtAudioDevice * self, int free);
105
106int
107rtaudio_device_start (RtAudioDevice * self);
108
109int
110rtaudio_device_stop (RtAudioDevice * self);
111
112void
113rtaudio_device_print_dev_info (rtaudio_device_info_t * nfo);
114
115void
116rtaudio_device_free (RtAudioDevice * self);
117
122#endif // HAVE_RTAUDIO
123#endif
Must ONLY be created via port_new()
Definition port.h:136