feat: 获取音量大小接口

This commit is contained in:
unanmed 2025-01-20 18:30:50 +08:00
parent e32ffd2cc9
commit f014befbbd
3 changed files with 14 additions and 2 deletions

View File

@ -78,6 +78,13 @@ export class BgmController<
this.mainGain.setVolume(volume);
}
/**
*
*/
getVolume() {
return this.mainGain.getVolume();
}
/**
*
* @param enabled

View File

@ -45,6 +45,13 @@ export class SoundPlayer<
this.gain.setVolume(volume);
}
/**
*
*/
getVolume() {
return this.gain.getVolume();
}
/**
*
* @param id

View File

@ -385,8 +385,6 @@ export class AudioStreamSource extends AudioSource implements IStreamReader {
this.createSourceNode(this.buffer);
this.output.start(0, when);
this.playing = true;
console.log(when);
this.output.addEventListener('ended', () => {
this.playing = false;
this.emit('end');