class
Raudio::Music
- Raudio::Music
- Reference
- Object
Overview
Music represents a streaming audio source Use this for long audio tracks (background music, etc.) Music is streamed in chunks to save memory
Defined in:
raudio/music.crConstructors
-
.from_memory(file_type : String, data : Bytes) : self
Load music stream from memory data
-
.load(filename : String | Path) : self
Load music stream from file Supported formats: WAV, OGG, MP3, FLAC, XM, MOD, QOA
Class Method Summary
- .load(filename : String | Path, &)
-
.ready?(handle : LibRaudio::Music) : Bool
Check if music stream is ready
Instance Method Summary
-
#channels : UInt32
Get number of channels
- #close
-
#context_type : Int32
Get music context type
- #finalize
-
#frame_count : UInt32
Get frame count
-
#length : Float32
Get music time length in seconds
-
#looping=(value : Bool)
Set whether the music should loop when it reaches the end
-
#looping? : Bool
Check if music looping is enabled
-
#pan=(pan : Float32)
Set pan for music (0.5 is center)
-
#pause
Pause music playing
-
#pitch=(pitch : Float32)
Set pitch for music (1.0 is base level)
-
#play
Start music playing
-
#playing? : Bool
Check if music is playing
-
#ready? : Bool
Check if this music is ready
- #release
- #released? : Bool
-
#resume
Resume paused music playing
-
#sample_rate : UInt32
Get sample rate
-
#sample_size : UInt32
Get sample size
-
#seek(position : Float32)
Seek music to a position in seconds
-
#stop
Stop music playing
-
#time_played : Float32
Get current music time played in seconds
-
#to_unsafe : Raudio::LibRaudio::Music
Get the underlying C struct
-
#update
Update music buffer with new stream data Call this regularly (every frame) when playing music
-
#volume=(volume : Float32)
Set volume for music (1.0 is max level)
Constructor Detail
Load music stream from file Supported formats: WAV, OGG, MP3, FLAC, XM, MOD, QOA
Class Method Detail
Instance Method Detail
Set whether the music should loop when it reaches the end
Note: Changes take effect when #play
is called.
To change looping for already playing music, stop and restart it.
Update music buffer with new stream data Call this regularly (every frame) when playing music