Events: Add Play/Pause events.
Uses much of the existing machinery to add some more PlayMode state change events—all in all, a pretty simple change. Closes #29.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use crate::events::TrackEvent;
|
||||
|
||||
/// Playback status of a track.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
#[non_exhaustive]
|
||||
@@ -29,6 +31,15 @@ impl PlayMode {
|
||||
state => state,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn as_track_event(self) -> TrackEvent {
|
||||
use PlayMode::*;
|
||||
match self {
|
||||
Play => TrackEvent::Play,
|
||||
Pause => TrackEvent::Pause,
|
||||
Stop | End => TrackEvent::End,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PlayMode {
|
||||
|
||||
Reference in New Issue
Block a user