root/as3/ASound/branches/gamiken/src/example/Example5.as

リビジョン 2627, 1.0 kB (コミッタ: gamiken, コミット時期: 3 年 前)

waveファイルを読み込んで使用できるように拡張

Line 
1 package example
2 {
3    
4     import com.kappaLab.asound.effects.ReverbEffect;
5     import com.kappaLab.asound.samplers.Sampler;
6     import flash.display.Sprite;
7     import flash.events.TimerEvent;
8     import flash.utils.ByteArray;
9     import flash.utils.Timer;
10    
11     public class Example5 extends Sprite
12     {
13         /*
14          * target audio file
15          * now,ASound supports only a wave file.
16          */
17         [Embed(source="s_1.wav", mimeType="application/octet-stream")]
18                 private static const WavData:Class
19        
20         public function Example5()
21         {
22             var s:Sampler = new Sampler(new WavData() as ByteArray);
23             s.effects.push(new ReverbEffect(s,300,.9,.5))
24             s.play();
25            
26            
27             var t:Timer = new Timer(2000)
28             t.addEventListener(TimerEvent.TIMER,ontimer)
29             t.start()
30             function ontimer(e:TimerEvent):void
31             {
32                 s.play()
33             }
34         }
35     }
36    
37 }
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。