Method: Tea::Sound#state
- Defined in:
- lib/tea/c_sound.rb
#state ⇒ Object
Check if the sound is stopped, playing or paused. Returns one of Tea::Sound::STOPPED, Tea::Sound::PLAYING or Tea::Sound::PAUSED. A sound that isn’t playing or paused is considered stopped.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/tea/c_sound.rb', line 113 def state if channel_valid? if SDL::Mixer.play?(@channel) # For some reason, pause? returns 0 and 1 instead of true and false. if SDL::Mixer.pause?(@channel) != 0 PAUSED else PLAYING end else STOPPED end else STOPPED end end |