Skip to content

Release0.18 #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasapi"
version = "0.17.0"
version = "0.18.0"
edition = "2021"
rust-version = "1.74"
authors = ["HEnquist <[email protected]>"]
Expand All @@ -13,7 +13,7 @@ readme = "README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies.windows]
version = "0.59"
version = "0.61"
features = ["Foundation",
"Win32_Media_Audio",
"Win32_Foundation",
Expand All @@ -32,7 +32,7 @@ features = ["Foundation",
widestring = "1.1.0"
log = "0.4.22"
num-integer = "0.1"
windows-core = "0.59"
windows-core = "0.61"
thiserror = "2.0.9"

[dev-dependencies]
Expand Down
13 changes: 7 additions & 6 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@ impl AudioClient {
}
}

/// Check if the Acoustic Echo Cancellation (AEC) effect is currently present.
fn is_aec_effect_present(&self) -> WasapiRes<bool> {
// IAudioEffectsManager requires Windows 11 (build 22000 or higher).
let audio_effects_manager = match self.get_audio_effects_manager() {
Expand Down Expand Up @@ -1188,7 +1189,7 @@ pub struct AudioSessionControl {
}

impl AudioSessionControl {
/// Get the current state
/// Get the current session state
pub fn get_state(&self) -> WasapiRes<SessionState> {
let state = unsafe { self.control.GetState()? };
#[allow(non_upper_case_globals)]
Expand Down Expand Up @@ -1273,7 +1274,7 @@ pub struct AudioRenderClient {
impl AudioRenderClient {
/// Write raw bytes data to a device from a slice.
/// The number of frames to write should first be checked with the
/// `get_available_space_in_frames()` method on the [AudioClient].
/// [AudioClient::get_available_space_in_frames()] method.
/// The buffer_flags argument can be used to mark a buffer as silent.
pub fn write_to_device(
&self,
Expand Down Expand Up @@ -1305,7 +1306,7 @@ impl AudioRenderClient {

/// Write raw bytes data to a device from a deque.
/// The number of frames to write should first be checked with the
/// `get_available_space_in_frames()` method on the [AudioClient].
/// [AudioClient::get_available_space_in_frames()] method.
/// The buffer_flags argument can be used to mark a buffer as silent.
pub fn write_to_device_from_deque(
&self,
Expand Down Expand Up @@ -1392,7 +1393,7 @@ pub struct AudioCaptureClient {

impl AudioCaptureClient {
/// Get number of frames in next packet when in shared mode.
/// In exclusive mode it returns None, instead use [AudioClient::get_buffer_size()] or [AudioClient::get_current_padding()].
/// In exclusive mode it returns `None`, instead use [AudioClient::get_buffer_size()] or [AudioClient::get_current_padding()].
/// See [IAudioCaptureClient::GetNextPacketSize](https://learn.microsoft.com/en-us/windows/win32/api/audioclient/nf-audioclient-iaudiocaptureclient-getnextpacketsize).
pub fn get_next_packet_size(&self) -> WasapiRes<Option<u32>> {
if let Some(ShareMode::Exclusive) = self.sharemode {
Expand All @@ -1411,7 +1412,7 @@ impl AudioCaptureClient {
}

/// Read raw bytes from a device into a slice. Returns the number of frames
/// that was read, and the BufferFlags describing the buffer that the data was read from.
/// that was read, and the `BufferFlags` describing the buffer that the data was read from.
/// The slice must be large enough to hold all data.
/// If it is longer that needed, the unused elements will not be modified.
pub fn read_from_device(&self, data: &mut [u8]) -> WasapiRes<(u32, BufferFlags)> {
Expand Down Expand Up @@ -1548,7 +1549,7 @@ impl AcousticEchoCancellationControl {
/// # Parameters
/// - `endpoint_id`: An optional string containing the device ID of the audio render endpoint to use as the loopback reference.
/// If set to `None`, Windows will automatically select the reference device.
/// You can obtain the device ID by calling [`Device::get_id`].
/// You can obtain the device ID by calling [Device::get_id()].
///
/// # Errors
/// Returns an error if setting the echo cancellation render endpoint fails.
Expand Down
3 changes: 1 addition & 2 deletions src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::slice;
use widestring::U16CString;
use windows::{
core::{implement, Result, GUID, PCWSTR},
Win32::Foundation::BOOL,
Win32::Media::Audio::{
AudioSessionDisconnectReason, AudioSessionState, AudioSessionStateActive,
AudioSessionStateExpired, AudioSessionStateInactive, DisconnectReasonDeviceRemoval,
Expand Down Expand Up @@ -224,7 +223,7 @@ impl IAudioSessionEvents_Impl for AudioSessionEvents_Impl {
fn OnSimpleVolumeChanged(
&self,
newvolume: f32,
newmute: BOOL,
newmute: windows_core::BOOL,
eventcontext: *const GUID,
) -> Result<()> {
trace!("New volume: {}, mute: {:?}", newvolume, newmute);
Expand Down