class Raudio::Sound

Overview

Sound represents a short audio clip loaded in memory Use this for sound effects and short audio samples

Defined in:

raudio/sound.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.alias(source : Sound) : self #

Load sound alias (uses same sample data as original)


[View source]
def self.from_wave(wave : Wave) : self #

Load sound from wave data


[View source]
def self.load(filename : String | Path) : self #

Load sound from file Supported formats: WAV, OGG, MP3, FLAC, QOA


[View source]

Class Method Detail

def self.load(filename : String | Path, &) #

[View source]
def self.ready?(handle : LibRaudio::Sound) : Bool #

Check if sound data is ready


[View source]

Instance Method Detail

def channels : UInt32 #

Get number of channels


[View source]
def close #

[View source]
def finalize #

GC fallback


[View source]
def frame_count : UInt32 #

Get frame count


[View source]
def pan=(pan : Float32) #

Set pan for the sound (0.5 is center)


[View source]
def pause #

Pause the sound


[View source]
def pitch=(pitch : Float32) #

Set pitch for the sound (1.0 is base level)


[View source]
def play #

Play the sound


[View source]
def playing? : Bool #

Check if sound is currently playing


[View source]
def ready? : Bool #

Check if this sound is ready


[View source]
def release #

[View source]
def released? : Bool #

[View source]
def resume #

Resume the paused sound


[View source]
def sample_rate : UInt32 #

Get sample rate


[View source]
def sample_size : UInt32 #

Get sample size


[View source]
def stop #

Stop the sound


[View source]
def to_unsafe : Raudio::LibRaudio::Sound #

Get the underlying C struct


[View source]
def unload_alias #

[View source]
def update(data : Pointer(Void), frame_count : Int32) #

Update sound buffer with new data


[View source]
def volume=(volume : Float32) #

Set volume for the sound (1.0 is max level)


[View source]