Skip to main content

rustysynth_ext/
loop_mode.rs

1/// Specifies how the sample loops during playback.
2#[derive(Debug, PartialEq, Eq)]
3pub enum LoopMode {
4    /// The sample will be played without loop.
5    NoLoop,
6    /// The sample will loop continuously.
7    Continuous,
8    /// The sample will loop until the note stops.
9    LoopUntilNoteOff,
10}
11
12impl LoopMode {
13    pub(crate) fn from_i16(value: i16) -> Self {
14        match value {
15            1 => LoopMode::Continuous,
16            3 => LoopMode::LoopUntilNoteOff,
17            _ => LoopMode::NoLoop,
18        }
19    }
20}