Struct Song

Source
pub struct Song {
Show 19 fields pub version: Version, pub directory: String, pub transpose: u8, pub tempo: f32, pub quantize: u8, pub name: String, pub key: u8, pub song: SongSteps, pub phrases: Vec<Phrase>, pub chains: Vec<Chain>, pub instruments: Vec<Instrument>, pub tables: Vec<Table>, pub grooves: Vec<Groove>, pub scales: Vec<Scale>, pub mixer_settings: MixerSettings, pub effects_settings: EffectsSettings, pub midi_settings: MidiSettings, pub midi_mappings: Vec<MidiMapping>, pub eqs: Vec<Equ>,
}

Fields§

§version: Version§directory: String§transpose: u8§tempo: f32§quantize: u8§name: String§key: u8§song: SongSteps§phrases: Vec<Phrase>§chains: Vec<Chain>§instruments: Vec<Instrument>§tables: Vec<Table>§grooves: Vec<Groove>§scales: Vec<Scale>§mixer_settings: MixerSettings§effects_settings: EffectsSettings§midi_settings: MidiSettings§midi_mappings: Vec<MidiMapping>§eqs: Vec<Equ>

Implementations§

Source§

impl Song

Source

pub const N_PHRASES: usize = 255usize

Source

pub const N_CHAINS: usize = 255usize

Source

pub const N_INSTRUMENTS: usize = 128usize

Source

pub const N_TABLES: usize = 256usize

Source

pub const N_GROOVES: usize = 32usize

Source

pub const N_SCALES: usize = 16usize

Source

pub const N_MIDI_MAPPINGS: usize = 128usize

Source

pub fn phrase_view(&self, ix: usize) -> PhraseView<'_>

Source

pub fn offsets(&self) -> &'static Offsets

Source

pub fn eq_count(&self) -> usize

Source

pub fn table_view(&self, ix: usize) -> TableView<'_>

Source

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

Source

pub fn read(reader: &mut impl Read) -> M8Result<Self>

Examples found in repository?
examples/read_song.rs (line 18)
14fn run() -> Result<(), Box<dyn Error>> {
15    let args: Vec<String> = env::args().collect();
16
17    let mut f = File::open(&args[1])?;
18    let song = Song::read(&mut f)?;
19
20    dbg!(&song);
21    dbg!(&song.eqs);
22
23    Ok(())
24}
Source

pub fn read_from_reader(reader: &mut Reader) -> M8Result<Self>

Source

pub fn write(&self, w: &mut Writer) -> Result<(), String>

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 PartialEq for Song

Source§

fn eq(&self, other: &Song) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Song

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