pub struct MidiFile {
pub header: Header,
pub tracks: Vec<Track>,
}
Expand description
A Standard Midi File (SMF)
Fields§
§header: Header
The header chunk: Contains the file format, number of tracks, and division
tracks: Vec<Track>
The track chunks: Contains the actual midi events
Implementations§
source§impl MidiFile
impl MidiFile
sourcepub fn from_midi(v: &[u8]) -> Result<Self, MidiFileParseError>
pub fn from_midi(v: &[u8]) -> Result<Self, MidiFileParseError>
Turn a series of bytes into a MidiFile
.
sourcepub fn add_track(&mut self, track: Track)
pub fn add_track(&mut self, track: Track)
Add a track to the file. Increments the num_tracks
field in the header.
sourcepub fn extend_track(
&mut self,
track_num: usize,
event: MidiMsg,
beat_or_frame: f32
)
pub fn extend_track( &mut self, track_num: usize, event: MidiMsg, beat_or_frame: f32 )
Add a midi event to a track in the file, given its absolute beat or frame time. The event delta time is calculated from the previous event in the track and the time division of the file.
Trait Implementations§
source§impl PartialEq for MidiFile
impl PartialEq for MidiFile
impl StructuralPartialEq for MidiFile
Auto Trait Implementations§
impl Freeze for MidiFile
impl RefUnwindSafe for MidiFile
impl Send for MidiFile
impl Sync for MidiFile
impl Unpin for MidiFile
impl UnwindSafe for MidiFile
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