+var X_AudioBase = X_EventDispatcher[ 'inherits' ](\r
+ 'X.AudioBase',\r
+ X_Class.ABSTRACT,\r
+ {\r
+ disatcher : null,\r
+ \r
+ startTime : 0, // state_startTime\r
+ endTime : -1, // state_startTime\r
+ loopStartTime : -1,\r
+ loopEndTime : -1,\r
+ seekTime : -1,\r
+ duration : 0, //\r
+\r
+ playing : false,\r
+ error : 0, // \r
+ autoLoop : false,\r
+ looped : false,\r
+ autoplay : false,//\r
+ gain : 0.5,\r
+ \r
+ _playReserved : false,\r
+ \r
+ play : function( startTime, endTime, loop, loopStartTime, loopEndTime ){\r
+ if( 0 <= startTime ){\r
+ this.setState( {\r
+ 'currentTime' : startTime,\r
+ 'startTime' : startTime,\r
+ 'endTime' : endTime,\r
+ 'loop' : loop,\r
+ 'looped' : false,\r
+ 'loopStartTime' : loopStartTime,\r
+ 'loopEndTime' : loopEndTime\r
+ } );\r
+ };\r
+ // canPlay() : autoplay = true\r
+ this.actualPlay();\r
+ },\r
+ \r
+ seek : function( seekTime ){\r
+ if( seekTime < X_Audio_getEndTime( this ) ){\r
+ this.setState( { 'currentTime' : seekTime } );\r
+ };\r
+ },\r
+ \r
+ pause : function(){\r
+ this.seekTime = this.getActualCurrentTime();\r
+ this.playing && this.actualPause();\r
+ // delete this.autoplay\r
+ // delete this.playing\r
+ }, \r
+ \r
+ loop : function( v ){\r
+ if( v === undefined ){\r
+ return this.autoLoop;\r
+ };\r
+ this.setState( { 'loop' : v } );\r
+ },\r
+\r
+ volume : function( v ){\r
+ if( v === undefined ){\r
+ return this.gain;\r
+ };\r
+ this.setState( { 'volume' : v } );\r
+ },\r
+\r
+ currentTime : function( v ){\r
+ if( v === undefined ){\r
+ return this.playing ? this.getActualCurrentTime() : this.seekTime;\r
+ };\r
+ this.setState( { 'currentTime' : v } );\r
+ },\r
+ \r
+ getState : function(){\r
+ \r
+ return {\r
+ 'startTime' : this.startTime,\r
+ 'endTime' : this.endTime < 0 ? this.duration : this.endTime,\r
+ 'loopStartTime' : this.loopStartTime < 0 ? this.startTime : this.loopStartTime,\r
+ 'loopEndTime' : this.loopEndTime < 0 ? ( this.endTime || this.duration ) : this.loopEndTime,\r
+ 'loop' : this.autoLoop,\r
+ 'looped' : this.looped,\r
+ 'volume' : this.gain,\r
+ 'playing' : this.playing, \r
+ 'duration' : this.duration,\r
+ 'autoplay' : this.autoplay,\r
+ \r
+ 'currentTime' : this.playing ? this.getActualCurrentTime() : this.seekTime,\r
+ 'error' : this.getActualError ? this.getActualError() : this.error\r
+ };\r
+ },\r
+ \r
+ setState : function( obj ){\r
+ var playing = this.playing,\r
+ k, v,\r
+ end = 0, seek = 0, volume = 0;\r
+ \r
+ for( k in obj ){\r
+ v = obj[ k ];\r
+ switch( k ){\r
+ case 'currentTime' :\r
+ v = X_Audio_timeStringToNumber( v );\r
+ if( X_Type_isNumber( v ) ){\r
+ if( playing ){\r
+ if( this.getActualCurrentTime() !== v ){\r
+ seek = 2;\r
+ this.seekTime = v;\r
+ }; \r
+ } else {\r
+ this.seekTime = v;\r
+ };\r
+ } else {\r
+ continue;\r