X_Audio_WebAudio_context = new X_Audio_WebAudio_context;
X_Audio_BufferLoader = X_EventDispatcher[ 'inherits' ](
X_Audio_WebAudio_context = new X_Audio_WebAudio_context;
X_Audio_BufferLoader = X_EventDispatcher[ 'inherits' ](
[ 'listen' ]( X_EVENT_PROGRESS, this )
[ 'listenOnce' ]( [ X_EVENT_SUCCESS, X_EVENT_COMPLETE ], this );
},
[ 'listen' ]( X_EVENT_PROGRESS, this )
[ 'listenOnce' ]( [ X_EVENT_SUCCESS, X_EVENT_COMPLETE ], this );
},
// iOS 7.1 で decodeAudioData に処理が入った瞬間にスクリーンを長押しする(スクロールを繰り返す)と
// decoeAudioData の処理がキャンセルされることがある(エラーやコールバックの発火もなく、ただ処理が消滅する)。
// ただし iOS 8.1.2 では エラーになる
// iOS 7.1 で decodeAudioData に処理が入った瞬間にスクリーンを長押しする(スクロールを繰り返す)と
// decoeAudioData の処理がキャンセルされることがある(エラーやコールバックの発火もなく、ただ処理が消滅する)。
// ただし iOS 8.1.2 では エラーになる
- if( X_Audio_WebAudio_context.createBuffer && X_UA[ 'iOS' ] < 8 ){
- this._onDecodeSuccess( X_Audio_WebAudio_context.createBuffer( e.response, false ) );
+ if( X_UA[ 'iOS' ] < 8 || !X_Audio_WebAudio_context[ 'decodeAudioData' ] ){
+ this._onDecodeSuccess( X_Audio_WebAudio_context[ 'createBuffer' ]( e.response, false ) );
- if( X_Audio_WebAudio_context.decodeAudioData ){
- X_Audio_WebAudio_context.decodeAudioData( e.response,
+ if( X_Audio_WebAudio_context[ 'decodeAudioData' ] ){
+ X_Audio_WebAudio_context[ 'decodeAudioData' ]( e.response,
this.onDecodeSuccess = X_Closure_create( this, this._onDecodeSuccess ),
this.onDecodeError = X_Closure_create( this, this._onDecodeError ) );
this.onDecodeSuccess = X_Closure_create( this, this._onDecodeSuccess ),
this.onDecodeError = X_Closure_create( this, this._onDecodeError ) );
},
_onLoadBufferComplete : function( e ){
var loader = this.loader,
},
_onLoadBufferComplete : function( e ){
var loader = this.loader,
- this.gainNode = X_Audio_WebAudio_context.createGain ? X_Audio_WebAudio_context.createGain() : X_Audio_WebAudio_context.createGainNode();
- this.gainNode.connect( X_Audio_WebAudio_context.destination );
+ this.gainNode = X_Audio_WebAudio_context[ 'createGain' ] ? X_Audio_WebAudio_context[ 'createGain' ]() : X_Audio_WebAudio_context[ 'createGainNode' ]();
+ this.gainNode[ 'connect' ]( X_Audio_WebAudio_context[ 'destination' ] );
- this.source = X_Audio_WebAudio_context.createBufferSource();
- this.source.buffer = this.buffer;
- this.source.connect( this.gainNode );
+ this.bufferSource = X_Audio_WebAudio_context[ 'createBufferSource' ]();
+ this.bufferSource.buffer = this.buffer;
+ this.bufferSource[ 'connect' ]( this.gainNode );
// おかしい、stop 前に外していても呼ばれる、、、@Firefox33.1
// 破棄された X.Callback が呼ばれて、obj.proxy() でエラーになる。Firefox では、onended は使わない
// おかしい、stop 前に外していても呼ばれる、、、@Firefox33.1
// 破棄された X.Callback が呼ばれて、obj.proxy() でエラーになる。Firefox では、onended は使わない
} else {
this._timerID && X_Timer_remove( this._timerID );
this._timerID = X_Timer_once( end - begin, this, this._onEnded );
};
} else {
this._timerID && X_Timer_remove( this._timerID );
this._timerID = X_Timer_once( end - begin, this, this._onEnded );
};
- if( this.source.start ){
- this.source.start( 0, begin / 1000, end / 1000 );
+ if( this.bufferSource.start ){
+ this.bufferSource.start( 0, begin / 1000, end / 1000 );
- this.source.disconnect();
- delete this.source.onended;
- delete this.source;
+ this.bufferSource.disconnect();
+ delete this.bufferSource.onended;
+ delete this.bufferSource;