-
Notifications
You must be signed in to change notification settings - Fork 34
Scripting Audio and Sound
The Commnader Wars Sound/Audio System is fully accessable in Scripts via the "audio" object.
For example would load adders soundtrack to the :
audio.addMusic("resources/music/cos/adder.mp3");
The fully avaiable interface in javascript can be found in the source folder "coreengine/audiothread.h" under public slots.
The most important functions are:
audio.addMusic("resources/music/cos/adder.mp3", 1000, 10000);
This would add Adders Music and when played start at second 1 and end the file at second 10.
audio.clearPlayList();
Empties the playlist nothing will be played now.
audio.playRandom();
Starts a new track randomly selected from the playlist
audio.playSound("trap.wav", 1, "resources/sounds/");
Plays a background sound in this case "trap.wav" in the folder "resources/sounds/" and repeats it 1 time.
Note At the end of a turn the playlist is cleared and filled with a new playlist of the co's of the current player. You can overwrite this behaviour in your gamescript if needed.
E-Mail-Contact: [email protected] ask for help here. :)