From b2ef365eecb2297a8a4d720bbe1fcaa7b93242e0 Mon Sep 17 00:00:00 2001 From: VisualSJ Date: Mon, 16 Jan 2017 17:30:03 +0800 Subject: [PATCH] review code --- cocos2d/audio/CCAudio.js | 1 - cocos2d/core/components/CCAudioSource.js | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/cocos2d/audio/CCAudio.js b/cocos2d/audio/CCAudio.js index ecf8565f3b..e86787a786 100644 --- a/cocos2d/audio/CCAudio.js +++ b/cocos2d/audio/CCAudio.js @@ -381,7 +381,6 @@ var WebAudioElement = function (buffer, audio) { this._currentSource.onended = null; this.pause(); this.play(); - this._currentSource.onended = this._endCallback; } return num; }); diff --git a/cocos2d/core/components/CCAudioSource.js b/cocos2d/core/components/CCAudioSource.js index ce0374a8f3..91d2cd5a44 100644 --- a/cocos2d/core/components/CCAudioSource.js +++ b/cocos2d/core/components/CCAudioSource.js @@ -114,11 +114,7 @@ var AudioSource = cc.Class({ return this._volume; }, set: function (value) { - if (value < 0) { - value = 0; - } else if (value > 1) { - value = 1; - } + value = cc.clamp01(value); this._volume = value; var audio = this.audio; if (audio && !this._mute) {