rich_sdl2_rust/audio/status.rs
1//! A status of an audio device.
2
3use crate::bind;
4
5/// A playing status of an audio device.
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum AudioStatus {
8 /// An audio device is closed or on error.
9 Stopped,
10 /// An audio device is open and playing the sound.
11 Playing,
12 /// An audio device is open but not playing the sound.
13 Paused,
14}
15
16impl From<bind::SDL_AudioStatus> for AudioStatus {
17 fn from(raw: bind::SDL_AudioStatus) -> Self {
18 match raw {
19 bind::SDL_AUDIO_STOPPED => Self::Stopped,
20 bind::SDL_AUDIO_PLAYING => Self::Playing,
21 bind::SDL_AUDIO_PAUSED => Self::Paused,
22 _ => unreachable!(),
23 }
24 }
25}