This is how I do it:
1 2 3
| var audiostream = AudioStream { url: "file:///sounds/realshady.mp3"; } |
now this can be a file path or a "{__DIR__}" for local path etc.
supports all sounds formats from what i can see: "aif, wav, mp3, acc, ... http, rtsp" etc
1 2 3 4 5
| var soundchannel = AudioChannel { sound: bind lazy audiostream autoplay: true; paused: false; } |
next you make a channel and connect the sound to it.
this is cool for making audio mixers and channel groups, also connecting up audio filters (spectrum fft, lowpass filter, vst, coreaudio plugins, ...etc). As you can also see i'm using the autoplay to get things rolling soon as its loaded (i know i'm slack- you can do a soundchannel.play()).
and because we're all gamer types:
1
| soundchannel.location = Vec3 {x, y, z}; |
guess that would be cool, no?