pub struct PlayerController { /* private fields */ }Expand description
This type allows you to control the player from one thread, while rendering it on another.
Implementations§
source§impl PlayerController
impl PlayerController
sourcepub fn play(&self) -> bool
pub fn play(&self) -> bool
Start the playback.
Retuns true if started or already playing; false otherwise.
sourcepub fn is_playing(&self) -> bool
pub fn is_playing(&self) -> bool
sourcepub fn set_position(&self, value: f64)
pub fn set_position(&self, value: f64)
Set the playing position. In range [0.0, 1.0].
Will take effect only if a file is opened and it’s not empty.
sourcepub fn new_position_observer(&self) -> PositionObserver
pub fn new_position_observer(&self) -> PositionObserver
initialize a new PositionObserver.
sourcepub fn tempo(&self) -> Option<f32>
pub fn tempo(&self) -> Option<f32>
Get the tempo (in beats per minute).
Returns None if file is not set.
sourcepub fn set_volume(&mut self, volume: f32)
pub fn set_volume(&mut self, volume: f32)
Set master volume.
sourcepub fn set_file(
&mut self,
path: Option<impl Into<PathBuf>>,
) -> Result<(), Box<dyn Error>>
pub fn set_file( &mut self, path: Option<impl Into<PathBuf>>, ) -> Result<(), Box<dyn Error>>
Set a MIDI file.
The parameter is Option<&str>, where Some value is actual path and None is for
offloading.
sourcepub fn note_off_all(&mut self)
pub fn note_off_all(&mut self)
Send note off message for all notes (aka Panic)
Auto Trait Implementations§
impl !Freeze for PlayerController
impl !RefUnwindSafe for PlayerController
impl Send for PlayerController
impl !Sync for PlayerController
impl Unpin for PlayerController
impl !UnwindSafe for PlayerController
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
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>
Converts
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>
Converts
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