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