1 /// C declarations of PulseAudio that libsoundio uses 2 module soundio.headers.pulseheader; 3 extern(C): @nogc: nothrow: __gshared: 4 5 // mainloop-api.h 6 struct pa_mainloop_api; 7 8 // operation.h 9 struct pa_operation; 10 pa_operation_state_t pa_operation_get_state(pa_operation* o); 11 void pa_operation_unref(pa_operation* o); 12 13 // proplist.h 14 struct pa_proplist; 15 pa_proplist* pa_proplist_new(); 16 void pa_proplist_free(pa_proplist* p); 17 18 //stream.h 19 struct pa_stream; 20 alias void function(pa_stream* s, int success, void* userdata) pa_stream_success_cb_t; 21 alias void function(pa_stream* p, size_t nbytes, void* userdata) pa_stream_request_cb_t; 22 alias void function(pa_stream* p, void* userdata) pa_stream_notify_cb_t; 23 24 int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes); 25 int pa_stream_connect_playback(pa_stream* s, const(char)* dev, const(pa_buffer_attr)* attr, pa_stream_flags_t flags, const(pa_cvolume)* volume, pa_stream* sync_stream); 26 int pa_stream_connect_record(pa_stream* s, const(char)* dev, const(pa_buffer_attr)* attr, pa_stream_flags_t flags); 27 pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, void* userdata); 28 int pa_stream_disconnect(pa_stream* s); 29 int pa_stream_drop(pa_stream* p); 30 int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative); 31 pa_stream_state_t pa_stream_get_state(pa_stream* p); 32 int pa_stream_is_corked(pa_stream* s); 33 pa_stream* pa_stream_new(pa_context* c, const(char)* name, const(pa_sample_spec)* ss, const(pa_channel_map)* map); 34 int pa_stream_peek(pa_stream* p, const(void)** data, size_t* nbytes); 35 void pa_stream_set_overflow_callback(pa_stream* p, pa_stream_notify_cb_t cb, void* userdata); 36 void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata); 37 void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata); 38 void pa_stream_set_underflow_callback(pa_stream* p, pa_stream_notify_cb_t cb, void* userdata); 39 void pa_stream_set_write_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata); 40 void pa_stream_unref(pa_stream* s); 41 pa_operation* pa_stream_update_timing_info(pa_stream* p, pa_stream_success_cb_t cb, void* userdata); 42 size_t pa_stream_writable_size(pa_stream* p); 43 int pa_stream_write(pa_stream* p, const(void)* data, size_t nbytes, pa_free_cb_t free_cb, long offset, pa_seek_mode_t seek); 44 45 // def.h 46 alias void function(void* p) pa_free_cb_t; 47 48 alias pa_stream_flags_t = int; // C enum 49 enum { 50 PA_STREAM_NOFLAGS = 0x0000U, 51 PA_STREAM_START_CORKED = 0x0001U, 52 PA_STREAM_INTERPOLATE_TIMING = 0x0002U, 53 PA_STREAM_NOT_MONOTONIC = 0x0004U, 54 PA_STREAM_AUTO_TIMING_UPDATE = 0x0008U, 55 PA_STREAM_NO_REMAP_CHANNELS = 0x0010U, 56 PA_STREAM_NO_REMIX_CHANNELS = 0x0020U, 57 PA_STREAM_FIX_FORMAT = 0x0040U, 58 PA_STREAM_FIX_RATE = 0x0080U, 59 PA_STREAM_FIX_CHANNELS = 0x0100, 60 PA_STREAM_DONT_MOVE = 0x0200U, 61 PA_STREAM_VARIABLE_RATE = 0x0400U, 62 PA_STREAM_PEAK_DETECT = 0x0800U, 63 PA_STREAM_START_MUTED = 0x1000U, 64 PA_STREAM_ADJUST_LATENCY = 0x2000U, 65 PA_STREAM_EARLY_REQUESTS = 0x4000U, 66 PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND = 0x8000U, 67 PA_STREAM_START_UNMUTED = 0x10000U, 68 PA_STREAM_FAIL_ON_SUSPEND = 0x20000U, 69 PA_STREAM_RELATIVE_VOLUME = 0x40000U, 70 PA_STREAM_PASSTHROUGH = 0x80000U 71 } 72 73 struct pa_spawn_api { 74 extern(C): @nogc: nothrow: 75 void function() prefork; 76 void function() postfork; 77 void function() atfork; 78 } 79 80 // thread-mainloop.h 81 struct pa_threaded_mainloop; 82 pa_threaded_mainloop *pa_threaded_mainloop_new(); 83 void pa_threaded_mainloop_free(pa_threaded_mainloop* m); 84 int pa_threaded_mainloop_start(pa_threaded_mainloop* m); 85 void pa_threaded_mainloop_stop(pa_threaded_mainloop* m); 86 void pa_threaded_mainloop_lock(pa_threaded_mainloop* m); 87 void pa_threaded_mainloop_unlock(pa_threaded_mainloop* m); 88 void pa_threaded_mainloop_wait(pa_threaded_mainloop* m); 89 void pa_threaded_mainloop_signal(pa_threaded_mainloop* m, int wait_for_accept); 90 pa_mainloop_api* pa_threaded_mainloop_get_api(pa_threaded_mainloop* m); 91 int pa_threaded_mainloop_in_thread(pa_threaded_mainloop* m); 92 93 // context.h 94 struct pa_context; 95 alias void function(pa_context* c, void* userdata) pa_context_notify_cb_t; 96 alias void function(pa_context* c, int success, void* userdata) pa_context_success_cb_t; 97 98 alias pa_context_flags_t = int; // C enum 99 int pa_context_connect(pa_context* c, const(char)* server, pa_context_flags_t flags, const(pa_spawn_api)* api); 100 void pa_context_disconnect(pa_context* c); 101 pa_context_state_t pa_context_get_state(pa_context* c); 102 pa_context* pa_context_new_with_proplist(pa_mainloop_api* mainloop, const(char)* name, pa_proplist* proplist); 103 void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata); 104 void pa_context_unref(pa_context* c); 105 106 // subscribe.h 107 alias pa_subscription_mask_t = int; // C enum 108 enum { 109 PA_SUBSCRIPTION_MASK_NULL = 0x0000U, 110 PA_SUBSCRIPTION_MASK_SINK = 0x0001U, 111 PA_SUBSCRIPTION_MASK_SOURCE = 0x0002U, 112 PA_SUBSCRIPTION_MASK_SINK_INPUT = 0x0004U, 113 PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT = 0x0008U, 114 PA_SUBSCRIPTION_MASK_MODULE = 0x0010U, 115 PA_SUBSCRIPTION_MASK_CLIENT = 0x0020U, 116 PA_SUBSCRIPTION_MASK_SAMPLE_CACHE = 0x0040U, 117 PA_SUBSCRIPTION_MASK_SERVER = 0x0080U, 118 PA_SUBSCRIPTION_MASK_AUTOLOAD = 0x0100U, 119 PA_SUBSCRIPTION_MASK_CARD = 0x0200U, 120 PA_SUBSCRIPTION_MASK_ALL = 0x02ffU 121 } 122 123 alias void function(pa_context* c, pa_subscription_event_type_t t, uint idx, void* userdata) pa_context_subscribe_cb_t; 124 pa_operation* pa_context_subscribe(pa_context* c, pa_subscription_mask_t m, pa_context_success_cb_t cb, void* userdata); 125 void pa_context_set_subscribe_callback(pa_context* c, pa_context_subscribe_cb_t cb, void* userdata); 126 127 // introspect.h 128 alias void function(pa_context* c, const(pa_server_info)* i, void* userdata) pa_server_info_cb_t; 129 pa_operation* pa_context_get_server_info(pa_context* c, pa_server_info_cb_t cb, void* userdata); 130 alias void function(pa_context* c, const(pa_sink_info)* i, int eol, void* userdata) pa_sink_info_cb_t; 131 pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata); 132 alias void function(pa_context* c, const(pa_source_info)* i, int eol, void* userdata) pa_source_info_cb_t; 133 pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata); 134 135 alias pa_volume_t = uint; 136 alias pa_usec_t = ulong; 137 138 alias pa_sink_flags_t = int; // C enum 139 alias pa_sink_state_t = int; // C enum 140 alias pa_source_flags_t = int; // C enum 141 alias pa_source_state_t = int; // C enum 142 143 struct pa_cvolume { 144 ubyte channels; 145 pa_volume_t[PA_CHANNELS_MAX] values; 146 } 147 148 alias pa_encoding_t = int; // C enum 149 struct pa_format_info { 150 pa_encoding_t encoding; 151 pa_proplist *plist; 152 } 153 154 struct pa_sink_port_info { 155 const(char)* name; 156 const(char)* description; 157 uint priority; 158 int available; 159 } 160 161 struct pa_source_port_info { 162 const(char)* name; 163 const(char)* description; 164 uint priority; 165 int available; 166 } 167 168 struct pa_server_info { 169 const(char)* user_name; 170 const(char)* host_name; 171 const(char)* server_version; 172 const(char)* server_name; 173 pa_sample_spec sample_spec; 174 const(char)* default_sink_name; 175 const(char)* default_source_name; 176 uint cookie; 177 pa_channel_map channel_map; 178 } 179 180 struct pa_sink_info { 181 const(char)* name; 182 uint index; 183 const(char)* description; 184 pa_sample_spec sample_spec; 185 pa_channel_map channel_map; 186 uint owner_module; 187 pa_cvolume volume; 188 int mute; 189 uint monitor_source; 190 const(char)* monitor_source_name; 191 pa_usec_t latency; 192 const(char)* driver; 193 pa_sink_flags_t flags; 194 pa_proplist* proplist; 195 pa_usec_t configured_latency; 196 pa_volume_t base_volume; 197 pa_sink_state_t state; 198 uint n_volume_steps; 199 uint card; 200 uint n_ports; 201 pa_sink_port_info** ports; 202 pa_sink_port_info* active_port; 203 ubyte n_formats; 204 pa_format_info** formats; 205 } 206 207 struct pa_source_info { 208 const(char)* name; 209 uint index; 210 const(char)* description; 211 pa_sample_spec sample_spec; 212 pa_channel_map channel_map; 213 uint owner_module; 214 pa_cvolume volume; 215 int mute; 216 uint monitor_of_sink; 217 const(char)* monitor_of_sink_name; 218 pa_usec_t latency; 219 const(char)* driver; 220 pa_source_flags_t flags; 221 pa_proplist* proplist; 222 pa_usec_t configured_latency; 223 pa_volume_t base_volume; 224 pa_source_state_t state; 225 uint n_volume_steps; 226 uint card; 227 uint n_ports; 228 pa_source_port_info** ports; 229 pa_source_port_info* active_port; 230 ubyte n_formats; 231 pa_format_info** formats; 232 } 233 234 struct pa_buffer_attr { 235 uint maxlength; 236 uint tlength; 237 uint prebuf; 238 uint minreq; 239 uint fragsize; 240 } 241 242 enum PA_CHANNELS_MAX = 32; 243 struct pa_channel_map { 244 ubyte channels; 245 pa_channel_position_t[PA_CHANNELS_MAX] map; 246 } 247 struct pa_sample_spec { 248 pa_sample_format_t format; 249 uint rate; 250 ubyte channels; 251 } 252 253 alias pa_context_state_t = int; // C enum 254 enum { 255 PA_CONTEXT_UNCONNECTED, 256 PA_CONTEXT_CONNECTING, 257 PA_CONTEXT_AUTHORIZING, 258 PA_CONTEXT_SETTING_NAME, 259 PA_CONTEXT_READY, 260 PA_CONTEXT_FAILED, 261 PA_CONTEXT_TERMINATED 262 } 263 264 alias pa_operation_state_t = int; // C enum 265 enum { 266 PA_OPERATION_RUNNING, 267 PA_OPERATION_DONE, 268 PA_OPERATION_CANCELLED 269 } 270 271 alias pa_seek_mode_t = int; 272 enum { 273 PA_SEEK_RELATIVE = 0, 274 PA_SEEK_ABSOLUTE = 1, 275 PA_SEEK_RELATIVE_ON_READ = 2, 276 PA_SEEK_RELATIVE_END = 3 277 } 278 279 alias pa_stream_state_t = int; // C enum 280 enum { 281 PA_STREAM_UNCONNECTED, 282 PA_STREAM_CREATING, 283 PA_STREAM_READY, 284 PA_STREAM_FAILED, 285 PA_STREAM_TERMINATED 286 } 287 288 alias pa_channel_position_t = int; // C enum 289 enum { 290 PA_CHANNEL_POSITION_INVALID = -1, 291 PA_CHANNEL_POSITION_MONO = 0, 292 PA_CHANNEL_POSITION_FRONT_LEFT, 293 PA_CHANNEL_POSITION_FRONT_RIGHT, 294 PA_CHANNEL_POSITION_FRONT_CENTER, 295 PA_CHANNEL_POSITION_LEFT = PA_CHANNEL_POSITION_FRONT_LEFT, 296 PA_CHANNEL_POSITION_RIGHT = PA_CHANNEL_POSITION_FRONT_RIGHT, 297 PA_CHANNEL_POSITION_CENTER = PA_CHANNEL_POSITION_FRONT_CENTER, 298 PA_CHANNEL_POSITION_REAR_CENTER, 299 PA_CHANNEL_POSITION_REAR_LEFT, 300 PA_CHANNEL_POSITION_REAR_RIGHT, 301 PA_CHANNEL_POSITION_LFE, 302 PA_CHANNEL_POSITION_SUBWOOFER = PA_CHANNEL_POSITION_LFE, 303 PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, 304 PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, 305 PA_CHANNEL_POSITION_SIDE_LEFT, 306 PA_CHANNEL_POSITION_SIDE_RIGHT, 307 PA_CHANNEL_POSITION_AUX0, 308 PA_CHANNEL_POSITION_AUX1, 309 PA_CHANNEL_POSITION_AUX2, 310 PA_CHANNEL_POSITION_AUX3, 311 PA_CHANNEL_POSITION_AUX4, 312 PA_CHANNEL_POSITION_AUX5, 313 PA_CHANNEL_POSITION_AUX6, 314 PA_CHANNEL_POSITION_AUX7, 315 PA_CHANNEL_POSITION_AUX8, 316 PA_CHANNEL_POSITION_AUX9, 317 PA_CHANNEL_POSITION_AUX10, 318 PA_CHANNEL_POSITION_AUX11, 319 PA_CHANNEL_POSITION_AUX12, 320 PA_CHANNEL_POSITION_AUX13, 321 PA_CHANNEL_POSITION_AUX14, 322 PA_CHANNEL_POSITION_AUX15, 323 PA_CHANNEL_POSITION_AUX16, 324 PA_CHANNEL_POSITION_AUX17, 325 PA_CHANNEL_POSITION_AUX18, 326 PA_CHANNEL_POSITION_AUX19, 327 PA_CHANNEL_POSITION_AUX20, 328 PA_CHANNEL_POSITION_AUX21, 329 PA_CHANNEL_POSITION_AUX22, 330 PA_CHANNEL_POSITION_AUX23, 331 PA_CHANNEL_POSITION_AUX24, 332 PA_CHANNEL_POSITION_AUX25, 333 PA_CHANNEL_POSITION_AUX26, 334 PA_CHANNEL_POSITION_AUX27, 335 PA_CHANNEL_POSITION_AUX28, 336 PA_CHANNEL_POSITION_AUX29, 337 PA_CHANNEL_POSITION_AUX30, 338 PA_CHANNEL_POSITION_AUX31, 339 PA_CHANNEL_POSITION_TOP_CENTER, 340 PA_CHANNEL_POSITION_TOP_FRONT_LEFT, 341 PA_CHANNEL_POSITION_TOP_FRONT_RIGHT, 342 PA_CHANNEL_POSITION_TOP_FRONT_CENTER, 343 PA_CHANNEL_POSITION_TOP_REAR_LEFT, 344 PA_CHANNEL_POSITION_TOP_REAR_RIGHT, 345 PA_CHANNEL_POSITION_TOP_REAR_CENTER, 346 PA_CHANNEL_POSITION_MAX 347 } 348 alias pa_subscription_event_type_t = int; 349 enum { 350 PA_SUBSCRIPTION_EVENT_SINK = 0x0000U, 351 PA_SUBSCRIPTION_EVENT_SOURCE = 0x0001U, 352 PA_SUBSCRIPTION_EVENT_SINK_INPUT = 0x0002U, 353 PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT = 0x0003U, 354 PA_SUBSCRIPTION_EVENT_MODULE = 0x0004U, 355 PA_SUBSCRIPTION_EVENT_CLIENT = 0x0005U, 356 PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE = 0x0006U, 357 PA_SUBSCRIPTION_EVENT_SERVER = 0x0007U, 358 PA_SUBSCRIPTION_EVENT_AUTOLOAD = 0x0008U, 359 PA_SUBSCRIPTION_EVENT_CARD = 0x0009U, 360 PA_SUBSCRIPTION_EVENT_FACILITY_MASK = 0x000FU, 361 PA_SUBSCRIPTION_EVENT_NEW = 0x0000U, 362 PA_SUBSCRIPTION_EVENT_CHANGE = 0x0010U, 363 PA_SUBSCRIPTION_EVENT_REMOVE = 0x0020U, 364 PA_SUBSCRIPTION_EVENT_TYPE_MASK = 0x0030U 365 } 366 alias pa_sample_format_t = int; 367 enum { 368 PA_SAMPLE_U8, 369 PA_SAMPLE_ALAW, 370 PA_SAMPLE_ULAW, 371 PA_SAMPLE_S16LE, 372 PA_SAMPLE_S16BE, 373 PA_SAMPLE_FLOAT32LE, 374 PA_SAMPLE_FLOAT32BE, 375 PA_SAMPLE_S32LE, 376 PA_SAMPLE_S32BE, 377 PA_SAMPLE_S24LE, 378 PA_SAMPLE_S24BE, 379 PA_SAMPLE_S24_32LE, 380 PA_SAMPLE_S24_32BE, 381 PA_SAMPLE_MAX, 382 PA_SAMPLE_INVALID = -1 383 }