pub fn list_channels(&self) -> Option<Vec<ChannelInfo>> {
        let mut ptr = ptr::null_mut() as *mut csound_sys::controlChannelInfo_t;
        let ptr2: *mut *mut csound_sys::controlChannelInfo_t = &mut ptr as *mut *mut _;

        unsafe {
            let count = csound_sys::csoundListChannels(self.engine.csound, ptr2) as i32;
            let mut ptr = *ptr2;

            if count > 0 {
                let mut list = Vec::new();
                for _ in 0..count {
                    let name = match Trampoline::ptr_to_string((*ptr).name) {
                        Some(string) => string,
                        None => "".into(),
                    };

                    let ctype = (*ptr).type_ as i32;
                    let hints = (*ptr).hints;

                    let attributes = match Trampoline::ptr_to_string(hints.attributes) {
                        Some(string) => string,
                        None => "".into(),
                    };

                    list.push(ChannelInfo {
                        name,
                        type_: ctype,
                        hints: ChannelHints {
                            behav: ChannelBehavior::from_u32(hints.behav as u32),
                            dflt: hints.dflt as f64,
                            min: hints.min as f64,
                            max: hints.max as f64,
                            x: hints.x as i32,
                            y: hints.y as i32,
                            width: hints.width as i32,
                            height: hints.height as i32,
                            attributes,
                        },
                    });
                    ptr = ptr.add(1);
                }
                csound_sys::csoundDeleteChannelList(self.engine.csound, *ptr2);
                return Some(list);
            }
            None
        }
    }
/// Requests a list of all control channels.
/// # Returns
/// A vector with all control channels info or None if there are not control channels. see: [`ChannelInfo`](struct.ChannelInfo.html)
Requests a list of all control channels.
Requests a list of all control channels .
pub fn list_channels(&self) -> Option<Vec<ChannelInfo>> {
        let mut ptr = ptr::null_mut() as *mut csound_sys::controlChannelInfo_t;
        let ptr2: *mut *mut csound_sys::controlChannelInfo_t = &mut ptr as *mut *mut _;
        unsafe {
            let count = csound_sys::csoundListChannels(self.engine.csound, ptr2) as i32;
            let mut ptr = *ptr2;
            if count > 0 {
                let mut list = Vec::new();
                for _ in 0..count {
                    let name = match Trampoline::ptr_to_string((*ptr).name) {
                        Some(string) => string,
                        None => "".into(),
                    };
                    let ctype = (*ptr).type_ as i32;
                    let hints = (*ptr).hints;
                    let attributes = match Trampoline::ptr_to_string(hints.attributes) {
                        Some(string) => string,
                        None => "".into(),
                    };
                    list.push(ChannelInfo {
                        name,
                        type_: ctype,
                        hints: ChannelHints {
                            behav: ChannelBehavior::from_u32(hints.behav as u32),
                            dflt: hints.dflt as f64,
                            min: hints.min as f64,
                            max: hints.max as f64,
                            x: hints.x as i32,
                            y: hints.y as i32,
                            width: hints.width as i32,
                            height: hints.height as i32,
                            attributes,
                        },
                    });
                    ptr = ptr.add(1);
                }
                csound_sys::csoundDeleteChannelList(self.engine.csound, *ptr2);
                return Some(list);
            }
            None
        }
    }
pub fn list_channels ( & self ) -> Option < Vec < ChannelInfo > > { let mut ptr = ptr :: null_mut ( ) as * mut csound_sys :: controlChannelInfo_t ; let ptr2 : * mut * mut csound_sys :: controlChannelInfo_t = & mut ptr as * mut * mut _ ; unsafe { let count = csound_sys :: csoundListChannels ( self . engine . csound , ptr2 ) as i32 ; let mut ptr = * ptr2 ; if count > 0 { let mut list = Vec :: new ( ) ; for _ in 0 .. count { let name = match Trampoline :: ptr_to_string ( ( * ptr ) . name ) { Some ( string ) => string , None => " " . into ( ) , } ; let ctype = ( * ptr ) . type_ as i32 ; let hints = ( * ptr ) . hints ; let attributes = match Trampoline :: ptr_to_string ( hints . attributes ) { Some ( string ) => string , None => " " . into ( ) , } ; list . push ( ChannelInfo { name , type_ : ctype , hints : ChannelHints { behav : ChannelBehavior :: from_u32 ( hints . behav as u32 ) , dflt : hints . dflt as f64 , min : hints . min as f64 , max : hints . max as f64 , x : hints . x as i32 , y : hints . y as i32 , width : hints . width as i32 , height : hints . height as i32 , attributes , } , } ) ; ptr = ptr . add ( 1 ) ; } csound_sys :: csoundDeleteChannelList ( self . engine . csound , * ptr2 ) ; return Some ( list ) ; } None } }
Requests a list of all control channels.
Requests a list of all control channels .
&self
A vector with all control channels info or None if there are not control channels. see: [`ChannelInfo`](struct.ChannelInfo.html)
A vector with all control channels info or None if there are not control channels . see : [ ` ChannelInfo ` ] ( struct . ChannelInfo . html )
&self