Class: MG::Audio

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

Instance Attribute Summary 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.



406
407
408
# File 'doc/API_reference.rb', line 406

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

#pauseself

Pauses the sound file.

Returns:

  • (self)

    the receiver.



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

def pause; end

#paused?Boolean

Returns whether the sound file is being paused.

Returns:

  • (Boolean)

    whether the sound file is being paused.



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

def paused?; end

#playing?Boolean

Returns whether the sound file is being played.

Returns:

  • (Boolean)

    whether the sound file is being played.



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

def playing?; end

#resumeself

Resumes playing the sound file.

Returns:

  • (self)

    the receiver.



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

def resume; end

#stopself

Stops the sound file.

Returns:

  • (self)

    the receiver.



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

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