pub struct SongHeader {
pub flags: u16,
pub n_fonts: u8,
pub peak_voices: u8,
pub code_len: u16,
pub font_ids: [u8; 8],
pub code_off: u16,
}Expand description
The parsed header of a song.
Fields§
§flags: u16Flag bits.
n_fonts: u8Number of soundfont ids.
peak_voices: u8Voices the song needs at most (measured by the cook).
code_len: u16Bytes of bytecode.
font_ids: [u8; 8]Soundfont ids, in the original table order (slot s is n - 1 - s).
code_off: u16Offset of the bytecode in the file.
Implementations§
Source§impl SongHeader
impl SongHeader
Sourcepub fn parse(bytes: &[u8]) -> Result<Self, FormatError>
pub fn parse(bytes: &[u8]) -> Result<Self, FormatError>
Parse the header of bytes.
use psx_seq::format::*;
let mut f = vec![];
f.extend_from_slice(b"PSQ1");
f.extend_from_slice(&[1, 0, 0, 0, 1, 6, 2, 0, 1, 0, 0, 0]);
f.extend_from_slice(&[7, 0, 0, 0]);
f.extend_from_slice(&[0xFF, 0xFF]);
let h = SongHeader::parse(&f).unwrap();
assert_eq!((h.n_fonts, h.peak_voices, h.code_len, h.font_ids[0]), (1, 6, 2, 7));
assert_eq!(h.code_off, 20);Trait Implementations§
Source§impl Clone for SongHeader
impl Clone for SongHeader
Source§fn clone(&self) -> SongHeader
fn clone(&self) -> SongHeader
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SongHeader
impl Debug for SongHeader
Source§impl PartialEq for SongHeader
impl PartialEq for SongHeader
impl Copy for SongHeader
impl Eq for SongHeader
impl StructuralPartialEq for SongHeader
Auto Trait Implementations§
impl Freeze for SongHeader
impl RefUnwindSafe for SongHeader
impl Send for SongHeader
impl Sync for SongHeader
impl Unpin for SongHeader
impl UnsafeUnpin for SongHeader
impl UnwindSafe for SongHeader
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)