]> gitweb.factorcode.org Git - factor.git/blob - extra/audio/engine/test/test.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / extra / audio / engine / test / test.factor
1 ! (c)2009 Joe Groff bsd license
2 USING: accessors alarms audio audio.engine audio.loader calendar
3 destructors io kernel locals math math.functions ;
4 IN: audio.engine.test
5
6 :: audio-engine-test ( -- )
7     "vocab:audio/engine/test/loop.aiff" read-audio :> loop-sound
8     "vocab:audio/engine/test/once.wav" read-audio :> once-sound
9     0 :> i!
10     <standard-audio-engine> :> engine
11     engine start-audio*
12     engine loop-sound T{ audio-source f { 1.0 0.0 0.0 } 1.0 { 0.0 0.0 0.0 } f } t <audio-clip>
13         :> loop-clip
14
15     [
16         i 1 + i!
17         i 0.05 * sin :> s
18         loop-clip source>> { s 0.0 0.0 } >>position drop
19
20         i 50 mod zero? [
21             engine once-sound T{ audio-source f { 0.0 0.0 0.0 } 1.0 { 0.0 0.0 0.0 } f } f
22             <audio-clip> drop
23         ] when
24
25         engine update-audio
26     ] 20 milliseconds every :> alarm
27     "Press Enter to stop the test." print
28     readln drop
29     alarm cancel-alarm
30     engine dispose ;
31
32
33 MAIN: audio-engine-test