Hi yall
I would like to ask how we could make a list of all audio files in this directory ( sound ) ? I am working on a dialogue system and every phrase requires an audio file for that. Currently this test script works for just thie mp3 file. But if later i have phrase1.wav , phrase2.wav … phrase-n.wav … i want to get adresses of them first then to ease the execution.
Thanks yall
from bge import logic as log
import aud
c = log.getCurrentController()
o = c.owner
sp = c.sensors["Keyboard"]
s_path = log.expandPath("//sounds/")
s = aud.Factory.file(s_path + "plup new.mp3")
if "handle" not in o:
o["handle"] = ""
else:
if sp.positive:
o["handle"] = aud.device().play(s)
o["handle"].volume = 1.0
else:
o["handle"].stop()