1 // machine generated, do not edit
2 
3 module sokol.audio;
4 
5 enum LogItem {
6     Ok,
7     Malloc_failed,
8     Alsa_snd_pcm_open_failed,
9     Alsa_float_samples_not_supported,
10     Alsa_requested_buffer_size_not_supported,
11     Alsa_requested_channel_count_not_supported,
12     Alsa_snd_pcm_hw_params_set_rate_near_failed,
13     Alsa_snd_pcm_hw_params_failed,
14     Alsa_pthread_create_failed,
15     Wasapi_create_event_failed,
16     Wasapi_create_device_enumerator_failed,
17     Wasapi_get_default_audio_endpoint_failed,
18     Wasapi_device_activate_failed,
19     Wasapi_audio_client_initialize_failed,
20     Wasapi_audio_client_get_buffer_size_failed,
21     Wasapi_audio_client_get_service_failed,
22     Wasapi_audio_client_set_event_handle_failed,
23     Wasapi_create_thread_failed,
24     Aaudio_streambuilder_open_stream_failed,
25     Aaudio_pthread_create_failed,
26     Aaudio_restarting_stream_after_error,
27     Using_aaudio_backend,
28     Aaudio_create_streambuilder_failed,
29     Using_sles_backend,
30     Sles_create_engine_failed,
31     Sles_engine_get_engine_interface_failed,
32     Sles_create_output_mix_failed,
33     Sles_mixer_get_volume_interface_failed,
34     Sles_engine_create_audio_player_failed,
35     Sles_player_get_play_interface_failed,
36     Sles_player_get_volume_interface_failed,
37     Sles_player_get_bufferqueue_interface_failed,
38     Coreaudio_new_output_failed,
39     Coreaudio_allocate_buffer_failed,
40     Coreaudio_start_failed,
41     Backend_buffer_size_isnt_multiple_of_packet_size,
42 }
43 extern(C)
44 struct Logger {
45     extern(C) void function(const(char)*, uint, uint, const(char)*, uint, const(char)*, void*) func = null;
46     void* user_data = null;
47 }
48 extern(C)
49 struct Allocator {
50     extern(C) void* function(size_t, void*) alloc_fn = null;
51     extern(C) void function(void*, void*) free_fn = null;
52     void* user_data = null;
53 }
54 extern(C)
55 struct Desc {
56     int sample_rate = 0;
57     int num_channels = 0;
58     int buffer_frames = 0;
59     int packet_frames = 0;
60     int num_packets = 0;
61     extern(C) void function(float *, int, int) stream_cb = null;
62     extern(C) void function(float *, int, int, void*) stream_userdata_cb = null;
63     void* user_data = null;
64     Allocator allocator;
65     Logger logger;
66 }
67 extern(C) void saudio_setup(const Desc *) @system @nogc nothrow;
68 void setup(scope ref Desc desc) @trusted @nogc nothrow {
69     saudio_setup(&desc);
70 }
71 extern(C) void saudio_shutdown() @system @nogc nothrow;
72 void shutdown() @trusted @nogc nothrow {
73     saudio_shutdown();
74 }
75 extern(C) bool saudio_isvalid() @system @nogc nothrow;
76 bool isvalid() @trusted @nogc nothrow {
77     return saudio_isvalid();
78 }
79 extern(C) void* saudio_userdata() @system @nogc nothrow;
80 scope void* userdata() @trusted @nogc nothrow {
81     return saudio_userdata();
82 }
83 extern(C) Desc saudio_query_desc() @system @nogc nothrow;
84 Desc queryDesc() @trusted @nogc nothrow {
85     return saudio_query_desc();
86 }
87 extern(C) int saudio_sample_rate() @system @nogc nothrow;
88 int sampleRate() @trusted @nogc nothrow {
89     return saudio_sample_rate();
90 }
91 extern(C) int saudio_buffer_frames() @system @nogc nothrow;
92 int bufferFrames() @trusted @nogc nothrow {
93     return saudio_buffer_frames();
94 }
95 extern(C) int saudio_channels() @system @nogc nothrow;
96 int channels() @trusted @nogc nothrow {
97     return saudio_channels();
98 }
99 extern(C) bool saudio_suspended() @system @nogc nothrow;
100 bool suspended() @trusted @nogc nothrow {
101     return saudio_suspended();
102 }
103 extern(C) int saudio_expect() @system @nogc nothrow;
104 int expect() @trusted @nogc nothrow {
105     return saudio_expect();
106 }
107 extern(C) int saudio_push(const float *, int) @system @nogc nothrow;
108 int push(scope const float * frames, int num_frames) @trusted @nogc nothrow {
109     return saudio_push(frames, num_frames);
110 }