class FMOD::Sound::OpenState
Contains the state a sound is in after {Mode::NON_BLOCKING} has been used to open it, or the state of the streaming buffer.
When a sound is opened with {Mode::NON_BLOCKING}, it is opened and prepared in the background, or asynchronously. This allows the main application to execute without stalling on audio loads. This function will describe the state of the asynchronous load routine i.e. whether it has succeeded, failed or is still in progress.
If {#starving?} is true
, then you will most likely hear a stuttering/repeating sound as the decode buffer loops on itself and replays old data. You can detect buffer under-run and use something like {ChannelControl.mute} to keep it quiet until it is not starving any more.
Constants
- BUFFERING
Buffering data.
- CONNECTING
Connecting to remote host (internet sounds only).
- ERROR
Failed to open - file not found, out of memory etc.
- LOADING
Initial load in progress.
- PLAYING
Ready and playing, but not possible to release at this time without stalling the main thread.
- READY
Opened and ready to play.
- SEEKING
Seeking to subsound and re-flushing stream buffer.
- SET_POSITION
Seeking within a stream to a different position.
Attributes
@return [Float] the percentage of the file buffer filled progress of a
stream.
@return [Integer] the open state of a sound.
Will be one of the following: * {READY} * {LOADING} * {ERROR} * {CONNECTING} * {BUFFERING} * {SEEKING} * {PLAYING} * {SET_POSITION}
Public Class Methods
@api private
# File lib/fmod/sound.rb, line 100 def initialize(state, buffered, busy, starving) @state, @buffered, @busy, @starving = state, buffered, busy, starving end
Public Instance Methods
The disk busy state of a sound. @return [Boolean] true
if disk is currently being accessed for the
sound, otherwise +false+.
# File lib/fmod/sound.rb, line 87 def busy? @busy != 0 end
The starving state of a sound. @return [Boolean] true
f a stream has decoded more than the stream
file buffer has ready for it, otherwise +false+.
# File lib/fmod/sound.rb, line 95 def starving? @starving != 0 end