Crate soundio_sys

Crate soundio_sys 

Source

Structs§

SoundIo
The size of this struct is not part of the API or ABI.
SoundIoChannelArea
The size of this struct is OK to use.
SoundIoChannelLayout
The size of this struct is OK to use.
SoundIoDevice
The size of this struct is not part of the API or ABI.
SoundIoInStream
The size of this struct is not part of the API or ABI.
SoundIoOutStream
The size of this struct is not part of the API or ABI.
SoundIoRingBuffer
SoundIoSampleRateRange
The size of this struct is OK to use.

Constants§

SOUNDIO_MAX_CHANNELS
SoundIoBackend_SoundIoBackendAlsa
SoundIoBackend_SoundIoBackendCoreAudio
SoundIoBackend_SoundIoBackendDummy
SoundIoBackend_SoundIoBackendJack
SoundIoBackend_SoundIoBackendNone
SoundIoBackend_SoundIoBackendPulseAudio
SoundIoBackend_SoundIoBackendWasapi
SoundIoChannelId_SoundIoChannelIdAmbisonicW
first order ambisonic channels
SoundIoChannelId_SoundIoChannelIdAmbisonicX
first order ambisonic channels
SoundIoChannelId_SoundIoChannelIdAmbisonicY
first order ambisonic channels
SoundIoChannelId_SoundIoChannelIdAmbisonicZ
first order ambisonic channels
SoundIoChannelId_SoundIoChannelIdAux
SoundIoChannelId_SoundIoChannelIdAux0
SoundIoChannelId_SoundIoChannelIdAux1
SoundIoChannelId_SoundIoChannelIdAux2
SoundIoChannelId_SoundIoChannelIdAux3
SoundIoChannelId_SoundIoChannelIdAux4
SoundIoChannelId_SoundIoChannelIdAux5
SoundIoChannelId_SoundIoChannelIdAux6
SoundIoChannelId_SoundIoChannelIdAux7
SoundIoChannelId_SoundIoChannelIdAux8
SoundIoChannelId_SoundIoChannelIdAux9
SoundIoChannelId_SoundIoChannelIdAux10
SoundIoChannelId_SoundIoChannelIdAux11
SoundIoChannelId_SoundIoChannelIdAux12
SoundIoChannelId_SoundIoChannelIdAux13
SoundIoChannelId_SoundIoChannelIdAux14
SoundIoChannelId_SoundIoChannelIdAux15
SoundIoChannelId_SoundIoChannelIdBackCenter
SoundIoChannelId_SoundIoChannelIdBackLeft
SoundIoChannelId_SoundIoChannelIdBackLeftCenter
< First of the less commonly supported ids.
SoundIoChannelId_SoundIoChannelIdBackRight
SoundIoChannelId_SoundIoChannelIdBackRightCenter
SoundIoChannelId_SoundIoChannelIdBottomCenter
SoundIoChannelId_SoundIoChannelIdBottomLeftCenter
SoundIoChannelId_SoundIoChannelIdBottomRightCenter
SoundIoChannelId_SoundIoChannelIdClickTrack
SoundIoChannelId_SoundIoChannelIdDialogCentricMix
< Last of the “other” channel ids
SoundIoChannelId_SoundIoChannelIdForeignLanguage
SoundIoChannelId_SoundIoChannelIdFrontCenter
SoundIoChannelId_SoundIoChannelIdFrontCenterHigh
SoundIoChannelId_SoundIoChannelIdFrontLeft
< First of the more commonly supported ids.
SoundIoChannelId_SoundIoChannelIdFrontLeftCenter
SoundIoChannelId_SoundIoChannelIdFrontLeftHigh
SoundIoChannelId_SoundIoChannelIdFrontLeftWide
SoundIoChannelId_SoundIoChannelIdFrontRight
SoundIoChannelId_SoundIoChannelIdFrontRightCenter
SoundIoChannelId_SoundIoChannelIdFrontRightHigh
SoundIoChannelId_SoundIoChannelIdFrontRightWide
SoundIoChannelId_SoundIoChannelIdHaptic
SoundIoChannelId_SoundIoChannelIdHeadphonesLeft
< First of the “other” channel ids
SoundIoChannelId_SoundIoChannelIdHeadphonesRight
SoundIoChannelId_SoundIoChannelIdHearingImpaired
SoundIoChannelId_SoundIoChannelIdInvalid
SoundIoChannelId_SoundIoChannelIdLeftLfe
SoundIoChannelId_SoundIoChannelIdLfe
SoundIoChannelId_SoundIoChannelIdLfe2
SoundIoChannelId_SoundIoChannelIdMsMid
Mid/side recording
SoundIoChannelId_SoundIoChannelIdMsSide
Mid/side recording
SoundIoChannelId_SoundIoChannelIdNarration
SoundIoChannelId_SoundIoChannelIdRightLfe
SoundIoChannelId_SoundIoChannelIdSideLeft
SoundIoChannelId_SoundIoChannelIdSideRight
SoundIoChannelId_SoundIoChannelIdTopBackCenter
SoundIoChannelId_SoundIoChannelIdTopBackLeft
SoundIoChannelId_SoundIoChannelIdTopBackRight
< Last of the more commonly supported ids.
SoundIoChannelId_SoundIoChannelIdTopCenter
SoundIoChannelId_SoundIoChannelIdTopFrontCenter
SoundIoChannelId_SoundIoChannelIdTopFrontLeft
SoundIoChannelId_SoundIoChannelIdTopFrontLeftCenter
SoundIoChannelId_SoundIoChannelIdTopFrontRight
SoundIoChannelId_SoundIoChannelIdTopFrontRightCenter
SoundIoChannelId_SoundIoChannelIdTopSideLeft
SoundIoChannelId_SoundIoChannelIdTopSideRight
SoundIoChannelId_SoundIoChannelIdXyX
X-Y Recording
SoundIoChannelId_SoundIoChannelIdXyY
X-Y Recording
SoundIoChannelLayoutId_SoundIoChannelLayoutId2Point1
SoundIoChannelLayoutId_SoundIoChannelLayoutId3Point0
SoundIoChannelLayoutId_SoundIoChannelLayoutId3Point0Back
SoundIoChannelLayoutId_SoundIoChannelLayoutId3Point1
SoundIoChannelLayoutId_SoundIoChannelLayoutId4Point0
SoundIoChannelLayoutId_SoundIoChannelLayoutId4Point1
SoundIoChannelLayoutId_SoundIoChannelLayoutId5Point0Back
SoundIoChannelLayoutId_SoundIoChannelLayoutId5Point0Side
SoundIoChannelLayoutId_SoundIoChannelLayoutId5Point1
SoundIoChannelLayoutId_SoundIoChannelLayoutId5Point1Back
SoundIoChannelLayoutId_SoundIoChannelLayoutId6Point0Front
SoundIoChannelLayoutId_SoundIoChannelLayoutId6Point0Side
SoundIoChannelLayoutId_SoundIoChannelLayoutId6Point1
SoundIoChannelLayoutId_SoundIoChannelLayoutId6Point1Back
SoundIoChannelLayoutId_SoundIoChannelLayoutId6Point1Front
SoundIoChannelLayoutId_SoundIoChannelLayoutId7Point0
SoundIoChannelLayoutId_SoundIoChannelLayoutId7Point0Front
SoundIoChannelLayoutId_SoundIoChannelLayoutId7Point1
SoundIoChannelLayoutId_SoundIoChannelLayoutId7Point1Wide
SoundIoChannelLayoutId_SoundIoChannelLayoutId7Point1WideBack
SoundIoChannelLayoutId_SoundIoChannelLayoutIdHexagonal
SoundIoChannelLayoutId_SoundIoChannelLayoutIdMono
SoundIoChannelLayoutId_SoundIoChannelLayoutIdOctagonal
SoundIoChannelLayoutId_SoundIoChannelLayoutIdQuad
SoundIoChannelLayoutId_SoundIoChannelLayoutIdQuadSide
SoundIoChannelLayoutId_SoundIoChannelLayoutIdStereo
SoundIoDeviceAim_SoundIoDeviceAimInput
< capture / recording
SoundIoDeviceAim_SoundIoDeviceAimOutput
< playback
SoundIoError_SoundIoErrorBackendDisconnected
Backend server shutdown or became inactive.
SoundIoError_SoundIoErrorBackendUnavailable
libsoundio was compiled without support for that backend.
SoundIoError_SoundIoErrorEncodingString
Unable to convert to or from UTF-8 to the native string format.
SoundIoError_SoundIoErrorIncompatibleBackend
Attempted to use parameters that the backend cannot support.
SoundIoError_SoundIoErrorIncompatibleDevice
Attempted to use a device with parameters it cannot support.
SoundIoError_SoundIoErrorInitAudioBackend
The backend does not appear to be active or running.
SoundIoError_SoundIoErrorInterrupted
Backend server shutdown or became inactive.
SoundIoError_SoundIoErrorInvalid
The programmer did not comply with the API.
SoundIoError_SoundIoErrorNoMem
Out of memory.
SoundIoError_SoundIoErrorNoSuchClient
When JACK returns JackNoSuchClient
SoundIoError_SoundIoErrorNoSuchDevice
Attempted to open a device and failed.
SoundIoError_SoundIoErrorNone
SoundIoError_SoundIoErrorOpeningDevice
Attempted to open a device and failed.
SoundIoError_SoundIoErrorStreaming
An open stream had an error that can only be recovered from by destroying the stream and creating it again.
SoundIoError_SoundIoErrorSystemResources
A system resource other than memory was not available.
SoundIoError_SoundIoErrorUnderflow
Buffer underrun occurred.
SoundIoFormat_SoundIoFormatFloat32BE
< Float 32 bit Big Endian, Range -1.0 to 1.0
SoundIoFormat_SoundIoFormatFloat32LE
< Float 32 bit Little Endian, Range -1.0 to 1.0
SoundIoFormat_SoundIoFormatFloat64BE
< Float 64 bit Big Endian, Range -1.0 to 1.0
SoundIoFormat_SoundIoFormatFloat64LE
< Float 64 bit Little Endian, Range -1.0 to 1.0
SoundIoFormat_SoundIoFormatInvalid
SoundIoFormat_SoundIoFormatS8
< Signed 8 bit
SoundIoFormat_SoundIoFormatS16BE
< Signed 16 bit Big Endian
SoundIoFormat_SoundIoFormatS16LE
< Signed 16 bit Little Endian
SoundIoFormat_SoundIoFormatS24BE
< Signed 24 bit Big Endian using low three bytes in 32-bit word
SoundIoFormat_SoundIoFormatS24LE
< Signed 24 bit Little Endian using low three bytes in 32-bit word
SoundIoFormat_SoundIoFormatS32BE
< Signed 32 bit Big Endian
SoundIoFormat_SoundIoFormatS32LE
< Signed 32 bit Little Endian
SoundIoFormat_SoundIoFormatU8
< Unsigned 8 bit
SoundIoFormat_SoundIoFormatU16BE
< Unsigned 16 bit Big Endian
SoundIoFormat_SoundIoFormatU16LE
< Unsigned 16 bit Little Endian
SoundIoFormat_SoundIoFormatU24BE
< Unsigned 24 bit Big Endian using low three bytes in 32-bit word
SoundIoFormat_SoundIoFormatU24LE
< Unsigned 24 bit Little Endian using low three bytes in 32-bit word
SoundIoFormat_SoundIoFormatU32BE
< Unsigned 32 bit Big Endian
SoundIoFormat_SoundIoFormatU32LE
< Unsigned 32 bit Little Endian
__bool_true_false_are_defined
false_
true_

Functions§

soundio_backend_count
Returns the number of available backends.
soundio_backend_name
Get a string representation of a #SoundIoBackend
soundio_best_matching_channel_layout
Iterates over preferred_layouts. Returns the first channel layout in preferred_layouts which matches one of the channel layouts in available_layouts. Returns NULL if none matches.
soundio_channel_layout_builtin_count
Returns the number of builtin channel layouts.
soundio_channel_layout_detect_builtin
Populates the name field of layout if it matches a builtin one. returns whether it found a match
soundio_channel_layout_equal
Returns whether the channel count field and each channel id matches in the supplied channel layouts.
soundio_channel_layout_find_channel
Return the index of channel in layout, or -1 if not found.
soundio_channel_layout_get_builtin
Returns a builtin channel layout. 0 <= index < ::soundio_channel_layout_builtin_count
soundio_channel_layout_get_default
Get the default builtin channel layout for the given number of channels.
soundio_connect
Tries ::soundio_connect_backend on all available backends in order. Possible errors:
soundio_connect_backend
Instead of calling ::soundio_connect you may call this function to try a specific backend. Possible errors:
soundio_create
Create a SoundIo context. You may create multiple instances of this to connect to multiple backends. Sets all fields to defaults. Returns NULL if and only if memory could not be allocated. See also ::soundio_destroy
soundio_default_input_device_index
returns the index of the default input device returns -1 if there are no devices or if you never called ::soundio_flush_events.
soundio_default_output_device_index
returns the index of the default output device returns -1 if there are no devices or if you never called ::soundio_flush_events.
soundio_destroy
soundio_device_equal
Return true if and only if the devices have the same SoundIoDevice::id, SoundIoDevice::is_raw, and SoundIoDevice::aim are the same.
soundio_device_nearest_sample_rate
Convenience function. Returns the available sample rate nearest to sample_rate, rounding up.
soundio_device_ref
Add 1 to the reference count of device.
soundio_device_sort_channel_layouts
Sorts channel layouts by channel count, descending.
soundio_device_supports_format
Convenience function. Returns whether format is included in the device’s supported formats.
soundio_device_supports_layout
Convenience function. Returns whether layout is included in the device’s supported channel layouts.
soundio_device_supports_sample_rate
Convenience function. Returns whether sample_rate is included in the device’s supported sample rates.
soundio_device_unref
Remove 1 to the reference count of device. Clean up if it was the last reference.
soundio_disconnect
soundio_flush_events
Atomically update information for all connected devices. Note that calling this function merely flips a pointer; the actual work of collecting device information is done elsewhere. It is performant to call this function many times per second.
soundio_force_device_scan
If necessary you can manually trigger a device rescan. Normally you will not ever have to call this function, as libsoundio listens to system events for device changes and responds to them by rescanning devices and preparing the new device information for you to be atomically replaced when you call ::soundio_flush_events. However you might run into cases where you want to force trigger a device rescan, for example if an ALSA device has a SoundIoDevice::probe_error.
soundio_format_string
Returns string representation of format.
soundio_get_backend
get the available backend at the specified index (0 <= index < ::soundio_backend_count)
soundio_get_bytes_per_sample
Returns -1 on invalid format.
soundio_get_channel_name
soundio_get_input_device
Always returns a device. Call ::soundio_device_unref when done. index must be 0 <= index < ::soundio_input_device_count Returns NULL if you never called ::soundio_flush_events or if you provide invalid parameter values.
soundio_get_output_device
Always returns a device. Call ::soundio_device_unref when done. index must be 0 <= index < ::soundio_output_device_count Returns NULL if you never called ::soundio_flush_events or if you provide invalid parameter values.
soundio_have_backend
Returns whether libsoundio was compiled with backend.
soundio_input_device_count
Get the number of input devices. Returns -1 if you never called ::soundio_flush_events.
soundio_instream_begin_read
Call this function when you are ready to begin reading from the device buffer.
soundio_instream_create
Allocates memory and sets defaults. Next you should fill out the struct fields and then call ::soundio_instream_open. Sets all fields to defaults. Returns NULL if and only if memory could not be allocated. See also ::soundio_instream_destroy
soundio_instream_destroy
You may not call this function from SoundIoInStream::read_callback.
soundio_instream_end_read
This will drop all of the frames from when you called ::soundio_instream_begin_read. You must call this function only from the SoundIoInStream::read_callback thread context. You must call this function only after a successful call to ::soundio_instream_begin_read.
soundio_instream_get_latency
Obtain the number of seconds that the next frame of sound being captured will take to arrive in the buffer, plus the amount of time that is represented in the buffer. This includes both software and hardware latency.
soundio_instream_open
After you call this function, SoundIoInStream::software_latency is set to the correct value. The next thing to do is call ::soundio_instream_start. If this function returns an error, the instream is in an invalid state and you must call ::soundio_instream_destroy on it.
soundio_instream_pause
If the underyling device supports pausing, this pauses the stream and prevents SoundIoInStream::read_callback from being called. Otherwise this returns #SoundIoErrorIncompatibleDevice. This function may be called from any thread. Pausing when already paused or unpausing when already unpaused has no effect and always returns #SoundIoErrorNone.
soundio_instream_start
After you call this function, SoundIoInStream::read_callback will be called.
soundio_output_device_count
Get the number of output devices. Returns -1 if you never called ::soundio_flush_events.
soundio_outstream_begin_write
Call this function when you are ready to begin writing to the device buffer.
soundio_outstream_clear_buffer
Clears the output stream buffer. This function can be called from any thread. This function can be called regardless of whether the outstream is paused or not. Some backends do not support clearing the buffer. On these backends this function will return SoundIoErrorIncompatibleBackend. Some devices do not support clearing the buffer. On these devices this function might return SoundIoErrorIncompatibleDevice. Possible errors:
soundio_outstream_create
Allocates memory and sets defaults. Next you should fill out the struct fields and then call ::soundio_outstream_open. Sets all fields to defaults. Returns NULL if and only if memory could not be allocated. See also ::soundio_outstream_destroy
soundio_outstream_destroy
You may not call this function from the SoundIoOutStream::write_callback thread context.
soundio_outstream_end_write
Commits the write that you began with ::soundio_outstream_begin_write. You must call this function only from the SoundIoOutStream::write_callback thread context.
soundio_outstream_get_latency
Obtain the total number of seconds that the next frame written after the last frame written with ::soundio_outstream_end_write will take to become audible. This includes both software and hardware latency. In other words, if you call this function directly after calling ::soundio_outstream_end_write, this gives you the number of seconds that the next frame written will take to become audible.
soundio_outstream_open
After you call this function, SoundIoOutStream::software_latency is set to the correct value.
soundio_outstream_pause
If the underlying backend and device support pausing, this pauses the stream. SoundIoOutStream::write_callback may be called a few more times if the buffer is not full. Pausing might put the hardware into a low power state which is ideal if your software is silent for some time. This function may be called from any thread context, including SoundIoOutStream::write_callback. Pausing when already paused or unpausing when already unpaused has no effect and returns #SoundIoErrorNone.
soundio_outstream_set_volume
soundio_outstream_start
After you call this function, SoundIoOutStream::write_callback will be called.
soundio_parse_channel_id
Given UTF-8 encoded text which is the name of a channel such as “Front Left”, “FL”, or “front-left”, return the corresponding SoundIoChannelId. Returns SoundIoChannelIdInvalid for no match.
soundio_ring_buffer_advance_read_ptr
count in bytes.
soundio_ring_buffer_advance_write_ptr
count in bytes.
soundio_ring_buffer_capacity
When you create a ring buffer, capacity might be more than the requested capacity for alignment purposes. This function returns the actual capacity.
soundio_ring_buffer_clear
Must be called by the writer.
soundio_ring_buffer_create
A ring buffer is a single-reader single-writer lock-free fixed-size queue. libsoundio ring buffers use memory mapping techniques to enable a contiguous buffer when reading or writing across the boundary of the ring buffer’s capacity. requested_capacity in bytes. Returns NULL if and only if memory could not be allocated. Use ::soundio_ring_buffer_capacity to get the actual capacity, which might be greater for alignment purposes. See also ::soundio_ring_buffer_destroy
soundio_ring_buffer_destroy
soundio_ring_buffer_fill_count
Returns how many bytes of the buffer is used, ready for reading.
soundio_ring_buffer_free_count
Returns how many bytes of the buffer is free, ready for writing.
soundio_ring_buffer_read_ptr
Do not read more than capacity.
soundio_ring_buffer_write_ptr
Do not write more than capacity.
soundio_sort_channel_layouts
Sorts by channel count, descending.
soundio_strerror
Get a string representation of a #SoundIoError
soundio_version_major
See also ::soundio_version_string, ::soundio_version_minor, ::soundio_version_patch
soundio_version_minor
See also ::soundio_version_major, ::soundio_version_string, ::soundio_version_patch
soundio_version_patch
See also ::soundio_version_major, ::soundio_version_minor, ::soundio_version_string
soundio_version_string
See also ::soundio_version_major, ::soundio_version_minor, ::soundio_version_patch
soundio_wait_events
This function calls ::soundio_flush_events then blocks until another event is ready or you call ::soundio_wakeup. Be ready for spurious wakeups.
soundio_wakeup
Makes ::soundio_wait_events stop blocking.

Type Aliases§

SoundIoBackend
SoundIoChannelId
Specifies where a channel is physically located.
SoundIoChannelLayoutId
Built-in channel layouts for convenience.
SoundIoDeviceAim
SoundIoError
See also ::soundio_strerror
SoundIoFormat
For your convenience, Native Endian and Foreign Endian constants are defined which point to the respective SoundIoFormat values.