Crate interflow

Source
Expand description

§Interflow

Contributor Covenant GitHub branch check runs GitHub issue custom search in repo Discord

Interflow is a Rust library that abstracts away platform-specific audio APIs and provides a unified, opinionated interface for audio applications. It aims to simplify the development of audio applications by offering seamless support for duplex audio with separate input and output devices, as well as sample rate and format conversion.

§Features

  • Unified interface for platform-specific audio APIs.
  • Support for duplex audio (simultaneous input and output).
  • Separate input and output devices.
  • Sample rate conversion.
  • Format conversion.

§Supported drivers

  • WASAPI
  • ASIO
  • ALSA
  • PulseAudio
  • PipeWire
  • JACK
  • CoreAudio

§Getting Started

§Prerequisites

Ensure you have the following installed on your system:

  • Rust (1.84 and up supported)
  • Platform-specific audio development libraries:
  • Windows: Ensure you have the Windows SDK installed, and optionally the ASIO SDK if the asio feature is enabled.
  • macOS: Xcode and its command line tools should be installed.
  • Linux: Development libraries for ALSA (Advanced Linux Sound Architecture), PulseAudio, PipeWire, or JACK are only required if their relevant features are enabled (by default, only alsa is).

§Building

Interflow uses cargo for dependency management and building.

Modules§

audio_buffer
Audio buffer types and traits for audio data manipulation.
backends
Backends
channel_map
This module provides functionality for working with bitsets and channel mapping.
duplex
Module for simultaneous input/output audio processing
prelude
Prelude module for interflow. Use as a star-import.
timestamp
Module for handling timestamp and duration calculations in audio processing.

Structs§

AudioCallbackContext
Plain-old-data object holding the passed-in stream configuration, as well as a general callback timestamp, which can be different from the input and output streams in case of cross-stream latencies; differences in timing can indicate desync.
AudioInput
Plain-old-data object holding references to the audio buffer and the associated time-keeping Timestamp. This timestamp is associated with the stream, and in the cases where the driver provides timing information, it is used instead of relying on sample-counting.
AudioOutput
Plain-old-data object holding references to the audio buffer and the associated time-keeping Timestamp. This timestamp is associated with the stream, and in the cases where the driver provides timing information, it is used instead of relying on sample-counting.
Channel
Audio channel description.
DeviceType
Represents the types/capabilities of an audio device.
StreamConfig
Configuration for an audio stream.

Traits§

AudioDevice
Trait for types describing audio devices. Audio devices have zero or more inputs and outputs, and depending on the driver, can be duplex devices which can provide both of them at the same time natively.
AudioDriver
Audio drivers provide access to the inputs and outputs of devices. Several drivers might provide the same accesses, some sharing it with other applications, while others work in exclusive mode.
AudioInputCallback
Trait of types which process input audio data. This is the trait that users will want to implement when processing an input device.
AudioInputDevice
Trait for types which can provide input streams.
AudioOutputCallback
Trait of types which process output audio data. This is the trait that users will want to implement when processing an output device.
AudioOutputDevice
Trait for types which can provide output streams.
AudioStreamHandle
Trait for types which handles an audio stream (input or output).
SendEverywhereButOnWeb
Marker trait for values which are Send everywhere but on the web (as WASM does not yet have web targets.