Skip to content

Commit 24ae99c

Browse files
authored
Merge pull request #37 from HEnquist/release_0.16
Release 0.16
2 parents 6daba44 + 957031b commit 24ae99c

File tree

8 files changed

+229
-159
lines changed

8 files changed

+229
-159
lines changed

Cargo.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "wasapi"
3-
version = "0.15.0"
3+
version = "0.16.0"
44
edition = "2021"
5-
rust-version = "1.59"
5+
rust-version = "1.74"
66
authors = ["HEnquist <henrik.enquist@gmail.com>"]
77
description = "Bindings for the Wasapi API on Windows"
88
license = "MIT"
@@ -13,9 +13,8 @@ readme = "README.md"
1313
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1414

1515
[dependencies.windows]
16-
version = "0.57"
16+
version = "0.59"
1717
features = ["Foundation",
18-
"implement",
1918
"Win32_Media_Audio",
2019
"Win32_Foundation",
2120
"Win32_Devices_FunctionDiscovery",
@@ -30,16 +29,17 @@ features = ["Foundation",
3029
"Win32_Security",]
3130

3231
[dependencies]
33-
widestring = "1.0.2"
34-
log = "0.4.18"
32+
widestring = "1.1.0"
33+
log = "0.4.22"
3534
num-integer = "0.1"
36-
windows-core = "0.57"
35+
windows-core = "0.59"
36+
thiserror = "2.0.9"
3737

3838
[dev-dependencies]
39-
simplelog = "0.12.1"
39+
simplelog = "0.12.2"
4040
rand = "0.8.5"
41-
sysinfo = "0.30.9"
41+
sysinfo = "0.33.1"
4242

4343
[package.metadata.docs.rs]
4444
default-target = "x86_64-pc-windows-msvc"
45-
targets = ["x86_64-pc-windows-msvc"]
45+
targets = ["x86_64-pc-windows-msvc"]

examples/playnoise_exclusive.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use wasapi::*;
44
#[macro_use]
55
extern crate log;
66
use simplelog::*;
7-
use windows::core::Error;
87

98
// A selection of the possible errors
109
use windows::Win32::Foundation::E_INVALIDARG;
@@ -62,7 +61,7 @@ fn main() {
6261
match init_result {
6362
Ok(()) => debug!("IAudioClient::Initialize ok"),
6463
Err(e) => {
65-
if let Some(werr) = e.downcast_ref::<Error>() {
64+
if let WasapiError::Windows(werr) = e {
6665
// Some of the possible errors. See the documentation for the full list and descriptions.
6766
// https://docs.microsoft.com/en-us/windows/win32/api/audioclient/nf-audioclient-iaudioclient-initialize
6867
match werr.code() {

examples/record_application.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::collections::VecDeque;
22
use std::error::{self};
3+
use std::ffi::OsStr;
34
use std::fs::File;
45
use std::io::prelude::*;
56
use std::sync::mpsc;
@@ -41,7 +42,8 @@ fn capture_loop(
4142

4243
let capture_client = audio_client.get_audiocaptureclient().unwrap();
4344

44-
let mut sample_queue: VecDeque<u8> = VecDeque::new(); // just eat the reallocation because querying the buffer size gives massive values.
45+
// just eat the reallocation because querying the buffer size gives massive values.
46+
let mut sample_queue: VecDeque<u8> = VecDeque::new();
4547

4648
audio_client.start_stream().unwrap();
4749

@@ -85,12 +87,13 @@ fn main() -> Res<()> {
8587
.build(),
8688
);
8789

88-
let refreshes = RefreshKind::new().with_processes(ProcessRefreshKind::everything());
90+
let refreshes = RefreshKind::nothing().with_processes(ProcessRefreshKind::everything());
8991
let system = System::new_with_specifics(refreshes);
90-
let process_ids = system.processes_by_name("firefox.exe");
92+
let process_ids = system.processes_by_name(OsStr::new("firefox.exe"));
9193
let mut process_id = 0;
9294
for process in process_ids {
93-
// Note: When capturing audio windows allows you to capture an app's entire process tree, however you must ensure you use the parent as the target process ID
95+
// Note: When capturing audio windows allows you to capture an app's entire process tree,
96+
// however you must ensure you use the parent as the target process ID
9497
process_id = process.parent().unwrap_or(process.pid()).as_u32();
9598
}
9699

0 commit comments

Comments
 (0)