MCPcopy Index your code
hub / github.com/HEnquist/wasapi-rs

github.com/HEnquist/wasapi-rs @v0.23.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.23.0 ↗ · + Follow
186 symbols 388 edges 16 files 134 documented · 72%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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.

Sponsor: Recall.ai - API for desktop recording

If you’re looking for a hosted desktop recording API, consider checking out Recall.ai, an API that records Zoom, Google Meet, Microsoft Teams, in-person meetings, and more.

Supported functionality

The following is a selection of the functionality currently available in the library:

  • Audio playback and capture
  • Shared and exclusive modes
  • Event-driven and polled buffering
  • Loopback capture
  • Notifications for volume change, device disconnect etc
  • …and additional features beyond this list

Included examples

Example Description
playsine Plays a sine wave in shared mode on the default output device.
playsine_events Similar to playsine but also listens to notifications.
playsine_poll Similar to playsine but uses polling instead of event driven timing mode.
playnoise_exclusive Plays white noise in exclusive mode on the default output device. Shows how to handle HRESULT errors.
playnoise_exclusive_poll Similar to playnoise_exclusive but uses polling instead of event driven timing mode.
loopback Shows how to simultaneously capture and render sound, with separate threads for capture and render.
record Records audio from the default device, and saves the raw samples to a file.
devices Lists all available audio devices and displays the default devices.
processes Lists all available audio capture devices and lists the processes that are using them.
record_application Records audio from a single application, and saves the raw samples to a file.
aec Captures audio with Acoustic Echo Cancellation (AEC) enabled and saves the raw data to a file.

Core symbols most depended-on inside this repo

initialize_client
called by 12
src/api.rs
get_blockalign
called by 12
src/waveformat.rs
initialize_mta
called by 11
src/api.rs
get_iaudioclient
called by 11
src/api.rs
get_device_period
called by 11
src/api.rs
start_stream
called by 10
src/api.rs
get_default_device
called by 9
src/api.rs
get_buffer_size
called by 9
src/api.rs

Shape

Method 127
Class 25
Function 22
Enum 12

Languages

Rust100%

Modules by API surface

src/api.rs115 symbols
src/events.rs26 symbols
src/waveformat.rs19 symbols
examples/playsine_poll.rs4 symbols
examples/playsine_events.rs4 symbols
examples/playsine.rs4 symbols
examples/loopback.rs3 symbols
examples/record_application.rs2 symbols
examples/record.rs2 symbols
examples/aec.rs2 symbols
src/errors.rs1 symbols
examples/processes.rs1 symbols

For agents

$ claude mcp add wasapi-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact