Skip to content

Commit 00d7ea6

Browse files
committed
Improve audio engine behavior
1 parent 81b2a6d commit 00d7ea6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CCBoot.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -2331,7 +2331,10 @@ cc.game = /** @lends cc.game# */{
23312331
if (this._paused) return;
23322332
this._paused = true;
23332333
// Pause audio engine
2334-
cc.audioEngine && cc.audioEngine._pausePlaying();
2334+
if (cc.audioEngine) {
2335+
cc.audioEngine.stopAllEffects();
2336+
cc.audioEngine.pauseMusic();
2337+
}
23352338
// Pause main loop
23362339
if (this._intervalId)
23372340
window.cancelAnimationFrame(this._intervalId);
@@ -2345,7 +2348,9 @@ cc.game = /** @lends cc.game# */{
23452348
if (!this._paused) return;
23462349
this._paused = false;
23472350
// Resume audio engine
2348-
cc.audioEngine && cc.audioEngine._resumePlaying();
2351+
if (cc.audioEngine) {
2352+
cc.audioEngine.resumeMusic();
2353+
}
23492354
// Resume main loop
23502355
this._runMainLoop();
23512356
},

cocos2d/audio/CCAudio.js

+1
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,7 @@ cc.Audio.WebAudio.prototype = {
810810
for(var i=0; i<ap[p].length; i++){
811811
list[i].stop();
812812
}
813+
list.length = 0;
813814
}
814815
},
815816

0 commit comments

Comments
 (0)