1 /// Translated from C to D 2 module soundio.soundio_private; 3 4 extern(C): @nogc: nothrow: __gshared: 5 6 public import soundio.soundio_internal; 7 public import soundio.config; 8 public import soundio.list; 9 10 version (SOUNDIO_HAVE_JACK) { 11 public import soundio.jack; 12 } 13 version (SOUNDIO_HAVE_PULSEAUDIO) { 14 public import soundio.pulseaudio; 15 } 16 version (SOUNDIO_HAVE_ALSA) { 17 public import soundio.alsa; 18 } 19 version (SOUNDIO_HAVE_COREAUDIO) { 20 public import soundio.coreaudio; 21 } 22 version (SOUNDIO_HAVE_WASAPI) { 23 public import soundio.wasapi; 24 } 25 26 public import soundio.dummy; 27 28 package: 29 30 union SoundIoBackendData { 31 version (SOUNDIO_HAVE_JACK) { 32 SoundIoJack jack; 33 } 34 version (SOUNDIO_HAVE_PULSEAUDIO) { 35 SoundIoPulseAudio pulseaudio; 36 } 37 version (SOUNDIO_HAVE_ALSA) { 38 SoundIoAlsa alsa; 39 } 40 version (SOUNDIO_HAVE_COREAUDIO) { 41 SoundIoCoreAudio coreaudio; 42 } 43 version (SOUNDIO_HAVE_WASAPI) { 44 SoundIoWasapi wasapi; 45 } 46 SoundIoDummy dummy; 47 } 48 49 union SoundIoDeviceBackendData { 50 version (SOUNDIO_HAVE_JACK) { 51 SoundIoDeviceJack jack; 52 } 53 version (SOUNDIO_HAVE_PULSEAUDIO) { 54 SoundIoDevicePulseAudio pulseaudio; 55 } 56 version (SOUNDIO_HAVE_ALSA) { 57 SoundIoDeviceAlsa alsa; 58 } 59 version (SOUNDIO_HAVE_COREAUDIO) { 60 SoundIoDeviceCoreAudio coreaudio; 61 } 62 version (SOUNDIO_HAVE_WASAPI) { 63 SoundIoDeviceWasapi wasapi; 64 } 65 SoundIoDeviceDummy dummy; 66 } 67 68 union SoundIoOutStreamBackendData { 69 version (SOUNDIO_HAVE_JACK) { 70 SoundIoOutStreamJack jack; 71 } 72 version (SOUNDIO_HAVE_PULSEAUDIO) { 73 SoundIoOutStreamPulseAudio pulseaudio; 74 } 75 version (SOUNDIO_HAVE_ALSA) { 76 SoundIoOutStreamAlsa alsa; 77 } 78 version (SOUNDIO_HAVE_COREAUDIO) { 79 SoundIoOutStreamCoreAudio coreaudio; 80 } 81 version (SOUNDIO_HAVE_WASAPI) { 82 SoundIoOutStreamWasapi wasapi; 83 } 84 SoundIoOutStreamDummy dummy; 85 } 86 87 union SoundIoInStreamBackendData { 88 version (SOUNDIO_HAVE_JACK) { 89 SoundIoInStreamJack jack; 90 } 91 version (SOUNDIO_HAVE_PULSEAUDIO) { 92 SoundIoInStreamPulseAudio pulseaudio; 93 } 94 version (SOUNDIO_HAVE_ALSA) { 95 SoundIoInStreamAlsa alsa; 96 } 97 version (SOUNDIO_HAVE_COREAUDIO) { 98 SoundIoInStreamCoreAudio coreaudio; 99 } 100 version (SOUNDIO_HAVE_WASAPI) { 101 SoundIoInStreamWasapi wasapi; 102 } 103 SoundIoInStreamDummy dummy; 104 } 105 106 alias SoundIoListDevicePtr = SOUNDIO_LIST!(SoundIoDevice*); 107 108 struct SoundIoDevicesInfo { 109 SoundIoListDevicePtr input_devices; 110 SoundIoListDevicePtr output_devices; 111 // can be -1 when default device is unknown 112 int default_output_index; 113 int default_input_index; 114 } 115 116 struct SoundIoOutStreamPrivate { 117 SoundIoOutStream pub; 118 SoundIoOutStreamBackendData backend_data; 119 } 120 121 struct SoundIoInStreamPrivate { 122 SoundIoInStream pub; 123 SoundIoInStreamBackendData backend_data; 124 } 125 126 struct SoundIoPrivate { 127 extern(C): @nogc: nothrow: 128 SoundIo pub; 129 130 // Safe to read from a single thread without a mutex. 131 SoundIoDevicesInfo* safe_devices_info; 132 133 void function(SoundIoPrivate*) destroy; 134 void function(SoundIoPrivate*) flush_events; 135 void function(SoundIoPrivate*) wait_events; 136 void function(SoundIoPrivate*) wakeup; 137 void function(SoundIoPrivate*) force_device_scan; 138 139 int function(SoundIoPrivate*, SoundIoOutStreamPrivate*) outstream_open; 140 void function(SoundIoPrivate*, SoundIoOutStreamPrivate*) outstream_destroy; 141 int function(SoundIoPrivate*, SoundIoOutStreamPrivate*) outstream_start; 142 int function(SoundIoPrivate*, SoundIoOutStreamPrivate*, SoundIoChannelArea** out_areas, int* out_frame_count) outstream_begin_write; 143 int function(SoundIoPrivate*, SoundIoOutStreamPrivate*) outstream_end_write; 144 int function(SoundIoPrivate*, SoundIoOutStreamPrivate*) outstream_clear_buffer; 145 int function(SoundIoPrivate*, SoundIoOutStreamPrivate*, bool pause) outstream_pause; 146 int function(SoundIoPrivate*, SoundIoOutStreamPrivate*, double* out_latency) outstream_get_latency; 147 int function(SoundIoPrivate*, SoundIoOutStreamPrivate*, float volume) outstream_set_volume; 148 149 int function(SoundIoPrivate*, SoundIoInStreamPrivate*) instream_open; 150 void function(SoundIoPrivate*, SoundIoInStreamPrivate*) instream_destroy; 151 int function(SoundIoPrivate*, SoundIoInStreamPrivate*) instream_start; 152 int function(SoundIoPrivate*, SoundIoInStreamPrivate*, SoundIoChannelArea** out_areas, int* out_frame_count) instream_begin_read; 153 int function(SoundIoPrivate*, SoundIoInStreamPrivate*) instream_end_read; 154 int function(SoundIoPrivate*, SoundIoInStreamPrivate*, bool pause) instream_pause; 155 int function(SoundIoPrivate*, SoundIoInStreamPrivate*, double* out_latency) instream_get_latency; 156 157 SoundIoBackendData backend_data; 158 } 159 160 alias SoundIoListSampleRateRange = SOUNDIO_LIST!(SoundIoSampleRateRange); 161 162 struct SoundIoDevicePrivate { 163 extern(C): @nogc: nothrow: 164 SoundIoDevice pub; 165 SoundIoDeviceBackendData backend_data; 166 void function(SoundIoDevicePrivate*) destruct; 167 SoundIoSampleRateRange prealloc_sample_rate_range; 168 SoundIoListSampleRateRange sample_rates; 169 SoundIoFormat prealloc_format; 170 } 171 172 void soundio_destroy_devices_info(SoundIoDevicesInfo* devices_info); 173 174 immutable int SOUNDIO_MIN_SAMPLE_RATE = 8000; 175 immutable int SOUNDIO_MAX_SAMPLE_RATE = 5644_800;