class
Raudio::Sound
- Raudio::Sound
- Reference
- Object
Overview
Sound represents a short audio clip loaded in memory Use this for sound effects and short audio samples
Defined in:
raudio/sound.crConstructors
-
.alias(source : Sound) : self
Load sound alias (uses same sample data as original)
-
.from_wave(wave : Wave) : self
Load sound from wave data
-
.load(filename : String | Path) : self
Load sound from file Supported formats: WAV, OGG, MP3, FLAC, QOA
Class Method Summary
- .load(filename : String | Path, &)
-
.ready?(handle : LibRaudio::Sound) : Bool
Check if sound data is ready
Instance Method Summary
-
#channels : UInt32
Get number of channels
- #close
-
#finalize
GC fallback
-
#frame_count : UInt32
Get frame count
-
#pan=(pan : Float32)
Set pan for the sound (0.5 is center)
-
#pause
Pause the sound
-
#pitch=(pitch : Float32)
Set pitch for the sound (1.0 is base level)
-
#play
Play the sound
-
#playing? : Bool
Check if sound is currently playing
-
#ready? : Bool
Check if this sound is ready
- #release
- #released? : Bool
-
#resume
Resume the paused sound
-
#sample_rate : UInt32
Get sample rate
-
#sample_size : UInt32
Get sample size
-
#stop
Stop the sound
-
#to_unsafe : Raudio::LibRaudio::Sound
Get the underlying C struct
- #unload_alias
-
#update(data : Pointer(Void), frame_count : Int32)
Update sound buffer with new data
-
#volume=(volume : Float32)
Set volume for the sound (1.0 is max level)
Constructor Detail
Load sound alias (uses same sample data as original)
Load sound from file Supported formats: WAV, OGG, MP3, FLAC, QOA