Skip to content

Commit a431c75

Browse files
{"schema":"decodex/commit/1","summary":"Fix non-macOS audio build","authority":"manual"}
1 parent 584f4c2 commit a431c75

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

packages/voxit-audio/Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ readme.workspace = true
99
repository.workspace = true
1010
version.workspace = true
1111

12-
[dependencies]
13-
hound = { workspace = true }
14-
tracing = { workspace = true }
15-
1612
[target.'cfg(target_os = "macos")'.dependencies]
1713
coreaudio = { workspace = true }
14+
hound = { workspace = true }
1815
objc2-audio-toolbox = { workspace = true }
16+
tracing = { workspace = true }

packages/voxit-audio/src/lib.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
//! Audio capture primitives for Voxit.
22
3+
use std::sync::mpsc::Receiver;
4+
#[cfg(target_os = "macos")]
35
use std::{
46
io::Cursor,
5-
sync::{
6-
Arc, Mutex,
7-
atomic::AtomicU64,
8-
mpsc,
9-
mpsc::{Receiver, SyncSender},
10-
},
7+
sync::{Arc, Mutex, atomic::AtomicU64, mpsc, mpsc::SyncSender},
118
time::Instant,
129
};
1310

@@ -18,8 +15,8 @@ use coreaudio::audio_unit::{
1815
macos_helpers,
1916
render_callback::{Args, data::Interleaved},
2017
};
21-
use coreaudio::error::Error;
22-
use hound::{WavSpec, WavWriter};
18+
#[cfg(target_os = "macos")] use coreaudio::error::Error;
19+
#[cfg(target_os = "macos")] use hound::{WavSpec, WavWriter};
2320
#[cfg(target_os = "macos")]
2421
use objc2_audio_toolbox::{
2522
kAudioOutputUnitProperty_CurrentDevice, kAudioOutputUnitProperty_EnableIO,
@@ -95,6 +92,7 @@ pub struct Recorder {
9592

9693
#[cfg(not(target_os = "macos"))]
9794
#[derive(Debug)]
95+
/// Stub recording handle for unsupported platforms.
9896
pub struct Recorder;
9997
#[cfg(target_os = "macos")]
10098
impl Recorder {
@@ -234,6 +232,7 @@ impl Recorder {
234232

235233
#[cfg(not(target_os = "macos"))]
236234
#[derive(Debug)]
235+
/// Stub recording payload for unsupported platforms.
237236
pub struct Recording;
238237

239238
#[cfg(not(target_os = "macos"))]

0 commit comments

Comments
 (0)