Class: Gosu::Song

Inherits:
Object
  • Object
show all
Defined in:
reference/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

- (Song) initialize(window, filename)

Loads a song from a file.

Parameters:

  • window (Gosu::Window)
  • filename (String)

    the path to load the song from.



711
# File 'reference/gosu.rb', line 711

def initialize(window, filename); end

Class Attribute Details

+ (Gosu::Song?) current_song (readonly)

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

Returns:



699
700
701
# File 'reference/gosu.rb', line 699

def current_song
  @current_song
end

Instance Attribute Details

- (Float) volume

Returns the song’s playback volume.

Returns:

  • (Float)

    the song’s playback volume.



704
705
706
# File 'reference/gosu.rb', line 704

def volume
  @volume
end

Instance Method Details

- (void) pause

This method returns an undefined value.

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



728
# File 'reference/gosu.rb', line 728

def pause; end

- (true, false) paused?

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

Returns:

  • (true, false)

    whether the song is paused.



733
# File 'reference/gosu.rb', line 733

def paused?; end

- (void) play(looping = false)

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.



722
# File 'reference/gosu.rb', line 722

def play(looping=false); end

- (true, false) playing?

Returns whether the song is playing.

Returns:

  • (true, false)

    whether the song is playing.



743
# File 'reference/gosu.rb', line 743

def playing?; end

- (void) stop

This method returns an undefined value.

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



739
# File 'reference/gosu.rb', line 739

def stop; end