@@ -404,6 +404,30 @@ impl<'a, S: Copy> IO<'a, S> {
404404 acheck ! ( snd_pcm_readi( ( self . 0 ) . 0 , buf. as_mut_ptr( ) as * mut c_void, self . to_frames( buf. len( ) ) ) ) . map ( |r| r as usize )
405405 }
406406
407+ /// Write non-interleaved frames to pcm. On success, returns number of frames written.
408+ ///
409+ /// # Safety
410+ ///
411+ /// Caller must ensure that the length of `bufs` is at least the number of
412+ /// channels, and that each element of bufs is a valid pointer to an array
413+ /// of at least `frames` length.
414+ pub unsafe fn writen ( & self , bufs : & [ * const S ] , frames : usize ) -> Result < usize > {
415+ let frames = frames as alsa:: snd_pcm_uframes_t ;
416+ acheck ! ( snd_pcm_writen( ( self . 0 ) . 0 , bufs. as_ptr( ) as * mut * mut c_void, frames) ) . map ( |r| r as usize )
417+ }
418+
419+ /// Read non-interleaved frames to pcm. On success, returns number of frames read.
420+ ///
421+ /// # Safety
422+ ///
423+ /// Caller must ensure that the length of `bufs` is at least the number of
424+ /// channels, and that each element of bufs is a valid pointer to an array
425+ /// of at least `frames` length.
426+ pub unsafe fn readn ( & self , bufs : & mut [ * mut S ] , frames : usize ) -> Result < usize > {
427+ let frames = frames as alsa:: snd_pcm_uframes_t ;
428+ acheck ! ( snd_pcm_readn( ( self . 0 ) . 0 , bufs. as_mut_ptr( ) as * mut * mut c_void, frames) ) . map ( |r| r as usize )
429+ }
430+
407431 /// Wrapper around snd_pcm_mmap_begin and snd_pcm_mmap_commit.
408432 ///
409433 /// You can read/write into the sound card's buffer during the call to the closure.
0 commit comments