Struct soundio_sys::SoundIo[][src]

#[repr(C)]
pub struct SoundIo { pub userdata: *mut c_void, pub on_devices_change: Option<unsafe extern "C" fn(arg1: *mut SoundIo)>, pub on_backend_disconnect: Option<unsafe extern "C" fn(arg1: *mut SoundIo, err: c_int)>, pub on_events_signal: Option<unsafe extern "C" fn(arg1: *mut SoundIo)>, pub current_backend: SoundIoBackend, pub app_name: *const c_char, pub emit_rtprio_warning: Option<unsafe extern "C" fn()>, pub jack_info_callback: Option<unsafe extern "C" fn(msg: *const c_char)>, pub jack_error_callback: Option<unsafe extern "C" fn(msg: *const c_char)>, }
Expand description

The size of this struct is not part of the API or ABI.

Fields

userdata: *mut c_void

Optional. Put whatever you want here. Defaults to NULL.

on_devices_change: Option<unsafe extern "C" fn(arg1: *mut SoundIo)>

Optional callback. Called when the list of devices change. Only called during a call to ::soundio_flush_events or ::soundio_wait_events.

on_backend_disconnect: Option<unsafe extern "C" fn(arg1: *mut SoundIo, err: c_int)>

Optional callback. Called when the backend disconnects. For example, when the JACK server shuts down. When this happens, listing devices and opening streams will always fail with SoundIoErrorBackendDisconnected. This callback is only called during a call to ::soundio_flush_events or ::soundio_wait_events. If you do not supply a callback, the default will crash your program with an error message. This callback is also called when the thread that retrieves device information runs into an unrecoverable condition such as running out of memory.

Possible errors:

  • #SoundIoErrorBackendDisconnected
  • #SoundIoErrorNoMem
  • #SoundIoErrorSystemResources
  • #SoundIoErrorOpeningDevice - unexpected problem accessing device information
on_events_signal: Option<unsafe extern "C" fn(arg1: *mut SoundIo)>

Optional callback. Called from an unknown thread that you should not use to call any soundio functions. You may use this to signal a condition variable to wake up. Called when ::soundio_wait_events would be woken up.

current_backend: SoundIoBackend

Read-only. After calling ::soundio_connect or ::soundio_connect_backend, this field tells which backend is currently connected.

app_name: *const c_char

Optional: Application name. PulseAudio uses this for “application name”. JACK uses this for client_name. Must not contain a colon (“:”).

emit_rtprio_warning: Option<unsafe extern "C" fn()>

Optional: Real time priority warning. This callback is fired when making thread real-time priority failed. By default, it will print to stderr only the first time it is called a message instructing the user how to configure their system to allow real-time priority threads. This must be set to a function not NULL. To silence the warning, assign this to a function that does nothing.

jack_info_callback: Option<unsafe extern "C" fn(msg: *const c_char)>

Optional: JACK info callback. By default, libsoundio sets this to an empty function in order to silence stdio messages from JACK. You may override the behavior by setting this to NULL or providing your own function. This is registered with JACK regardless of whether ::soundio_connect_backend succeeds.

jack_error_callback: Option<unsafe extern "C" fn(msg: *const c_char)>

Optional: JACK error callback. See SoundIo::jack_info_callback

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.