gooey/interface/view/component/
sfx.rs

1use crate::interface::view::Sound;
2use super::impl_kind;
3
4#[derive(Clone, Debug, Default, Eq, PartialEq)]
5pub struct Sfx {
6  /// A generic ID for the backend to interpret as representing the sound being
7  /// played together with a playback state
8  pub playback : Option <(Sound, State)>
9}
10impl_kind!(Sfx);
11
12#[derive(Clone, Debug, Eq, PartialEq)]
13pub enum State {
14  Ready,
15  Play,
16  Loop,
17  /// Play from position in sample (PCM) timeunits
18  PlayFrom (u32),
19  /// Loop from position in sample (PCM) timeunits
20  LoopFrom (u32)
21}
22
23impl Default for State {
24  fn default() -> Self {
25    State::Ready
26  }
27}