diff --git a/CHANGELOG.md b/CHANGELOG.md index 75d8110b..6ada99d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.1 +Bugfixes: +- Alsa: Avoid opening capture and playback devices at the same time since this causes trouble with some devices. + ## 1.0.0 New features: - New improved CoreAudio backend. diff --git a/Cargo.toml b/Cargo.toml index 585ba4a4..30aece23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "camilladsp" -version = "1.0.0" +version = "1.0.1" authors = ["Henrik Enquist "] edition = "2021" description = "A flexible tool for processing audio" diff --git a/README.md b/README.md index c5b74ef2..a751a4c6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# CamillaDSP v1.0.0 +# CamillaDSP v1.0.1 ![CI test and lint](https://github.com/HEnquist/camilladsp/workflows/CI%20test%20and%20lint/badge.svg) A tool to create audio processing pipelines for applications such as active crossovers or room correction. It is written in Rust to benefit from the safety and elegant handling of threading that this language provides. diff --git a/src/alsadevice.rs b/src/alsadevice.rs index ad1fb0c4..3497d483 100644 --- a/src/alsadevice.rs +++ b/src/alsadevice.rs @@ -15,7 +15,7 @@ use rubato::VecResampler; use std::ffi::CString; use std::fmt::Debug; use std::sync::mpsc; -use std::sync::{Arc, Barrier, RwLock}; +use std::sync::{Arc, Barrier, Mutex, RwLock}; use std::thread; use std::time::{Duration, Instant}; @@ -26,6 +26,10 @@ use crate::Res; use crate::StatusMessage; use crate::{CaptureStatus, PlaybackStatus}; +lazy_static! { + static ref ALSA_MUTEX: Mutex<()> = Mutex::new(()); +} + const STANDARD_RATES: [u32; 17] = [ 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000, 352800, 384000, 705600, 768000, @@ -391,6 +395,8 @@ fn open_pcm( sample_format: &SampleFormat, capture: bool, ) -> Res { + // Acquire the lock + let _lock = ALSA_MUTEX.lock().unwrap(); // Open the device let pcmdev = if capture { alsa::PCM::new(&devname, Direction::Capture, true)?