comparison tests/test_audio.nim @ 854:48a2ac8bec07

did: some more audio functionality, some unfinished grid-mesh code
author Sam <sam@basx.dev>
date Tue, 26 Dec 2023 15:16:34 +0700
parents 754835bf175e
children ffc265916415
comparison
equal deleted inserted replaced
853:f5009fbb2cbc 854:48a2ac8bec07
12 12
13 let s1 = mixer[].play("test1", loop=true) 13 let s1 = mixer[].play("test1", loop=true)
14 let s2 = mixer[].play("test2", loop=true) 14 let s2 = mixer[].play("test2", loop=true)
15 15
16 let t0 = now() 16 let t0 = now()
17 mixer[].setLevel(0.5)
17 while true: 18 while true:
18 let runtime = (now() - t0).inMilliseconds() 19 let runtime = (now() - t0).inMilliseconds()
19 if runtime > 1500: 20 if runtime > 1500:
20 mixer[].setLevel(0.1) 21 mixer[].setLevel(0.2)
21 if runtime > 3000: 22 if runtime > 3000:
22 mixer[].stop(s2) 23 mixer[].stop(s2)
23 if runtime > 6000: 24 if runtime > 6000:
24 mixer[].stop("") 25 mixer[].stop("")
25 if runtime > 8000: 26 if runtime > 8000:
70 discard mixer[].play("ping", track="effects", stopOtherSounds=true, level=0.5) 71 discard mixer[].play("ping", track="effects", stopOtherSounds=true, level=0.5)
71 discard stdin.readLine() 72 discard stdin.readLine()
72 73
73 when isMainModule: 74 when isMainModule:
74 startMixerThread() 75 startMixerThread()
75 test1() 76 # test1()
77 # mixer[].stop()
78 # test2()
79 # mixer[].stop()
80 test3()
76 mixer[].stop() 81 mixer[].stop()
77 test2()
78 mixer[].stop()
79 # test3()
80 # mixer[].stop()