diff --git a/cocos2d/audio/CCAudio.js b/cocos2d/audio/CCAudio.js index 39a85c8719..ce8a383cef 100644 --- a/cocos2d/audio/CCAudio.js +++ b/cocos2d/audio/CCAudio.js @@ -28,7 +28,7 @@ var EventTarget = require('../core/event/event-target'); var touchBinded = false; var touchPlayList = [ - //{ offset: 0, audio: audio } + //{ instance: Audio, offset: 0, audio: audio } ]; var Audio = function (src) { @@ -110,7 +110,7 @@ Audio.State = { this._element.src = elem.src; this._audioType = Audio.Type.DOM; } else { - this._element = new WebAudioElement(elem); + this._element = new WebAudioElement(elem, this); this._audioType = Audio.Type.WEBAUDIO; } this._bindEnded(); @@ -124,9 +124,9 @@ Audio.State = { this.emit('play'); this._state = Audio.State.PLAYING; - if (this._audioType = Audio.Type.DOM && this._element.paused) { + if (this._audioType === Audio.Type.DOM && this._element.paused) { this.stop(); - touchPlayList.push({ offset: 0, audio: this._element }); + touchPlayList.push({ instance: this, offset: 0, audio: this._element }); } if (touchBinded) return; @@ -163,6 +163,13 @@ Audio.State = { this._element.currentTime = 0; } catch (error) {} this._element.pause(); + // remove touchPlayList + for (var i=0; i 0) { @@ -161,13 +162,13 @@ exports.deprecated = function (audioEngine) { } }); js.get(audioEngine, 'stopEffect', function () { - cc.warn(INFO, 'audioEngine.stopEffect', 'audioEngine.stop'); + // cc.warn(INFO, 'audioEngine.stopEffect', 'audioEngine.stop'); return function (id) { return audioEngine.stop(id); } }); js.get(audioEngine, 'stopAllEffects', function () { - cc.warn(INFO, 'audioEngine.stopAllEffects', 'audioEngine.stopAll'); + // cc.warn(INFO, 'audioEngine.stopAllEffects', 'audioEngine.stopAll'); return function () { var id2audio = audioEngine._id2audio; for (var id in id2audio) { @@ -181,7 +182,7 @@ exports.deprecated = function (audioEngine) { } }); js.get(audioEngine, 'unloadEffect', function () { - cc.warn(INFO, 'audioEngine.unloadEffect', 'audioEngine.stop'); + // cc.warn(INFO, 'audioEngine.unloadEffect', 'audioEngine.stop'); return function (id) { return audioEngine.stop(id); } @@ -189,7 +190,7 @@ exports.deprecated = function (audioEngine) { if (!CC_JSB) { js.get(audioEngine, 'end', function () { - cc.warn(INFO, 'audioEngine.end', 'audioEngine.stopAll'); + // cc.warn(INFO, 'audioEngine.end', 'audioEngine.stopAll'); return function () { return audioEngine.stopAll(); }