# HG changeset patch # User Sam # Date 1687112098 -25200 # Node ID e3aa2680394dfa031fe87b458f1021e6a0281731 # Parent b9f349ac7550f50fa605d301c3f9276195ddb453 add: check if track is playing diff -r b9f349ac7550 -r e3aa2680394d 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)]