[−][src]Struct csound::Table
Csound table representation. This struct is build up to manipulate directly a csound's table.
Methods
impl<'a> Table<'a>[src]
pub fn get_size(&self) -> usize[src]
Returns
The table length
pub fn as_slice(&self) -> &[f64][src]
Returns
A slice representation with the table's internal data
pub fn as_mut_slice(&mut self) -> &mut [f64][src]
Returns
A mutable slice representation with the table's internal data
pub fn copy_to_slice(&self, slice: &mut [f64]) -> usize[src]
method used to copy data from the table internal buffer into an user buffer. A error message is returned if the Table is not longer valid.
Arguments
sliceA slice where out.len() elements from the table will be copied.
Returns
The number of elements copied into the output slice.
Example
let cs = Csound::new(); cs.compile_csd("some.csd"); cs.start().unwrap(); while cs.perform_ksmps() == false { let mut table = cs.get_table(1).unwrap(); let mut table_buff = vec![0f64; table.length]; // copy Table::length elements from the table's internal buffer table.copy_to_slice( table_buff.as_mut_slice() ).unwrap(); // Do some stuffs }
pub fn copy_from_slice(&self, slice: &[f64]) -> usize[src]
method used to copy data into the table internal buffer from an user slice.
Arguments
sliceA slice where input.len() elements will be copied.
Returns
The number of elements copied into the table
Example
let cs = Csound::new(); cs.compile_csd("some.csd"); cs.start().unwrap(); while cs.perform_ksmps() == false { let mut table = cs.get_table(1).unwrap(); let mut table_buff = vec![0f64; table.length]; // copy Table::length elements from the table's internal buffer table.read( table_buff.as_mut_slice() ).unwrap(); // Do some stuffs table.copy_from_slice(&table_buff.into_iter().map(|x| x*2.5).collect::<Vec<f64>>().as_mut_slice()); // Do some stuffs }
Trait Implementations
impl<'a> AsRef<[f64]> for Table<'a>[src]
impl<'a> AsMut<[f64]> for Table<'a>[src]
impl<'a> Deref for Table<'a>[src]
impl<'a> DerefMut for Table<'a>[src]
impl<'a> Debug for Table<'a>[src]
Auto Trait Implementations
impl<'a> Unpin for Table<'a>
impl<'a> !Sync for Table<'a>
impl<'a> !Send for Table<'a>
impl<'a> UnwindSafe for Table<'a>
impl<'a> RefUnwindSafe for Table<'a>
Blanket Implementations
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,