Class: MG::Audio

Inherits:
Object
  • Object
show all
Defined in:
motion-game

Properties (collapse)

Constructors (collapse)

Playback (collapse)

Instance Attribute Details

- (Float) current_position

Returns the position where to play the sound file.

Returns:

  • (Float)

    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.

Returns:

  • (Float)

    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.

Returns:

  • (Boolean)

    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.

Returns:

  • (Float)

    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.

Parameters:

  • path (String)

    the path of the sound file that should be played.

  • loop (Boolean) (defaults to: false)

    whether the sound file playback should loop.

  • volume (Float) (defaults to: 1.0)

    the audio volume that should be used to play this this sound file, as a 0.0 to 1.0 Float range.

Returns:

  • (Audio)

    an Audio instance.



42
# File 'motion-game', line 42

def self.play(path, loop=false, volume=1.0); end

Instance Method Details

- (Audio) pause

Pauses the sound file.

Returns:

  • (Audio)

    the receiver.



68
# File 'motion-game', line 68

def pause; end

- (Boolean) paused?

Returns whether the sound file is being paused.

Returns:

  • (Boolean)

    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.

Returns:

  • (Boolean)

    whether the sound file is being played.



75
# File 'motion-game', line 75

def playing?; end

- (Audio) resume

Resumes playing the sound file.

Returns:

  • (Audio)

    the receiver.



64
# File 'motion-game', line 64

def resume; end

- (Audio) stop

Stops the sound file.

Returns:

  • (Audio)

    the receiver.



72
# File 'motion-game', line 72

def stop; end