parameter soundConfig is now optionnal

if user call mySound.play() the sound will be played with the base SoundConfig
This commit is contained in:
DESKTOP-FMM8UI0\CLV 2021-04-23 17:03:17 +02:00
parent f03f8076f3
commit b79d76fc2e
3 changed files with 37 additions and 18 deletions

View file

@ -15,7 +15,7 @@ const isSoundConfig =
export const isPlaySoundEvent =
new tg.IsInterface().withProperties({
url: tg.isString,
config : isSoundConfig,
config : tg.isOptional(isSoundConfig),
}).get();
/**

View file

@ -24,11 +24,10 @@ class SoundManager {
return soundPromise;
}
public async playSound(loadPlugin: LoaderPlugin, soundManager : BaseSoundManager, soundUrl: string, config: SoundConfig) : Promise<void> {
public async playSound(loadPlugin: LoaderPlugin, soundManager : BaseSoundManager, soundUrl: string, config: SoundConfig|undefined) : Promise<void> {
const sound = await this.loadSound(loadPlugin,soundManager,soundUrl);
sound.play(config);
if (config === undefined) sound.play();
else sound.play(config);
}
public stopSound(soundManager : BaseSoundManager,soundUrl : string){