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 f3ff6fc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,19 @@ 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
// Plays from specified position relative to audio-listener
this.audio.play(position);
}

Expand Down

0 comments on commit f3ff6fc

Please sign in to comment.