Audio - polytrackmods/PolyModLoader GitHub Wiki

Audio

You can add audio to be played using PolyTrack's sound manager using PolyModLoader

Registering Audio

In order to play a sound, you have to register it first. This has to be done in postInit, not init.
To register a sound, use pml.soundManager.registerSound like this:

pml.soundManager.registerSound(name, [url]);

name is the name of the sound
url is the url to the audio file, please make sure to not use relative links, as some devices do not support these

Playing Audio

After havig registered the Audio, it can be played from within your mod directly or in mixins using pml.soundManager.playSound like this:

pml.soundManager.playSound(name, volume);

name is the name given to the sound
volume is the volume that the sound should be played at