class Gosu::Sample

Overview

A sample is a short sound that is completely loaded in memory, can be played multiple times at once and offers very flexible playback parameters. Use samples for everything that's not music.

See Gosu::Song

Defined in:

gosu/sample.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(filename : String) #

Loads a sample from a file.


[View source]

Instance Method Detail

def play(volume : Float64 = 1.0, speed : Float64 = 1.0, looping : Bool = false) : Gosu::Channel #

Plays the sample without panning.

volume see Channel#volume=

speed see Channel#speed=

looping whether the sample should play in a loop. If you pass true, be sure to store the return value of this method so that you can later stop the looping sound.

See #play_pan


[View source]
def play_pan(pan : Float64 = 0.0, volume : Float64 = 1.0, speed : Float64 = 1.0, looping : Bool = false) : Gosu::Channel #

Plays the sample with panning.

pan see Channel#pan=

volume see Channel#volume=

speed see Channel#speed=

looping whether the sample should play in a loop. If you pass true, be sure to store the return value of this method so that you can later stop the looping sound.

See #play


[View source]