Song

Struct Song 

Source
pub struct Song {
    pub global_volume: u8,
    pub mix_volume: u8,
    pub initial_speed: NonZero<u8>,
    pub initial_tempo: NonZero<u8>,
    pub pan_separation: u8,
    pub pitch_wheel_depth: u8,
    pub patterns: [Pattern; 240],
    pub pattern_order: [PatternOrder; 256],
    pub volume: [u8; 64],
    pub pan: [Pan; 64],
    pub samples: [Option<(SampleMetaData, Sample)>; 236],
}

Fields§

§global_volume: u8§mix_volume: u8§initial_speed: NonZero<u8>

Speed specifies how many ticks are in one row. This reduces tempo, but increases resolution of some effects.

§initial_tempo: NonZero<u8>

Tempo determines how many ticks are in one second with the following formula: tempo/2 = ticks per second.

§pan_separation: u8§pitch_wheel_depth: u8§patterns: [Pattern; 240]§pattern_order: [PatternOrder; 256]§volume: [u8; 64]§pan: [Pan; 64]§samples: [Option<(SampleMetaData, Sample)>; 236]

Implementations§

Source§

impl Song

Source

pub const MAX_ORDERS: usize = 256usize

Source

pub const MAX_PATTERNS: usize = 240usize

Source

pub const MAX_SAMPLES_INSTR: usize = 236usize

Source

pub const MAX_CHANNELS: usize = 64usize

Source

pub fn next_pattern(&self, order: &mut u16) -> Option<u8>

order value shouldn’t be modified outside of this function. This moves it forward correctly and returns the pattern to be played

Source

pub fn copy_values_from_header(&mut self, header: &ImpulseHeader)

takes the values that are included in Song from the header and write them to the song.

Mostly applies to metadata about the song. Samples, patterns, instruments are not filled as they are not included in the header

Source

pub fn dbg_relevant(&self, f: &mut Formatter<'_>) -> Result<(), Error>

debug like impl which isn’t as long by cutting down a lot of information

Trait Implementations§

Source§

impl Clone for Song

Source§

fn clone(&self) -> Song

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Song

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Song

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Song

§

impl RefUnwindSafe for Song

§

impl Send for Song

§

impl Sync for Song

§

impl Unpin for Song

§

impl UnwindSafe for Song

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,