-
Notifications
You must be signed in to change notification settings - Fork 5
audio.um
Marek Maskarinec edited this page Sep 14, 2022
·
8 revisions
Module for audio loading and playback.
type Sound* = struct {
looping: bool
volume: th.fu
path: str
}
A structure used to create playbacks.
type Playback* = struct{
decoder: ^struct{}
// Indicates if the sound is playing.
playing: bool
// If set to true, playback will be paused.
paused: bool
// If true, playback will keep on playing again after it ends.
looping: bool
// Multiplier of the volume.
volume: th.fu
// Sets the current PCM frame. Write only.
frame: int
}
Playback is a currently played instance of a sound. The properties are set to the value the sound has. sound.play returns a pointer. Be sure to keep it if you want to change the sound while its playing.
fn load*(path: str): Sound {
Loads sound at a path.
fn (s: ^Sound) play*(): ^Playback {
Plays the sound.