The solution to that was to cache the music files before the level loads, but it poses its own problem. Yes, I can load them in a "loading" layout beforehand, but there's no way to tell when it is finished!<font size="2">Well, there is a way to tell ;)
Caching is done within one tick. There is no way to stop the process.
+ System: Start of layout
-> XAudio2: Cache file AppPath & "music\first.ogg"
-> XAudio2: Cache file AppPath & "music\second.ogg"
-> System: Go to layout 2 with transition "None" lasting 0 MS
This will switch to layout 2 as soon as the two files are cached. It will not go the specified layout before both files are fully loaded to memory.
+ System: TickCount Equal to 60
-> XAudio2: Cache file AppPath & "music\first.ogg"
-> XAudio2: Cache file AppPath & "music\second.ogg"
+ System: TickCount Equal to 61
-> System: Go to layout 2 with transition "None" lasting 0 MS
This will switch to layout 2 right after the files are cached, at tick 61.
You could also start with doing all the loading of other stuff, then when you're ready to cache the ogg files, store the current tick count to a variable and go to another layout as soon as the caching is done:
+ System: Timer is Equal to 1000
-> XAudio2: Cache file AppPath & "music\first.ogg"
-> XAudio2: Cache file AppPath & "music\second.ogg"
-> System: Set global variable 'cachingTick' to TickCount
+ System: Is global variable 'cachingTick' Greater than 0
+ System: TickCount Equal to global('cachingTick') + 1
-> System: Go to layout 2 with transition "None" lasting 0 MS
</font>