gainNode : null,
_onended : null,
- 'Constructor' : function( target, url, option ){
+ 'Constructor' : function( disatcher, url, option ){
var i = 0,
l = X_WebAudio_BUFFER_LIST.length,
loader;
this.loader = loader = X_WebAudio_BufferLoader( this, url );
};
- this.target = target || this;
-
+ this.disatcher = disatcher || this;
this.setState( option );
this[ 'listenOnce' ]( X_EVENT_KILL_INSTANCE, this.onKill );
if ( !buffer ) {
this.error = loader.errorState;
- this.target[ 'dispatch' ]({
+ this.disatcher[ 'dispatch' ]({
type : X_EVENT_ERROR,
error : loader.errorState,
message : loader.errorState === 1 ?
this.audioBuffer = buffer;
this.duration = buffer.duration * 1000;
- this.target[ 'asyncDispatch' ]( X_EVENT_READY );
+ this.disatcher[ 'asyncDispatch' ]( X_EVENT_READY );
console.log( 'WebAudio buffer ready' );
actualPlay : function(){
var begin, end;
+ console.log( '[WebAudio] play abuf:' + !!this.audioBuffe );
+
if( !this.audioBuffer ){
this.autoplay = true;
return;
delete this._interval;
return X_CALLBACK_UN_LISTEN;
};
- this.target[ 'dispatch' ]( X_EVENT_MEDIA_PLAYING );
+ this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_PLAYING );
},
_onEnded : function(){
};
if( this.autoLoop ){
- if( !( this.target[ 'dispatch' ]( X_EVENT_MEDIA_BEFORE_LOOP ) & X_CALLBACK_PREVENT_DEFAULT ) ){
+ if( !( this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_BEFORE_LOOP ) & X_CALLBACK_PREVENT_DEFAULT ) ){
this.looped = true;
- this.target[ 'dispatch' ]( X_EVENT_MEDIA_LOOPED );
+ this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_LOOPED );
this.actualPlay();
};
} else {
this.actualPause();
- this.target[ 'dispatch' ]( X_EVENT_MEDIA_ENDED );
+ this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_ENDED );
};
};
},