From 6892bc90ed2b16f18125a727ad263459072851e5 Mon Sep 17 00:00:00 2001 From: Timothy Hale Date: Mon, 26 Feb 2024 11:09:02 +0100 Subject: [PATCH] audio-source: Change maxVolume to volume --- example/js/button.js | 5 +++-- src/audio-source.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/example/js/button.js b/example/js/button.js index c7e4974..b2328ad 100644 --- a/example/js/button.js +++ b/example/js/button.js @@ -53,12 +53,13 @@ export class ButtonComponent extends Component { this.click = this.object.addComponent(AudioSource, { src: 'sfx/click.wav', isStationary: true, - maxVolume: 0.5, + volume: 0.2, + spatial: true, }); this.unclick = this.object.addComponent(AudioSource, { src: 'sfx/unclick.wav', isStationary: true, - maxVolume: 0.5, + volume: 0.5, }); this.welcome = WL.scene.addObject(this.object); this.welcome.addComponent(AudioSource, { diff --git a/src/audio-source.ts b/src/audio-source.ts index 965dc93..e4493b9 100644 --- a/src/audio-source.ts +++ b/src/audio-source.ts @@ -31,7 +31,7 @@ export class AudioSource extends Component { * Maximum volume a source can have. From 0 to 1 (0% to 100%). */ @property.float(1.0) - maxVolume!: number; + volume!: number; /** Path to the audio file that should be played. */ @property.string() @@ -106,7 +106,7 @@ export class AudioSource extends Component { return; } this.gainNode = new GainNode(_audioContext, { - gain: this.maxVolume, + gain: this.volume, }); this.gainNode.connect(_audioContext.destination); this.isLoaded = getAudioData(this.src);