Instrument

Enum Instrument 

Source
pub enum Instrument {
    WavSynth(WavSynth),
    MacroSynth(MacroSynth),
    Sampler(Sampler),
    MIDIOut(MIDIOut),
    FMSynth(FMSynth),
    HyperSynth(HyperSynth),
    External(ExternalInst),
    None,
}

Variants§

§

WavSynth(WavSynth)

§

MacroSynth(MacroSynth)

§

Sampler(Sampler)

§

MIDIOut(MIDIOut)

§

FMSynth(FMSynth)

§

HyperSynth(HyperSynth)

§

External(ExternalInst)

§

None

Implementations§

Source§

impl Instrument

Source

pub const INSTRUMENT_MEMORY_SIZE: usize = 215usize

Source

pub const V4_SIZE: usize = 215usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn instr_command_text(&self, ver: Version) -> CommandPack

Source

pub fn write(&self, ver: Version, w: &mut Writer)

Source

pub fn name(&self) -> Option<&str>

Source

pub fn set_name(&mut self, name: String)

Source

pub fn equ(&self) -> Option<u8>

Source

pub fn set_eq(&mut self, eq_ix: u8)

Source

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

Read an in-memory instrument file along with its optional eq

Source

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

Read a M8 instrument file along with its optional Eq definition.

Examples found in repository?
examples/read_instrument.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 instr = Instrument::read(&mut f)?;
19
20    dbg!(&instr.instrument);
21
22    match &instr.eq {
23        None => {}
24        Some(eq) => {
25            dbg!(eq);
26        }
27    };
28
29    Ok(())
30}
Source

pub fn from_reader( reader: &mut Reader, number: u8, version: Version, ) -> M8Result<Self>

Trait Implementations§

Source§

impl Clone for Instrument

Source§

fn clone(&self) -> Instrument

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 Instrument

Source§

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

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

impl Default for Instrument

Source§

fn default() -> Instrument

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

impl Describable for Instrument

Source§

fn describe<PG: ParameterGatherer>(&self, pg: PG, ver: Version) -> PG

Method called to describte the content of the structure in any gatherer.
Source§

impl PartialEq for Instrument

Source§

fn eq(&self, other: &Instrument) -> 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 Instrument

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