Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyhale committed Feb 28, 2024
1 parent 184204f commit 626c064
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,17 @@ If `spatial` is set to `none`, all settings below are ignored.
```js
// Load your audio on start(), so it is ready when you need it.
start() {
this.audio = globalAudioManager.load('path_to_audiofile')
.then((playableNode) => {
return playableNode;
globalAudioManager.load('audio.mp3').then((playableNode) => {
this.click = playableNode;
});
}

// Play the file when you need it.
onClick() {
// Play's the audio without panning
// Plays the audio without panning
this.audio.play();

const position: Float32Array = new Float32Array(3);
const position = new Float32Array(3);
this.object.getPositionWorld(position);
// Play's from specified position relative to audio-listener
this.audio.play(position);
Expand Down

0 comments on commit 626c064

Please sign in to comment.