Crate soundio_sys[][src]

Structs

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

The size of this struct is OK to use.

The size of this struct is OK to use.

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

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

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

The size of this struct is OK to use.

Constants

first order ambisonic channels

first order ambisonic channels

first order ambisonic channels

first order ambisonic channels

< First of the less commonly supported ids.

< Last of the “other” channel ids

< First of the more commonly supported ids.

< First of the “other” channel ids

< Last of the more commonly supported ids.

Backend server shutdown or became inactive.

libsoundio was compiled without support for that backend.

Unable to convert to or from UTF-8 to the native string format.

Attempted to use parameters that the backend cannot support.

Attempted to use a device with parameters it cannot support.

The backend does not appear to be active or running.

Backend server shutdown or became inactive.

The programmer did not comply with the API.

When JACK returns JackNoSuchClient

Attempted to open a device and failed.

Attempted to open a device and failed.

An open stream had an error that can only be recovered from by destroying the stream and creating it again.

A system resource other than memory was not available.

Buffer underrun occurred.

< Float 32 bit Big Endian, Range -1.0 to 1.0

< Float 32 bit Little Endian, Range -1.0 to 1.0

< Float 64 bit Big Endian, Range -1.0 to 1.0

< Float 64 bit Little Endian, Range -1.0 to 1.0

< Signed 16 bit Big Endian

< Signed 16 bit Little Endian

< Signed 24 bit Big Endian using low three bytes in 32-bit word

< Signed 24 bit Little Endian using low three bytes in 32-bit word

< Signed 32 bit Big Endian

< Signed 32 bit Little Endian

< Unsigned 16 bit Big Endian

< Unsigned 16 bit Little Endian

< Unsigned 24 bit Big Endian using low three bytes in 32-bit word

< Unsigned 24 bit Little Endian using low three bytes in 32-bit word

< Unsigned 32 bit Big Endian

< Unsigned 32 bit Little Endian

Functions

Returns the number of available backends.

Get a string representation of a #SoundIoBackend

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.

Returns the number of builtin channel layouts.

Populates the name field of layout if it matches a builtin one. returns whether it found a match

Returns whether the channel count field and each channel id matches in the supplied channel layouts.

Return the index of channel in layout, or -1 if not found.

Returns a builtin channel layout. 0 <= index < ::soundio_channel_layout_builtin_count

Get the default builtin channel layout for the given number of channels.

Tries ::soundio_connect_backend on all available backends in order. Possible errors:

Instead of calling ::soundio_connect you may call this function to try a specific backend. Possible errors:

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

returns the index of the default input device returns -1 if there are no devices or if you never called ::soundio_flush_events.

returns the index of the default output device returns -1 if there are no devices or if you never called ::soundio_flush_events.

Return true if and only if the devices have the same SoundIoDevice::id, SoundIoDevice::is_raw, and SoundIoDevice::aim are the same.

Convenience function. Returns the available sample rate nearest to sample_rate, rounding up.

Add 1 to the reference count of device.

Sorts channel layouts by channel count, descending.

Convenience function. Returns whether format is included in the device’s supported formats.

Convenience function. Returns whether layout is included in the device’s supported channel layouts.

Convenience function. Returns whether sample_rate is included in the device’s supported sample rates.

Remove 1 to the reference count of device. Clean up if it was the last reference.

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.

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.

Returns string representation of format.

get the available backend at the specified index (0 <= index < ::soundio_backend_count)

Returns -1 on invalid format.

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.

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.

Returns whether libsoundio was compiled with backend.

Get the number of input devices. Returns -1 if you never called ::soundio_flush_events.

Call this function when you are ready to begin reading from the device buffer.

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

You may not call this function from SoundIoInStream::read_callback.

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.

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.

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.

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.

After you call this function, SoundIoInStream::read_callback will be called.

Get the number of output devices. Returns -1 if you never called ::soundio_flush_events.

Call this function when you are ready to begin writing to the device 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:

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

You may not call this function from the SoundIoOutStream::write_callback thread context.

Commits the write that you began with ::soundio_outstream_begin_write. You must call this function only from the SoundIoOutStream::write_callback thread context.

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.

After you call this function, SoundIoOutStream::software_latency is set to the correct value.

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.

After you call this function, SoundIoOutStream::write_callback will be called.

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.

When you create a ring buffer, capacity might be more than the requested capacity for alignment purposes. This function returns the actual capacity.

Must be called by the writer.

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

Returns how many bytes of the buffer is used, ready for reading.

Returns how many bytes of the buffer is free, ready for writing.

Do not read more than capacity.

Do not write more than capacity.

Sorts by channel count, descending.

Get a string representation of a #SoundIoError

See also ::soundio_version_string, ::soundio_version_minor, ::soundio_version_patch

See also ::soundio_version_major, ::soundio_version_string, ::soundio_version_patch

See also ::soundio_version_major, ::soundio_version_minor, ::soundio_version_string

See also ::soundio_version_major, ::soundio_version_minor, ::soundio_version_patch

This function calls ::soundio_flush_events then blocks until another event is ready or you call ::soundio_wakeup. Be ready for spurious wakeups.

Makes ::soundio_wait_events stop blocking.

Type Definitions

Specifies where a channel is physically located.

Built-in channel layouts for convenience.

See also ::soundio_strerror

For your convenience, Native Endian and Foreign Endian constants are defined which point to the respective SoundIoFormat values.