playdate_sound/player/mod.rs
1use core::ffi::c_int;
2
3pub mod fp;
4pub mod sp;
5
6pub use fp::Player as FilePlayer;
7pub use sp::Player as SamplePlayer;
8
9
10/// Repeat playback mode.
11#[derive(Debug, Clone, Copy, PartialEq, Eq)]
12pub enum Repeat {
13 /// Player loops the given number of times.
14 Loops(c_int),
15 /// Player loops endlessly until it is stopped with [`SamplePlayer::stop`] or [`FilePlayer::stop`].
16 LoopsEndlessly,
17 /// Player does ping-pong looping.
18 PingPong,
19}
20
21impl Into<c_int> for Repeat {
22 fn into(self) -> c_int {
23 match self {
24 Repeat::Loops(v) => v,
25 Repeat::LoopsEndlessly => 0,
26 Repeat::PingPong => -1,
27 }
28 }
29}