Class: MG::Audio
- Inherits:
-
Object
- Object
- MG::Audio
- Defined in:
- motion-game
Properties (collapse)
-
- (Float) current_position
The position where to play the sound file.
-
- (Float) duration
readonly
The duration left in the sound file.
-
- (Boolean) loop?
Whether the sound file should loop.
-
- (Float) volume
The volume of the sound file, from a 0.0 to 1.0 Float range.
Constructors (collapse)
-
+ (Audio) play(path, loop = false, volume = 1.0)
Creates a new Audio object based on a sound file at the given path and immediately plays it.
Playback (collapse)
-
- (Audio) pause
Pauses the sound file.
-
- (Boolean) paused?
Whether the sound file is being paused.
-
- (Boolean) playing?
Whether the sound file is being played.
-
- (Audio) resume
Resumes playing the sound file.
-
- (Audio) stop
Stops the sound file.
Instance Attribute Details
- (Float) current_position
Returns the position where to play the sound file.
54 55 56 |
# File 'motion-game', line 54 def current_position @current_position end |
- (Float) duration (readonly)
Returns the duration left in the sound file.
57 58 59 |
# File 'motion-game', line 57 def duration @duration end |
- (Boolean) loop?
Returns whether the sound file should loop.
48 49 50 |
# File 'motion-game', line 48
def loop?
@loop?
end
|
- (Float) volume
Returns the volume of the sound file, from a 0.0 to 1.0 Float range.
51 52 53 |
# File 'motion-game', line 51 def volume @volume end |
Class Method Details
+ (Audio) play(path, loop = false, volume = 1.0)
Creates a new Audio object based on a sound file at the given path and immediately plays it.
42 |
# File 'motion-game', line 42 def self.play(path, loop=false, volume=1.0); end |
Instance Method Details
- (Boolean) paused?
Returns whether the sound file is being paused.
78 |
# File 'motion-game', line 78 def paused?; end |
- (Boolean) playing?
Returns whether the sound file is being played.
75 |
# File 'motion-game', line 75 def ; end |