Add sound emitter volume control and update runtime host for various controls

This commit is contained in:
2026-04-14 02:38:06 +02:00
parent 982409e83f
commit a995cd172e
3 changed files with 413 additions and 31 deletions

View File

@@ -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);