mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-14 02:04:30 +08:00
设置立体声时更新音频路由
This commit is contained in:
1 parent
a70a17b51e
commit
1209acce50
2 files changed
+13
-3
No files matched your search
+11
-3
@@ -11,7 +11,7 @@ export class SoundEffect extends AudioPlayer {
|
||||
private _stopingAll: boolean = false;
|
||||
private playMap: Map<AudioBufferSourceNode, number> = new Map();
|
||||
|
||||
stereo: boolean = false;
|
||||
private _stereo: boolean = false;
|
||||
|
||||
gain: GainNode = AudioPlayer.ac.createGain();
|
||||
panner: PannerNode | null = null;
|
||||
@@ -24,6 +24,14 @@ export class SoundEffect extends AudioPlayer {
|
||||
return this.gain.gain.value;
|
||||
}
|
||||
|
||||
set stereo(value: boolean) {
|
||||
this._stereo = value;
|
||||
this.initAudio(value);
|
||||
}
|
||||
get stereo(): boolean {
|
||||
return this._stereo;
|
||||
}
|
||||
|
||||
constructor(data: ArrayBuffer, stereo: boolean = false) {
|
||||
super(data);
|
||||
|
||||
@@ -35,10 +43,10 @@ export class SoundEffect extends AudioPlayer {
|
||||
this.playMap.delete(node);
|
||||
});
|
||||
this.on('update', () => {
|
||||
this.initAudio(this.stereo);
|
||||
this.initAudio(this._stereo);
|
||||
});
|
||||
|
||||
this.stereo = stereo;
|
||||
this._stereo = stereo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user