チェンジセット 101: dada/as2/src/jp/sygnas/sound

差分発生行の前後
無視リスト:
コミット日時:
2007/11/15 10:37:04 (1 年前)
コミッタ:
sygnas
ログメッセージ:

--

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • dada/as2/src/jp/sygnas/sound/BGMManager.as

    r81 r101  
    3232*       myBGM.addBGM( "bgm1","bgm1.mp3","LOAD",50 ); 
    3333*       myBGM.fadein( "bgm1", 2 ); 
     34* 
     35* //////////////////////////////////////////////// 
     36* ■履歴 
     37* 2007/11/01    ストリーミングパラメータ「_streaming:Boolean」を追加。 
     38*                               ストリーミング再生時は fadein()、crossfade()をしてもフェードまでに再生が始まらない可能性があります。 
     39*                               ストリーミング再生時は、ループ指定がききません。onSoundComplete を受け取って play() を実行してください。 
     40*                               ストリーミング再生時は、即座にイベントonSoundPlay が呼び出されます。 
     41* 
     42* 2007/10/30    フェードイン時にもイベント「onSoundPlay」を発生するようにした。 
     43*                               STOP時に pause() を実行すると、play() を実行するように変更。 
     44* 
    3445* 
    3546* //////////////////////////////////////////////// 
     
    89100        public var _sound2:Sound;                               // サウンドオブジェクト。クロスフェード用 
    90101        public var _loop:Number;                                // ループ回数 
     102        public var _streaming:Boolean;                  // ストリーミング再生をする。 
    91103         
    92104        private var $bgmList:Object;                    // 曲のファイル名リスト { 識別子:{file:ファイル名, type:種別, vol:ボリューム } 
     
    185197                $enabled = true; 
    186198                _loop = 99999; 
     199                _streaming = false; 
    187200 
    188201                _sound1 = ___soundInit(); 
     
    228241        public function pause(){ 
    229242                if( !$enabled ) return; 
    230                 if( $mode == "STOP" ) return; 
    231                 ___pause(); 
     243                 
     244                if( $mode == "STOP" ){ 
     245                        this.play( $nowTitle ); 
     246                }else{ 
     247                        ___pause(); 
     248                } 
    232249        } 
    233250         
     
    367384                 
    368385                if( type == "LOAD" ){ 
    369                         _sound1.loadSound( file, false ); 
     386                        // ストリーミング指定されていたらすぐ再生に 
     387                        _sound1.loadSound( file, _streaming ); 
     388                        if( _streaming ) ___startSound(); 
    370389                }else{ 
    371390                        _sound1.attachSound( file ); 
     
    378397        */ 
    379398        private function ___loadSound( success:Boolean ){ 
     399                trace("___loadSound"); 
    380400                if(success){ 
    381                         ___startSound(); 
     401                        if( !_streaming ) ___startSound(); 
    382402                }else{ 
    383403                        $mode = "STOP"; 
     
    398418                        _sound1.setVolume(0); 
    399419                        $interval = setInterval( this, "___fadeInOut", INTERVAL ); 
     420                        $onSoundPlay( this ); 
    400421                }else{ 
    401422                        ___setVolume( $gVolume );       // ボリュームを再設定 
     
    509530                var sound:Sound = new Sound( $target ); 
    510531                sound.setVolume( $gVolume ); 
     532                sound.onSoundComplete = Delegate.create( this, ___onSoundComplete ); 
    511533                sound.onLoad = Delegate.create( this, ___loadSound ); 
    512                 sound.onSoundComplete = Delegate.create( this, ___onSoundComplete ); 
    513534                return sound; 
    514535        }