Struct rimd::SMFBuilder
[−]
[src]
pub struct SMFBuilder { /* fields omitted */ }
An SMFBuilder can be used to create an SMF file. This is done by
adding tracks to the builder via add_track
and then adding
events to each track.
Methods
impl SMFBuilder
[src]
fn new() -> SMFBuilder
Create a new SMFBuilder. Initially the builder will have no tracks
fn num_tracks(&self) -> usize
Get the number of tracks currenly in the builder
fn add_track(&mut self)
Add new a track to this builder
fn add_static_track<'a, I>(&mut self, track: I) where
I: Iterator<Item = &'a AbsoluteEvent>,
I: Iterator<Item = &'a AbsoluteEvent>,
Add a static track to the builder (note this will clone all events in the passed iterator)
fn set_copyright(&mut self, track: usize, copyright: String)
Set the copyright for the track at index track
. This will
also cause a copyright meta event to be inserted.
Panics
Panics if track
is >= to the number of tracks in this
builder, or if the track already has a copyright set.
fn set_name(&mut self, track: usize, name: String)
Set the name for the track at index track
. This will
also cause a name meta event to be inserted.
Panics
Panics if track
is >= to the number of tracks in this
builder, or if the track already has a name set.
fn add_midi_abs(&mut self, track: usize, time: u64, msg: MidiMessage)
Add a midi message to track at index track
at absolute time
time
.
Panics
Panics if track
is >= to the number of tracks in this builder
fn add_midi_rel(&mut self, track: usize, delta: u64, msg: MidiMessage)
Add a midi message to track at index track
at delta
ticks
after the last message (or at delta
if no current messages
exist)
Panics
Panics if track
is >= to the number of tracks in this builder
fn add_meta_abs(&mut self, track: usize, time: u64, event: MetaEvent)
Add a meta event to track at index track
at absolute time
time
.
Panics
Panics if track
is >= to the number of tracks in this builder
fn add_meta_rel(&mut self, track: usize, delta: u64, event: MetaEvent)
Add a meta event to track at index track
at delta
ticks
after the last message (or at delta
if no current messages
exist)
Panics
Panics if track
is >= to the number of tracks in this builder
fn add_event(&mut self, track: usize, event: TrackEvent)
Add a TrackEvent to the track at index track
. The event
will be added at event.vtime
after the last event currently
in the builder for the track.
Panics
Panics if track
is >= to the number of tracks in this builder
fn result(self) -> SMF
Generate an SMF file with the events that have been added to the builder