class Gosu::Song

Overview

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

See Gosu::Sample

Defined in:

gosu/song.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(filename : String) #

Loads a song from a file.


[View source]

Class Method Detail

def self.current_song : Gosu::Song | Nil #

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


[View source]

Instance Method Detail

def pause #

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


[View source]
def paused? : Bool #

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


[View source]
def play(looping : Bool = false) #

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.

looping whether the song should play in a loop.


[View source]
def playing? : Bool #

Returns whether the song is playing.


[View source]
def stop #

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


[View source]
def volume : Float64 #

Returns the song's playback volume.


[View source]
def volume=(double : Float64) #

Sets the song's playback volume.


[View source]