Godot Version
4.3
Question
I can’t seem to find a way to check if an AudioStreamPlayer (or the stream associated with it) is playing a looping sound or not.
Any ideas on how to do this?
4.3
I can’t seem to find a way to check if an AudioStreamPlayer (or the stream associated with it) is playing a looping sound or not.
Any ideas on how to do this?
I presume you mean find out in code? Otherwise it is in the import settings or just play it and see if it loops.
I tested this code on my game EngineSound which is looped WAV file and it worked.
if EngineSound.stream is AudioStreamWAV:
var wav_stream: AudioStreamWAV = EngineSound.stream
if wav_stream.loop_mode != AudioStreamWAV.LOOP_DISABLED:
print("This WAV file loops.")
else:
print("This WAV file does not loop.")
I only use wav files so this is all I can test. Sorry.
Paul
PS The EnineSound node is an AudioStreamPlayer (just for clarity)
PPS I tested it on my LaserSound too, which is not looped, and it worked as well.
That was just what I was looking for - thanks a bunch Paul
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.