1 /++ 2 + Machine generated D bindings for Sokol library. 3 + 4 + Source header: sokol_audio.h 5 + Module: sokol.audio 6 + 7 + Do not edit manually; regenerate using gen_d.py. 8 +/ 9 module sokol.audio; 10 11 enum LogItem { 12 Ok, 13 Malloc_failed, 14 Alsa_snd_pcm_open_failed, 15 Alsa_float_samples_not_supported, 16 Alsa_requested_buffer_size_not_supported, 17 Alsa_requested_channel_count_not_supported, 18 Alsa_snd_pcm_hw_params_set_rate_near_failed, 19 Alsa_snd_pcm_hw_params_failed, 20 Alsa_pthread_create_failed, 21 Wasapi_create_event_failed, 22 Wasapi_create_device_enumerator_failed, 23 Wasapi_get_default_audio_endpoint_failed, 24 Wasapi_device_activate_failed, 25 Wasapi_audio_client_initialize_failed, 26 Wasapi_audio_client_get_buffer_size_failed, 27 Wasapi_audio_client_get_service_failed, 28 Wasapi_audio_client_set_event_handle_failed, 29 Wasapi_create_thread_failed, 30 Aaudio_streambuilder_open_stream_failed, 31 Aaudio_pthread_create_failed, 32 Aaudio_restarting_stream_after_error, 33 Using_aaudio_backend, 34 Aaudio_create_streambuilder_failed, 35 Coreaudio_new_output_failed, 36 Coreaudio_allocate_buffer_failed, 37 Coreaudio_start_failed, 38 Backend_buffer_size_isnt_multiple_of_packet_size, 39 Vita_sceaudio_open_failed, 40 Vita_pthread_create_failed, 41 N3ds_ndsp_open_failed, 42 } 43 /++ 44 + saudio_logger 45 + 46 + Used in saudio_desc to provide a custom logging and error reporting 47 + callback to sokol-audio. 48 +/ 49 extern(C) struct Logger { 50 extern(C) void function(const(char)*, uint, uint, const(char)*, uint, const(char)*, void*) func = null; 51 void* user_data = null; 52 } 53 /++ 54 + saudio_allocator 55 + 56 + Used in saudio_desc to provide custom memory-alloc and -free functions 57 + to sokol_audio.h. If memory management should be overridden, both the 58 + alloc_fn and free_fn function must be provided (e.g. it's not valid to 59 + override one function but not the other). 60 +/ 61 extern(C) struct Allocator { 62 extern(C) void* function(size_t, void*) alloc_fn = null; 63 extern(C) void function(void*, void*) free_fn = null; 64 void* user_data = null; 65 } 66 enum N3dsNdspinterptype { 67 Dsp_interp_polyphase = 0, 68 Dsp_interp_linear = 1, 69 Dsp_interp_none = 2, 70 } 71 extern(C) struct N3dsDesc { 72 int queue_count = 0; 73 N3dsNdspinterptype interpolation_type = N3dsNdspinterptype.Dsp_interp_polyphase; 74 int channel_id = 0; 75 } 76 extern(C) struct Win32Desc { 77 bool skip_coinitialize = false; 78 } 79 extern(C) struct Desc { 80 int sample_rate = 0; 81 int num_channels = 0; 82 int buffer_frames = 0; 83 int packet_frames = 0; 84 int num_packets = 0; 85 extern(C) void function(float*, int, int) stream_cb = null; 86 extern(C) void function(float*, int, int, void*) stream_userdata_cb = null; 87 void* user_data = null; 88 Win32Desc win32 = {}; 89 N3dsDesc n3ds = {}; 90 Allocator allocator = {}; 91 Logger logger = {}; 92 } 93 /++ 94 + setup sokol-audio 95 +/ 96 extern(C) void saudio_setup(const Desc* desc) @system @nogc nothrow pure; 97 void setup(scope ref Desc desc) @trusted @nogc nothrow pure { 98 saudio_setup(&desc); 99 } 100 /++ 101 + shutdown sokol-audio 102 +/ 103 extern(C) void saudio_shutdown() @system @nogc nothrow pure; 104 void shutdown() @trusted @nogc nothrow pure { 105 saudio_shutdown(); 106 } 107 /++ 108 + true after setup if audio backend was successfully initialized 109 +/ 110 extern(C) bool saudio_isvalid() @system @nogc nothrow pure; 111 bool isvalid() @trusted @nogc nothrow pure { 112 return saudio_isvalid(); 113 } 114 /++ 115 + return the saudio_desc.user_data pointer 116 +/ 117 extern(C) void* saudio_userdata() @system @nogc nothrow pure; 118 void* userdata() @trusted @nogc nothrow pure { 119 return saudio_userdata(); 120 } 121 /++ 122 + return a copy of the original saudio_desc struct 123 +/ 124 extern(C) Desc saudio_query_desc() @system @nogc nothrow pure; 125 Desc queryDesc() @trusted @nogc nothrow pure { 126 return saudio_query_desc(); 127 } 128 /++ 129 + actual sample rate 130 +/ 131 extern(C) int saudio_sample_rate() @system @nogc nothrow pure; 132 int sampleRate() @trusted @nogc nothrow pure { 133 return saudio_sample_rate(); 134 } 135 /++ 136 + return actual backend buffer size in number of frames 137 +/ 138 extern(C) int saudio_buffer_frames() @system @nogc nothrow pure; 139 int bufferFrames() @trusted @nogc nothrow pure { 140 return saudio_buffer_frames(); 141 } 142 /++ 143 + actual number of channels 144 +/ 145 extern(C) int saudio_channels() @system @nogc nothrow pure; 146 int channels() @trusted @nogc nothrow pure { 147 return saudio_channels(); 148 } 149 /++ 150 + return true if audio context is currently suspended (only in WebAudio backend, all other backends return false) 151 +/ 152 extern(C) bool saudio_suspended() @system @nogc nothrow pure; 153 bool suspended() @trusted @nogc nothrow pure { 154 return saudio_suspended(); 155 } 156 /++ 157 + get current number of frames to fill packet queue 158 +/ 159 extern(C) int saudio_expect() @system @nogc nothrow pure; 160 int expect() @trusted @nogc nothrow pure { 161 return saudio_expect(); 162 } 163 /++ 164 + push sample frames from main thread, returns number of frames actually pushed 165 +/ 166 extern(C) int saudio_push(const float* frames, int num_frames) @system @nogc nothrow pure; 167 int push(const float* frames, int num_frames) @trusted @nogc nothrow pure { 168 return saudio_push(frames, num_frames); 169 }