audio-engine-test ( -- )


Vocabulary
audio.engine.test

Inputs
None

Outputs
None

Definition


:: audio-engine-test ( -- )
"vocab:audio/engine/test/loop.aiff" read-audio :> loop-sound
"vocab:audio/engine/test/once.wav" read-audio :> once-sound
0 :> i! f 4 <audio-engine> :> engine engine start-audio*
engine
T{ audio-source { position { 1.0 0.0 0.0 } } } loop-sound t
play-static-audio-clip :> loop-clip engine
T{ audio-source { position { -1.0 0.0 0.0 } } }
noise-generator new 2 play-streaming-audio-clip
:> noise-clip [
i 1 + i! i 0.05 * [ sin ] [ cos ] bi
:> ( s c ) loop-clip source>> { c 0.0 s } >>position
drop noise-clip source>> { c 0.0 s } -2.0 v*n >>position
drop i 50 mod zero? [
engine
T{ audio-source } once-sound f
play-static-audio-clip drop
] when engine update-audio
] 20 milliseconds every
:> timer "Press Enter to stop the test." print readln drop
timer stop-timer engine dispose ;