Lynxer

Documentation

Sound Module

The sound module provides audio playback functionality using Rust's rodio and cpal crates.

Requires: a Rust toolchain (cargo) to build it, and an ALSA sound card to play. Loading, decoding, handle bookkeeping and the error paths work without a device; playback simply reports "did not start". make testLynxer skips stdlib_sound.lynx, with a printed message, on hosts without /dev/snd/controlC*.

Functions

Example

import("sound")

global main(){
    int music = global.sound.loadSound("theme.wav");
    if(music >= 0){
        global.sound.setSoundVolume(music, 0.5);
        global.sound.loopSound(music);
        println(global.sound.getSoundLength(music));
        global.sound.stopSound(music);
        global.sound.releaseSound(music);
    }
}