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