pub struct RenderJob { /* private fields */ }Expand description
One render: the preset state, the notes, the tempo and the recipe.
Implementations§
Source§impl RenderJob
impl RenderJob
Sourcepub fn new(
state: PresetState,
notes: Vec<RenderNote>,
bpm: Bpm,
) -> Result<Self, RenderError>
pub fn new( state: PresetState, notes: Vec<RenderNote>, bpm: Bpm, ) -> Result<Self, RenderError>
Sourcepub fn from_midi(
state: PresetState,
path: &Path,
bpm: Bpm,
) -> Result<Self, RenderError>
pub fn from_midi( state: PresetState, path: &Path, bpm: Bpm, ) -> Result<Self, RenderError>
Builds a job that plays the notes of a MIDI file. The file is read
as analyze --notes reads it, so every tempo in it must match
bpm. Notes without a velocity take the recipe’s velocity. The
record carries the SHA-256 of the file.
§Errors
Returns RenderError::Midi for a file the MIDI reader refuses, and
the errors of notes_of_list and RenderJob::new.
Sourcepub fn for_material(state: PresetState, material: Material, bpm: Bpm) -> Self
pub fn for_material(state: PresetState, material: Material, bpm: Bpm) -> Self
Builds a job that plays the recipe’s notes for material.
Sourcepub fn state(&self) -> &PresetState
pub fn state(&self) -> &PresetState
Returns the preset state.
Sourcepub fn notes(&self) -> &[RenderNote]
pub fn notes(&self) -> &[RenderNote]
Returns the notes.
Sourcepub fn with_controls(self, controls: Vec<Control>) -> Result<Self, RenderError>
pub fn with_controls(self, controls: Vec<Control>) -> Result<Self, RenderError>
Adds controller changes. The clip still ends by the notes and the tail, so a change after the clip’s end has no effect.
§Errors
Returns RenderError::Play for a value that does not fit its
MIDI message, as ControlKind::checked does.
Sourcepub fn midi_sha256(&self) -> Option<&str>
pub fn midi_sha256(&self) -> Option<&str>
Returns the SHA-256 of the MIDI file the notes came from, in hex.
Sourcepub fn last_note_off(&self) -> Seconds
pub fn last_note_off(&self) -> Seconds
Returns the end of the last note.
Trait Implementations§
impl StructuralPartialEq for RenderJob
Auto Trait Implementations§
impl Freeze for RenderJob
impl RefUnwindSafe for RenderJob
impl Send for RenderJob
impl Sync for RenderJob
impl Unpin for RenderJob
impl UnsafeUnpin for RenderJob
impl UnwindSafe for RenderJob
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more