battlecore::audio
The audio module controls the device audio pack, master volume, and the playback of named tracks and synthesised tones. Include its declarations with include "./battlecore/audio.bst";.
getIsPlaying
Returns whether audio is currently playing.
native bool battlecore::audio.getIsPlaying ();getAudioPack
Returns the name of the currently selected audio pack.
native string battlecore::audio.getAudioPack ();setAudioPack
Sets the active audio pack by name. Returns whether the operation succeeded.
native bool battlecore::audio.setAudioPack (string newVal);getMasterVolume
Returns the current master volume.
native int battlecore::audio.getMasterVolume ();setMasterVolume
Sets the master volume. Returns whether the operation succeeded.
native bool battlecore::audio.setMasterVolume (int newVal);trackStart
Starts playback of a named track. Returns the track id.
native int battlecore::audio.trackStart (string trackName);trackStop
Stops the track with the given id. Returns whether the operation succeeded.
native bool battlecore::audio.trackStop (int trackId);toneStart
Starts a synthesised tone. Returns the tone id. Supports an optional intermittent (pulsed) mode with configurable on/off timings.
native int battlecore::audio.toneStart (int waveform, float freqHz, int volume = 255, int duration = -1, bool isIntermittent = false, int onTimeMs = 100, int offTimeMs = 300);toneStop
Stops the tone with the given id. Returns whether the operation succeeded.
native bool battlecore::audio.toneStop (int toneId);