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.
Returns true if started or already playing; false otherwise.
Sourcepub fn is_playing(&self) -> bool
pub fn is_playing(&self) -> bool
Sourcepub fn set_position_ticks(&self, value: u64)
pub fn set_position_ticks(&self, value: u64)
Set the playing position in timeline ticks.
Values outside the valid range are clamped to [0, total_ticks()]. Will take effect only if
a file is opened and it is not empty.
Sourcepub fn position_ticks(&self) -> u64
pub fn position_ticks(&self) -> u64
Get the current playback position in timeline ticks.
Sourcepub fn total_ticks(&self) -> u64
pub fn total_ticks(&self) -> u64
Get the total number of timeline ticks in the loaded file.
Sourcepub fn set_position(&self, value: f64)
pub fn set_position(&self, value: f64)
Set the playing position in normalized range [0.0, 1.0].
Will take effect only if a file is opened and it is 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 UnsafeUnpin 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
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