/// Retrieves ownership over the input callback and returns it where it can be re-used or
/// safely dropped.
Retrieves ownership over the input callback and returns it where it can be re-used or
safely dropped.
Retrieves ownership over the input callback and returns it where it can be re - used or safely dropped .
pub fn free_input_callback(&mut self) -> Option<Box<InputProcFnWrapper>> {
        if let Some(input_callback) = self.maybe_input_callback.take() {
            let super::InputCallback { buffer_list, callback } = input_callback;
            unsafe {
                // Take ownership over the AudioBufferList in order to safely free it.
                let buffer_list: Box<sys::AudioBufferList> = Box::from_raw(buffer_list);
                // Free the allocated data from the individual audio buffers.
                let ptr = buffer_list.mBuffers.as_ptr() as *const sys::AudioBuffer;
                let len = buffer_list.mNumberBuffers as usize;
                let buffers: &[sys::AudioBuffer] = slice::from_raw_parts(ptr, len);
                for &buffer in buffers {
                    let ptr = buffer.mData as *mut u8;
                    let len = buffer.mDataByteSize as usize;
                    let cap = len;
                    let _ = Vec::from_raw_parts(ptr, len, cap);
                }
                // Take ownership over the callback so that it can be freed.
                let callback: Box<InputProcFnWrapper> = Box::from_raw(callback);
                return Some(callback);
            }
        }
        None
    }
pub fn free_input_callback ( & mut self ) -> Option < Box < InputProcFnWrapper > > { if let Some ( input_callback ) = self . maybe_input_callback . take ( ) { let super :: InputCallback { buffer_list , callback } = input_callback ; unsafe { // Take ownership over the AudioBufferList in order to safely free it. let buffer_list : Box < sys :: AudioBufferList > = Box :: from_raw ( buffer_list ) ; // Free the allocated data from the individual audio buffers. let ptr = buffer_list . mBuffers . as_ptr ( ) as * const sys :: AudioBuffer ; let len = buffer_list . mNumberBuffers as usize ; let buffers : & [ sys :: AudioBuffer ] = slice :: from_raw_parts ( ptr , len ) ; for & buffer in buffers { let ptr = buffer . mData as * mut u8 ; let len = buffer . mDataByteSize as usize ; let cap = len ; let _ = Vec :: from_raw_parts ( ptr , len , cap ) ; } // Take ownership over the callback so that it can be freed. let callback : Box < InputProcFnWrapper > = Box :: from_raw ( callback ) ; return Some ( callback ) ; } } None }
Retrieves ownership over the input callback and returns it where it can be re-used or
safely dropped.
Retrieves ownership over the input callback and returns it where it can be re - used or safely dropped .
&mut self