Add sound emitter volume control and update runtime host for various controls
This commit is contained in:
@@ -215,6 +215,10 @@ export class RuntimeAudioSystem {
|
||||
this.playBufferedSound(soundEmitterId);
|
||||
}
|
||||
|
||||
hasSoundEmitter(soundEmitterId: string): boolean {
|
||||
return this.soundEmitters.has(soundEmitterId);
|
||||
}
|
||||
|
||||
stopSound(soundEmitterId: string) {
|
||||
this.pendingPlayEmitterIds.delete(soundEmitterId);
|
||||
|
||||
@@ -233,6 +237,17 @@ export class RuntimeAudioSystem {
|
||||
}
|
||||
}
|
||||
|
||||
setSoundEmitterVolume(soundEmitterId: string, volume: number) {
|
||||
const soundEmitter = this.soundEmitters.get(soundEmitterId);
|
||||
|
||||
if (soundEmitter === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
soundEmitter.entity.volume = volume;
|
||||
this.updateSoundEmitterVolume(soundEmitter);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
for (const soundEmitterId of this.soundEmitters.keys()) {
|
||||
this.stopSound(soundEmitterId);
|
||||
|
||||
Reference in New Issue
Block a user