Skip to content

Commit ef9524d

Browse files
committed
merge with TW upstream
2 parents 4008a3c + dc47bf3 commit ef9524d

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

‎.github/workflows/node.js.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
11+
- uses: actions/checkout@v4
1212
with:
1313
persist-credentials: false
1414
- name: Install Node.js
15-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
15+
uses: actions/setup-node@v4
1616
with:
17-
node-version: 20
17+
node-version: 22
1818
cache: npm
1919
- run: npm ci
2020
- run: npm run lint

‎src/SoundBank.js‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,29 @@ class SoundBank {
9898
return this.soundEffects.get(sound);
9999
}
100100

101+
/**
102+
* Remove a single sound player and release its resources.
103+
* @param {string} soundId - the id of the sound player to remove
104+
*/
105+
removeSoundPlayer (soundId) {
106+
const player = this.soundPlayers[soundId];
107+
if (player) {
108+
player.dispose();
109+
delete this.soundPlayers[soundId];
110+
}
111+
112+
const effects = this.soundEffects.get(soundId);
113+
if (effects) {
114+
if (player) {
115+
effects.removeSoundPlayer(player);
116+
}
117+
effects.dispose();
118+
this.soundEffects.delete(soundId);
119+
}
120+
121+
this.playerTargets.delete(soundId);
122+
}
123+
101124
/**
102125
* Play a sound.
103126
* @param {Target} target - Target to play for

‎src/effects/EffectChain.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class EffectChain {
8888
* @param {SoundPlayer} soundPlayer - a sound player to stop managing
8989
*/
9090
removeSoundPlayer (soundPlayer) {
91-
this._soundPlayers.remove(soundPlayer);
91+
this._soundPlayers.delete(soundPlayer);
9292
}
9393

9494
/**

0 commit comments

Comments
 (0)