My apologies if this is not the appropriate forum...I dont know if this may be a bug (probably not?) and I actually know how to do this, but I cant get it working right...
Ok, first, what Im trying to do:
Im making a racing game, and I want that every time you complete a lap, the music changes to another version of the same tune with more instruments.
Since all the music (small loops) have the same duration, logically I want that when I play a new track it begins at the same point the last one was on to make it seamless.
To put an example, think of Super Mario World when you get on Yoshi and some bongo-like drums get added to the music (
)
The problem? It kinda works....sometimes. I cant get this to work consistently and the new music usually just starts from the beginning.
What Im doing is using audio seek on the new track with the playbacktime of the previous one.
First thing that comes to mind is that since playbacktime accounts for total playback time (it doesnt loop with the sound) maybe the new sound doesnt like that you try go to a time point beyond the duration of the sound file....but this also fails (sometimes!) if you try to go to the next track before the first loop is complete. And even is the sound has already looped, it sometimes works as intended anyways....
Anyways, I also tried to use the music without looping and loop it manually with the "On ended" audio condition, but it doesnt fix this.
I made a very simple capx to illustrate it, it has 3 tracks:
-A 5 to "Go!" countdown (So whe can cleary know at wich point of track we are)
-Same track as the previous one with some drum beat.
-Same track as the previous one with another extra drum.
And 2 buttons to select track. Fiddle around with the buttons for a while and you will see how it sometimes works for a while, then stops working properly, then start to work right again, etc...
CAPX
...yeah, I know, I could just have the extra instruments alone in separate tracks, play everything at the same time, and mute/unmute the "layers" as needed...but since what Im trying to do makes sense to me I want to know why this doesnt work