diff --git a/src/pcm.rs b/src/pcm.rs index 4097751..55d4947 100644 --- a/src/pcm.rs +++ b/src/pcm.rs @@ -225,6 +225,7 @@ impl PCM { pub fn io_u8(&self) -> Result> { self.io_checked() } pub fn io_i16(&self) -> Result> { self.io_checked() } pub fn io_u16(&self) -> Result> { self.io_checked() } + pub fn io_s24(&self) -> Result> { self.verify_format(Format::s24()).map(|_| IO::new(self)) } pub fn io_i32(&self) -> Result> { self.io_checked() } pub fn io_u32(&self) -> Result> { self.io_checked() } pub fn io_f32(&self) -> Result> { self.io_checked() } @@ -1226,6 +1227,19 @@ fn record_from_default() { assert_eq!(pcm.io_i16().unwrap().readi(&mut buf).unwrap(), 1024/2); } +#[test] +fn open_s24() { + let pcm = PCM::open(c"default", Direction::Playback, false).unwrap(); + let hwp = HwParams::any(&pcm).unwrap(); + hwp.set_channels(1).unwrap(); + hwp.set_rate(44100, ValueOr::Nearest).unwrap(); + hwp.set_format(Format::s24()).unwrap(); + hwp.set_access(Access::RWInterleaved).unwrap(); + pcm.hw_params(&hwp).unwrap(); + assert_eq!(Format::s24().physical_width(), Ok(32)); + let _io = pcm.io_s24().unwrap(); +} + #[test] fn playback_to_default() { use std::ffi::CString;