OSDN Git Service

Version 0.6.178, fix X.KB for IE5-, X.HTMLAudio for ChromeWV & AOSP.
[pettanr/clientJs.git] / 0.6.x / js / 07_audio / 01_XWebAudio.js
index 522443d..50cf05c 100644 (file)
@@ -217,7 +217,7 @@ if( X_WebAudio_context ){
             gainNode        : null,
             _onended        : null,
             
-                       'Constructor' : function( target, url, option ){                                
+                       'Constructor' : function( disatcher, url, option ){                             
                                var i = 0,
                                        l = X_WebAudio_BUFFER_LIST.length,
                                        loader;
@@ -245,8 +245,7 @@ if( X_WebAudio_context ){
                                        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 );
@@ -280,7 +279,7 @@ if( X_WebAudio_context ){
                        if ( !buffer ) {
                                this.error = loader.errorState;
                                
-                           this.target[ 'dispatch' ]({
+                           this.disatcher[ 'dispatch' ]({
                                                                type    : X_EVENT_ERROR,
                                                                error   : loader.errorState,
                                                                message : loader.errorState === 1 ?
@@ -294,7 +293,7 @@ if( X_WebAudio_context ){
                        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' );
                        
@@ -305,6 +304,8 @@ if( X_WebAudio_context ){
                        actualPlay : function(){
                                var begin, end;
                                
+                               console.log( '[WebAudio] play abuf:' + !!this.audioBuffe );
+                               
                    if( !this.audioBuffer ){
                        this.autoplay = true;
                        return;
@@ -361,7 +362,7 @@ if( X_WebAudio_context ){
                                                delete this._interval;
                                                return X_CALLBACK_UN_LISTEN;
                                        };
-                                       this.target[ 'dispatch' ]( X_EVENT_MEDIA_PLAYING );
+                                       this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_PLAYING );
                                },
                                                
                                _onEnded : function(){
@@ -384,14 +385,14 @@ if( X_WebAudio_context ){
                                };
                                
                                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 );
                                };
                            };
                                },