Expand description
§Interflow
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§
- Audio
Callback Context - 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.
- Audio
Input - 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. - Audio
Output - 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.
- Device
Type - Represents the types/capabilities of an audio device.
- Stream
Config - Configuration for an audio stream.
Traits§
- Audio
Device - 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.
- Audio
Driver - 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.
- Audio
Input Callback - Trait of types which process input audio data. This is the trait that users will want to implement when processing an input device.
- Audio
Input Device - Trait for types which can provide input streams.
- Audio
Output Callback - Trait of types which process output audio data. This is the trait that users will want to implement when processing an output device.
- Audio
Output Device - Trait for types which can provide output streams.
- Audio
Stream Handle - Trait for types which handles an audio stream (input or output).
- Send
Everywhere ButOn Web - Marker trait for values which are Send everywhere but on the web (as WASM does not yet have web targets.