1 /// Translated from C to D
2 module soundio.coreaudio;
3 
4 version(OSX):
5 @nogc nothrow:
6 extern(C): __gshared:
7 
8 
9 import soundio.api;
10 import soundio.os;
11 import soundio.list;
12 import soundio.atomics;
13 
14 //import coreaudio;
15 //import audiounit;
16 
17 package struct SoundIoDeviceCoreAudio {
18     AudioDeviceID device_id;
19     UInt32 latency_frames;
20 }
21 
22 alias SoundIoListAudioDeviceID = SOUNDIO_LIST!AudioDeviceID; // static
23 
24 package struct SoundIoCoreAudio {
25     SoundIoOsMutex* mutex;
26     SoundIoOsCond* cond;
27     SoundIoOsThread* thread;
28     SoundIoAtomicFlag abort_flag;
29 
30     // this one is ready to be read with flush_events. protected by mutex
31     SoundIoDevicesInfo* ready_devices_info;
32     SoundIoAtomicBool have_devices_flag;
33     SoundIoOsCond* have_devices_cond;
34     SoundIoOsCond* scan_devices_cond;
35     SoundIoListAudioDeviceID registered_listeners;
36 
37     SoundIoAtomicBool device_scan_queued;
38     SoundIoAtomicBool service_restarted;
39     int shutdown_err;
40     bool emitted_shutdown_cb;
41 }
42 
43 package struct SoundIoOutStreamCoreAudio {
44     AudioComponentInstance instance;
45     AudioBufferList* io_data;
46     int buffer_index;
47     int frames_left;
48     int write_frame_count;
49     double hardware_latency;
50     float volume;
51     SoundIoChannelArea[SOUNDIO_MAX_CHANNELS] areas;
52 }
53 
54 package struct SoundIoInStreamCoreAudio {
55     AudioComponentInstance instance;
56     AudioBufferList* buffer_list;
57     int frames_left;
58     double hardware_latency;
59     SoundIoChannelArea[SOUNDIO_MAX_CHANNELS] areas;
60 }