!( X_UA[ 'Gecko' ] && X_UA[ 'Android' ] ) &&
( window.AudioContext || window.webkitAudioContext ),
X_Audio_BUFFER_LIST = [],
- X_Audio_WebAudioWrapper;
+ X_Audio_WebAudioWrapper,
+ X_Audio_BufferLoader;
/*
* iPhone 4s 以下、iPad2以下、iPad mini 1以下, iPod touch 4G 以下は不可
this.setState( option );
- this[ 'listenOnce' ]( X_EVENT_KILL_INSTANCE, X_WebAudio_handleEvent );
+ this[ 'listenOnce' ]( X_EVENT_KILL_INSTANCE, this.onKill );
if( loader.buffer || loader.error ){
this._onLoadBufferComplete();
loader[ 'listenOnce' ]( X_EVENT_COMPLETE, this, this._onLoadBufferComplete );
};
},
+
+ onKill : function(){
+ this.loader[ 'unlisten' ]( X_EVENT_COMPLETE, this, this._onLoadBufferComplete )
+ .unregister( this );
+
+ delete this.buffer;
+
+ this.playing && this.actualPause();
+ this.source && this._sourceDispose();
+
+ this._onended && X_Callback_correct( this._onended );
+
+ this.gainNode && this.gainNode.disconnect();
+ },
_onLoadBufferComplete : function( e ){
var loader = this.loader,
buffer = loader.buffer;
}
);
- function X_WebAudio_handleEvent( e ){
- switch( e.type ){
-
- case X_EVENT_KILL_INSTANCE :
- this.loader[ 'unlisten' ]( X_EVENT_COMPLETE, this, this._onLoadBufferComplete )
- .unregister( this );
-
- delete this.buffer;
-
- this.playing && this.actualPause();
- this.source && this._sourceDispose();
-
- this._onended && X_Callback_correct( this._onended );
-
- this.gainNode && this.gainNode.disconnect();
- break;
- };
- };
-
/*
* http://qiita.com/sou/items/5688d4e7d3a37b4e2ff1
* L-01F 等の一部端末で Web Audio API の再生結果に特定条件下でノイズが混ざることがある。