SyroStream

Struct SyroStream 

Source
pub struct SyroStream { /* private fields */ }
Expand description

Builder struct for syrostream data.

Output from the generate or reset methods is uncompressed PCM data that can be used to write a .wav file.

Implementations§

Source§

impl SyroStream

Source

pub fn reset( data: Vec<u8>, compression: Option<u32>, ) -> Result<Vec<i16>, SyroError>

Generate stream from a .alldata file

Source

pub fn add_sample( &mut self, index: u32, data: Vec<i16>, sample_rate: u32, compression: Option<u32>, ) -> Result<&mut Self, SyroError>

Add a sample at the given index

The index must be in the range 0-99. If compression is desired it has to be in the range of 8-16 bits.

Note: there are currently no guards against using samples that are too large.

Source

pub fn erase_sample(&mut self, index: u32) -> Result<&mut Self, SyroError>

Erase the sample at the given index

The index must be in the range 0-99

Source

pub fn add_pattern( &mut self, index: usize, pattern: Pattern, ) -> Result<&mut Self, SyroError>

Add a Pattern at the given index

The index must be in the range 0-9

Source

pub fn generate(self) -> Result<Vec<i16>, SyroError>

Generates the syro stream

Ouptut is uncompressed PCM data

Trait Implementations§

Source§

impl Default for SyroStream

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.