Hello, I am a bit confused about how the Sequence works. I am currently working on making a sequence of functions, which will play audio files and show some text along with it.
I want the sequence to wait until the current audio has played before it plays the next one. I then just put in the length of the audio clip in the wait function. However, this returns a wait time of 0.
Here is an example of what I am doing:
Sequence(Func(player_voice.load_audio, 'report.wav'),
Func(player_voice.play),
Func(base.text.new_text, voice_strings['radio1']),
Func(print, player_voice.audio_length),
Wait(player_voice.audio_length),
Func(base.text.new_text, "END"),
).start()
In the function, load_audio()
, the variable audio_length
is set to the actual length of the clip.
def load_audio(self, file):
path = 'sounds/voices/'+file
self.audio = base.superloader.load_sound(path, self.emitter)
self.audio_length = self.audio.length()
print(self.audio_length)
As you can see, I print the length of the audio both in the sequence and in the function, load_audio
. It returns 3 seconds from load_audio
but 0 from the sequence.
Does functions called in sequences bahave differently that from regular functions? If they do, do you have any suggestions how I could solve this?
If you need me to provide more code, please let me know. Thank you for your time