ImpulseHeader

Struct ImpulseHeader 

Source
pub struct ImpulseHeader {
Show 20 fields pub song_name: String, pub philight: u16, pub created_with: u16, pub compatible_with: u16, pub flags: u16, pub special: u16, pub global_volume: u8, pub mix_volume: u8, pub initial_speed: u8, pub initial_tempo: u8, pub pan_separation: u8, pub pitch_wheel_depth: u8, pub message_length: u16, pub message_offset: u32, pub channel_pan: [Pan; 64], pub channel_volume: [u8; 64], pub orders: Box<[PatternOrder]>, pub instr_offsets: Box<[Option<InFilePtr>]>, pub sample_offsets: Box<[Option<InFilePtr>]>, pub pattern_offsets: Box<[Option<InFilePtr>]>,
}

Fields§

§song_name: String§philight: u16§created_with: u16§compatible_with: u16§flags: u16§special: u16§global_volume: u8§mix_volume: u8§initial_speed: u8§initial_tempo: u8§pan_separation: u8§pitch_wheel_depth: u8§message_length: u16§message_offset: u32§channel_pan: [Pan; 64]§channel_volume: [u8; 64]§orders: Box<[PatternOrder]>§instr_offsets: Box<[Option<InFilePtr>]>

all Offsets are verified to be point outside the header.

Invalid offsets are replaced with None, so patterns or orders don’t break, because the indexes change

§sample_offsets: Box<[Option<InFilePtr>]>§pattern_offsets: Box<[Option<InFilePtr>]>

here None could come from the file, which means an empty pattern

Implementations§

Source§

impl ImpulseHeader

Source

pub fn parse<R: Read, H: FnMut(LoadDefect)>( reader: &mut R, defect_handler: &mut H, ) -> Result<Self, LoadErr>

Reader position needs to be at the beginning of the Header.

Header is stored at the beginning of the File. length isn’t constant, but at least 192 bytes when unable to load specific parts the function tries its best and communicates the failures in the BitFlags return value. For some problems it wouldn’t make sense to return an incomplete Header as so much would be missing. In those cases an Err is returned

Trait Implementations§

Source§

impl Debug for ImpulseHeader

Source§

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

Formats the value using the given formatter. 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<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, 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>,