Class: MG::Audio

Inherits:
Object
  • Object
show all
Defined in:
doc/API_reference.rb

Properties collapse

Constructors collapse

Instance Method Summary collapse

Instance Attribute Details

#durationFloat (readonly)

Returns the duration left in the sound file.

Returns:

  • (Float)

    the duration left in the sound file.



409
410
411
# File 'doc/API_reference.rb', line 409

def duration
  @duration
end

Class Method Details

.play(path, loop = false, volume = 1.0) ⇒ Audio

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.



379
# File 'doc/API_reference.rb', line 379

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

Instance Method Details

#current_positionFloat

Returns the position where to play the sound file.

Returns:

  • (Float)

    the position where to play the sound file.



399
# File 'doc/API_reference.rb', line 399

def current_position; end

#current_position=(value) ⇒ Object

Set the position where to play the sound.

Parameters:

  • value (Float)

    the position



403
# File 'doc/API_reference.rb', line 403

def current_position=(value); end

#loop=(value) ⇒ Object

Set whether to loop the sound.

Parameters:

  • value (Boolean)

    true if the sound should loop.



389
# File 'doc/API_reference.rb', line 389

def loop=(value); end

#loop?Boolean

Returns whether the sound file should loop.

Returns:

  • (Boolean)

    whether the sound file should loop.



385
# File 'doc/API_reference.rb', line 385

def loop?; end

#pauseAudio

Pauses the sound file.

Returns:

  • (Audio)

    the receiver.



420
# File 'doc/API_reference.rb', line 420

def pause; end

#paused?Boolean

Returns whether the sound file is being paused.

Returns:

  • (Boolean)

    whether the sound file is being paused.



430
# File 'doc/API_reference.rb', line 430

def paused?; end

#playing?Boolean

Returns whether the sound file is being played.

Returns:

  • (Boolean)

    whether the sound file is being played.



427
# File 'doc/API_reference.rb', line 427

def playing?; end

#resumeAudio

Resumes playing the sound file.

Returns:

  • (Audio)

    the receiver.



416
# File 'doc/API_reference.rb', line 416

def resume; end

#stopAudio

Stops the sound file.

Returns:

  • (Audio)

    the receiver.



424
# File 'doc/API_reference.rb', line 424

def stop; end

#volumeFloat

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.



392
# File 'doc/API_reference.rb', line 392

def volume; end

#volume=(value) ⇒ Object

Set the volume of the sound.

Parameters:

  • value (Float)

    the volume of the sound.



396
# File 'doc/API_reference.rb', line 396

def volume=(value); end