Class: Gosu::Song

Inherits:
Object
  • Object
show all
Defined in:
rdoc/gosu.rb

Overview

Songs are less flexible than samples in that only one can be played at a time, with no panning or speed control.

See Also:

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ Song #initialize(window, filename) ⇒ Song

Loads a song from a file.

(Passing a Window reference is not necessary anymore, please use the first overload instead.)

Parameters:

  • filename (String)

    the path to load the song from.



673
# File 'rdoc/gosu.rb', line 673

def initialize(filename); end

Class Attribute Details

.current_songGosu::Song? (readonly)

Returns the song currently being played (even if it’s paused), or nil if no song is playing.

Returns:



657
658
659
# File 'rdoc/gosu.rb', line 657

def current_song
  @current_song
end

Instance Attribute Details

#volumeFloat

Returns the song’s playback volume.

Returns:

  • (Float)

    the song’s playback volume.



662
663
664
# File 'rdoc/gosu.rb', line 662

def volume
  @volume
end

Instance Method Details

#pausevoid

This method returns an undefined value.

Pauses playback of the song. The current song is unchanged.



690
# File 'rdoc/gosu.rb', line 690

def pause; end

#paused?true, false

Returns true if this song is the current song and playback is paused.

Returns:

  • (true, false)

    whether the song is paused.



695
# File 'rdoc/gosu.rb', line 695

def paused?; end

#play(looping = false) ⇒ void

This method returns an undefined value.

Starts or resumes playback of the song.

If another song is currently playing, it will be stopped and this song will be set as the current song.

If ‘looping` is false, the current song will be set to `nil` when this song finishes.

Parameters:

  • looping (true, false) (defaults to: false)

    whether the song should play in a loop.



684
# File 'rdoc/gosu.rb', line 684

def play(looping=false); end

#playing?true, false

Returns whether the song is playing.

Returns:

  • (true, false)

    whether the song is playing.



705
# File 'rdoc/gosu.rb', line 705

def playing?; end

#stopvoid

This method returns an undefined value.

Stops playback if this song is the current song. The current song is set to ‘nil`.



701
# File 'rdoc/gosu.rb', line 701

def stop; end