-
Notifications
You must be signed in to change notification settings - Fork 5
audio.um
Module for audio loading and playback.
type Sound* = struct { _: ^struct{} }
Represents an instance of a playable sound. It is an opaque structure.
fn load*(path: str): Sound {
Loads a sounds at path, if there is an error, the underlying pointer
will be NULL
.
fn (s: ^Sound) copy*(): Sound {
Copies the sound. This will create another sound which can be configured and played independently from the original sound.
fn (s: ^Sound) isPlaying*(): bool {
Returns true if the sound is still playing.
fn (s: ^Sound) play*() {
Plays the sound.
fn (s: ^Sound) start*(): ^Sound {
The start function allows you to play a single sound multiple times. It will create a copy and return a pointer to it, so you can controll it while it is playing. The returned pointer can be discarded.
fn (s: ^Sound) stop*() {
Stops the sound, but keeps the progress. If you want to start from the
begginning, use audio.Sound.seekToFrame(0)
.
fn (s: ^Sound) setVol*(vol: real32) {
Sets the volume as a multiplier of the base volume.
fn (s: ^Sound) setPan*(pan: real32) {
Sets the pan of the sound.
fn (s: ^Sound) setPitch*(pitch: real32) {
Sets the pitch of the sound.
fn (s: ^Sound) setLooping*(looping: bool) {
Sets whether the sound will loop upon finishing.
fn (s: ^Sound) seekToFrame*(frame: uint) {
Seeks to a specified PCM frame.
fn (s: ^Sound) frameCount*(): uint {
Returns length of the sound in PCM frames.
fn setup*() {
INTERNAL
fn cycle*() {
INTERNAL