1
$\begingroup$

I want to play an intro sound, then when the intro is finished, play the full looped song.

What is the best strategy/tactic? Delay the playing of the loop by the lenght of the intro? Detect when the intro actuator has finished its job?

  • Play this audio file first: A "always" sensor connected to a "And" with use_priority connected to a "play_end" sound actuator
  • Then, connected to the same always sensor but with a regular AND python module connected to a "Loop_end" sound actuator :

.

def menuMusic(cont):
    loop = cont.owner.actuators["Loop"]
    time.sleep(0.5) # delays for 5 seconds
    cont.activate(loop)

But both my files are playing (in perfect sync, I must say)...

$\endgroup$
  • $\begingroup$ How do you now that the intro has finnished ? or it has a fixed time $\endgroup$ – Chebhou Mar 6 '15 at 22:15
1
$\begingroup$

Here's what I ended up doing: there's a property time that I did not know about: Timer. I then set a property sensor to track this "Timer" value, but the "equal" eval type did not work, I had to use "interval" and set my interval using the right n.000000 notation. By precisely tuning the Minimum value, I managed to get a sample-perfect intro+loop sequence.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.