Crate wasapi[−][src]
Expand description
Wasapi bindings for Rust
The aim of this crate is to provide easy and safe access to the Wasapi API for audio playback and capture.
The presented API is all safe Rust, but structs and functions closely follow the original Windows API.
For details on how to use Wasapi, please see the Windows documentation.
Bindings are generated automatically using the windows crate.
Supported functionality
These things have been implemented so far:
- Audio playback and capture
- Shared and exclusive modes
- Loopback capture
- Notifications for volume change, device disconnect etc
Examples
-
The
playsine
example plays a sine wave in shared mode on the default output device. -
The
playsine_events
example is similar toplaysine
but also listens to notifications. -
The
loopback
example shows how to simultaneously capture and render sound, with separate threads for capture and render.
Modules
Structs
Struct wrapping an IAudioCaptureClient.
Struct wrapping an IAudioClient.
Struct wrapping an IAudioRenderClient.
Struct wrapping an IAudioSessionControl.
Struct wrapping an IMMDevice.
Struct wrapping an IMMDeviceCollection.
A structure holding the callbacks for notifications
A globally unique identifier (GUID) used to identify COM and WinRT interfaces.
Struct wrapping a HANDLE (event handle).
Error returned by the Wasapi crate.
Struct wrapping a WAVEFORMATEXTENSIBLE format descriptor.
Enums
Audio direction, playback or capture.
Reason for session disconnect
Sample type, float or integer
States of an AudioSession
Sharemode for device
Functions
Get the default playback or capture device
Initializes COM for use by the calling thread for the multi-threaded apartment (MTA).
Initializes COM for use by the calling thread for a single-threaded apartment (STA).