src/event/mod.rs (984B)
1 pub mod input;
2
3 #[derive(Debug)]
4 pub enum Event {
5 Key(crossterm::event::KeyEvent),
6 Mouse(crossterm::event::MouseEvent),
7 /// Dimensions are not carried: the next draw re-queries the terminal.
8 Resize,
9 Tick,
10 Audio(AudioEvent),
11 /// Boxed: every event in the channel is sized to the largest variant, and
12 /// the library carries its whole derived index. Mouse motion alone puts
13 /// hundreds of events a second through here.
14 LibraryReady(Box<crate::library::Library>),
15 }
16
17 #[derive(Debug, Clone)]
18 pub enum AudioEvent {
19 PositionUpdate { position_secs: f64, duration_secs: f64 },
20 TrackFinished,
21 /// The current track could not be decoded.
22 TrackError,
23 /// The output device could not be opened. The player thread exits after
24 /// sending this, so every later command is dropped — the UI has to say so
25 /// rather than show a progress bar advancing over silence.
26 DeviceError(String),
27 Playing,
28 Paused,
29 Stopped,
30 }