# HG changeset patch # User Sam # Date 1707059274 -25200 # Node ID a2736295c3f6ed77a012dcb7432139634f07df67 # Parent cbbb9abe256e54227279e930b4946f77cd302a54 add: proper sound test, from public domain diff -r cbbb9abe256e -r a2736295c3f6 tests/resources/default/toccata_et_fugue.ogg Binary file tests/resources/default/toccata_et_fugue.ogg has changed diff -r cbbb9abe256e -r a2736295c3f6 tests/test_audio.nim --- 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()