Mercurial > games > semicongine
changeset 428:545b4c58601f
add: proper sound test, from public domain
author | Sam <sam@basx.dev> |
---|---|
date | Sun, 04 Feb 2024 22:07:54 +0700 |
parents | b1c9374c7080 |
children | 740d2f0d1264 |
files | tests/resources/default/toccata_et_fugue.ogg tests/test_audio.nim |
diffstat | 2 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test_audio.nim Sat Feb 03 23:03:34 2024 +0700 +++ b/tests/test_audio.nim Sun Feb 04 22:07:54 2024 +0700 @@ -10,8 +10,8 @@ mixer[].addSound("test2", newSound(sineSoundData(500, 2, 44100))) - let s1 = mixer[].play("test1", loop=true) - let s2 = mixer[].play("test2", loop=true) + let s1 = mixer[].play("test1", loop = true) + let s2 = mixer[].play("test2", loop = true) let t0 = now() mixer[].setLevel(0.5) @@ -62,14 +62,11 @@ sleep(1) proc test3() = - mixer[].addSound("pianosong", loadAudio("test.ogg")) + mixer[].addSound("toccata et fugue", loadAudio("toccata_et_fugue.ogg")) mixer[].addSound("ping", newSound(sineSoundData(500, 0.05, 44100))) mixer[].addTrack("effects") - discard mixer[].play("pianosong") + discard mixer[].play("toccata et fugue") - while mixer[].isPlaying(): - discard mixer[].play("ping", track="effects", stopOtherSounds=true, level=0.5) - discard stdin.readLine() when isMainModule: startMixerThread() @@ -77,5 +74,10 @@ mixer[].stop() test2() mixer[].stop() - # test3() - # mixer[].stop() + test3() + + while mixer[].isPlaying(): + discard mixer[].play("ping", track = "effects", stopOtherSounds = true, level = 0.5) + echo "Press q and enter to exit" + if stdin.readLine() == "q": + mixer[].stop()