Class: Gosu::Song
- Inherits:
-
Object
- Object
- Gosu::Song
- 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.
Class Attribute Summary collapse
-
.current_song ⇒ Gosu::Song?
readonly
Returns the song currently being played (even if it’s paused), or nil if no song is playing.
Instance Attribute Summary collapse
-
#volume ⇒ Float
The song’s playback volume.
Instance Method Summary collapse
-
#initialize(filename) ⇒ Song
constructor
Loads a song from a file.
-
#pause ⇒ void
Pauses playback of the song.
-
#paused? ⇒ true, false
Returns true if this song is the current song and playback is paused.
-
#play(looping = false) ⇒ void
Starts or resumes playback of the song.
-
#playing? ⇒ true, false
Whether the song is playing.
-
#stop ⇒ void
Stops playback if this song is the current song.
Constructor Details
Class Attribute Details
.current_song ⇒ Gosu::Song? (readonly)
Returns the song currently being played (even if it’s paused), or nil if no song is playing.
659 660 661 |
# File 'rdoc/gosu.rb', line 659 def current_song @current_song end |
Instance Attribute Details
#volume ⇒ Float
Returns the song’s playback volume.
664 665 666 |
# File 'rdoc/gosu.rb', line 664 def volume @volume end |
Instance Method Details
#pause ⇒ void
This method returns an undefined value.
Pauses playback of the song. The current song is unchanged.
692 |
# File 'rdoc/gosu.rb', line 692 def pause; end |
#paused? ⇒ true, false
Returns true if this song is the current song and playback is paused.
697 |
# File 'rdoc/gosu.rb', line 697 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.
686 |
# File 'rdoc/gosu.rb', line 686 def play(looping=false); end |
#playing? ⇒ true, false
Returns whether the song is playing.
707 |
# File 'rdoc/gosu.rb', line 707 def ; end |
#stop ⇒ void
This method returns an undefined value.
Stops playback if this song is the current song. The current song is set to ‘nil`.
703 |
# File 'rdoc/gosu.rb', line 703 def stop; end |