Skip to content

Commit

Permalink
fix(サウンド関係): リソースを破棄したあと再度リソースを破棄する場合にエラーになっていた件
Browse files Browse the repository at this point in the history
  • Loading branch information
famibee committed May 4, 2024
1 parent 6f654da commit 743d13c
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
- fix(サウンド関係): リソースを破棄したあと再度リソースを破棄する場合にエラーになっていた件


## [1.53.2](https://github.com/famibee/SKYNovel/compare/v1.53.1...v1.53.2) (2024-05-04)


Expand Down
7 changes: 6 additions & 1 deletion dist/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19555,7 +19555,12 @@ class zg {
}
class Xi {
constructor(t, e = !0) {
e && (t.snd.stop(), t.loop && t.snd.destroy());
if (e) {
if (t.snd.stop(), !t.loop)
return;
t.snd.destroy(), t.snd.destroy = () => {
};
}
}
// destroy がないと再生が残るケースが。効果音だと破棄が激しいのでループモノ(BGM)だけにする
onLoad() {
Expand Down
2 changes: 1 addition & 1 deletion dist/app.js.map

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions dist/appMain.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/appMain.js.map

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion dist/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -21152,7 +21152,12 @@ class SsWaitingFade {
}
class SsStop {
constructor(t, e = !0) {
e && (t.snd.stop(), t.loop && t.snd.destroy());
if (e) {
if (t.snd.stop(), !t.loop)
return;
t.snd.destroy(), t.snd.destroy = () => {
};
}
}
// destroy がないと再生が残るケースが。効果音だと破棄が激しいのでループモノ(BGM)だけにする
onLoad() {
Expand Down
2 changes: 1 addition & 1 deletion dist/web.js.map

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/sn/SndBuf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,13 @@ class SsWaitingFade implements ISndState {

class SsStop implements ISndState {
constructor(sb: ISndBuf, stop = true) {
if (stop) {sb.snd.stop(); if (sb.loop) sb.snd.destroy()}
if (stop) {
sb.snd.stop();
if (! sb.loop) return;

sb.snd.destroy();
sb.snd.destroy = ()=> {}; // 再度コール時エラー対策
}
} // destroy がないと再生が残るケースが。効果音だと破棄が激しいのでループモノ(BGM)だけにする
onLoad() {} // ok
stopse() {} // ok
Expand Down

0 comments on commit 743d13c

Please sign in to comment.