Skip to content
Open
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
25 changes: 22 additions & 3 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,24 @@ jobs:
features: --all-features
os: ubuntu-latest

# Linux - ALSA backend, default features
- target: x86_64-unknown-linux-gnu
name: Linux-default
features: ""
os: ubuntu-latest

# Windows - WASAPI backend
- target: x86_64-pc-windows-msvc
name: Windows-x64
features: --all-features
os: windows-latest

# Windows - WASAPI backend, default features
- target: x86_64-pc-windows-msvc
name: Windows-x64-default
features: ""
os: windows-latest

# Windows 32-bit - WASAPI backend
- target: i686-pc-windows-msvc
name: Windows-x86
Expand All @@ -59,6 +71,12 @@ jobs:
features: --all-features
os: ubuntu-latest

# macOS - CoreAudio backend, default features
- target: aarch64-apple-darwin
name: macOS-default
features: ""
os: ubuntu-latest

# Android - Oboe backend
- target: armv7-linux-androideabi
name: Android
Expand Down Expand Up @@ -105,7 +123,8 @@ jobs:
packages: libasound2-dev libjack-jackd2-dev libjack-jackd2-0 libdbus-1-dev libpipewire-0.3-dev

- name: Setup ASIO SDK
if: runner.os == 'Windows'
# Only rows that build ASIO need the SDK; `--all-features` enables it.
if: runner.os == 'Windows' && contains(matrix.features, 'all-features')
run: |
curl -L -o asio.zip https://www.steinberg.net/asiosdk
7z x -oasio asio.zip
Expand All @@ -127,7 +146,7 @@ jobs:
- name: Run clippy
env:
CPAL_ASIO_DIR: ${{ runner.os == 'Windows' && format('{0}/asio', github.workspace) || '' }}
run: cargo clippy --all --target ${{ matrix.target }} ${{ matrix.features }} -- -D warnings
run: cargo clippy --workspace --all-targets --target ${{ matrix.target }} ${{ matrix.features }} -- -D warnings

docs:
strategy:
Expand Down Expand Up @@ -209,4 +228,4 @@ jobs:
- name: Run clippy
env:
RUSTFLAGS: ${{ matrix.rustflags }}
run: cargo +nightly clippy --all --target ${{ matrix.target }} ${{ matrix.features }} -Z build-std=${{ matrix.build_std }} -- -D warnings
run: cargo +nightly clippy --workspace --all-targets --target ${{ matrix.target }} ${{ matrix.features }} -Z build-std=${{ matrix.build_std }} -- -D warnings
9 changes: 6 additions & 3 deletions src/host/coreaudio/ios/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,10 @@ where

#[cfg(test)]
mod tests {
use crate::{BufferSize, SampleRate, StreamConfig};
use crate::{
BufferSize, CallbackInfo, StreamConfig,
traits::{DeviceTrait, HostTrait},
};

#[test]
fn test_ios_fixed_buffer_size() {
Expand All @@ -776,12 +779,12 @@ mod tests {

let config = StreamConfig {
channels: 2,
sample_rate: SampleRate(48000),
sample_rate: 48_000,
buffer_size: BufferSize::Fixed(512),
};

let result = device.build_output_stream(
&config,
config,
|_data: &mut [f32], _info: &CallbackInfo| {},
|_err| {},
None,
Expand Down
9 changes: 5 additions & 4 deletions src/host/coreaudio/macos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,9 @@ impl DefaultOutputMonitor {

// These listeners target a specific device, so they must be re-registered against
// whatever device is current whenever the default output reroutes.
// Held only to shut down the previous listener thread on drop when reassigned below.
// Held only to shut down the previous listener thread when the sender is dropped below.
let buffer_size_listener: BufferSizeListener = Arc::new(Mutex::new(None));
let mut _overload_shutdown_tx = match default_output_device() {
let mut overload_shutdown_tx = match default_output_device() {
Some(device) => {
set_buffer_size_listener(
&buffer_size_listener,
Expand Down Expand Up @@ -448,7 +448,7 @@ impl DefaultOutputMonitor {
}
match default_output_device() {
None => {
_overload_shutdown_tx = None;
drop(overload_shutdown_tx.take());
set_buffer_size_listener(&buffer_size_listener_thread, None);
report_lost(
stream,
Expand All @@ -463,9 +463,10 @@ impl DefaultOutputMonitor {
// DefaultOutput AudioUnit rerouted automatically: recompute and notify
// the buffer depth for the new device.
refresh_latency(stream, &latency_refresh);
_overload_shutdown_tx =
let replacement =
spawn_overload_listener(device.audio_device_id, pending_xrun.clone())
.ok();
drop(std::mem::replace(&mut overload_shutdown_tx, replacement));
// Skipped once the monitor is dropped: there is nothing left to notify.
set_buffer_size_listener(
&buffer_size_listener_thread,
Expand Down
2 changes: 1 addition & 1 deletion src/host/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ pub(crate) use error_emit::try_emit_error;
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "windows",
target_vendor = "apple",
all(target_os = "windows", any(feature = "asio", feature = "jack")),
all(
target_arch = "wasm32",
target_os = "unknown",
Expand Down
Loading