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
impl ImpulseHeader
Sourcepub fn parse<R: Read, H: FnMut(LoadDefect)>(
reader: &mut R,
defect_handler: &mut H,
) -> Result<Self, LoadErr>
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§
Auto Trait Implementations§
impl Freeze for ImpulseHeader
impl RefUnwindSafe for ImpulseHeader
impl Send for ImpulseHeader
impl Sync for ImpulseHeader
impl Unpin for ImpulseHeader
impl UnwindSafe for ImpulseHeader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more