# HG changeset patch # User Sam # Date 1687112098 -25200 # Node ID bcd246da025dfc9ce42b61f24a01115d51598e79 # Parent 42e692716e38bce05d6f9c51044fc9099ee9c5f4 add: check if track is playing diff -r 42e692716e38 -r bcd246da025d src/semicongine/audio.nim --- a/src/semicongine/audio.nim Wed Jun 14 23:31:59 2023 +0700 +++ b/src/semicongine/audio.nim Mon Jun 19 01:14:58 2023 +0700 @@ -146,6 +146,10 @@ return true return false +proc isPlaying*(mixer: var Mixer, track: string): bool = + mixer.lock.withLock(): + return mixer.tracks.contains(track) and mixer.tracks[track].playing.len > 0 + func applyLevel(sample: Sample, levelLeft, levelRight: Level): Sample = [int16(float(sample[0]) * levelLeft), int16(float(sample[1]) * levelRight)]