I'm syncing up some music to my game's intro, but to my horror, I've found that I can't make tracker music sync with the action at all. The Position property is pretty much useless (It increments once every 5 seconds, which is not what I want), and PositionMs doesn't work at all, even though the documentation said it worked with all formats but MIDI.
I'm currently timing the action with this code:
if (intromus != null && intromus.IsPlaying) lblMusicTime.Text = String.Format ("%d",intromus.PositionMs);
I tried to play a silent MIDI on another channel... but apparently you're not allowed to play both an XM and a MIDI at the same time.
Am I just using it wrong? I don't want to use MP3 music, but AGS' syncing capabilities seem to be sorely lacking when it comes to non-digital music - I could just try to find MIDI music, but I don't like the sound of them compared to tracker music.
Couldn't you just count game frames as soon as you start playing the XM?
This will get you down to an accuracy of 25 milliseconds.
That works, I managed to time the cutscene pretty accurately. Thanks!
When I need a dynamic scene to be timed to music, I'll be sure to use MIDI instead, but timing the scene at the same time as the XM playing works for static ones.
I made some research, and apparently this is a bug in AGS. It does not calculate the tracker music position properly (uses wrong information from track format).
I think I found more correct way to do this from DUMB documentation. Need to test the thing more first, but it at least seem to match the timer made with DateTime class.
Quote from: Scavenger on Sat 05/10/2013 22:40:58
I tried to play a silent MIDI on another channel... but apparently you're not allowed to play both an XM and a MIDI at the same time.
Hmm, which method did you use (backward-compatible, or new audio system)? And, prior to that, which version of AGS?
AFAIK older functions did not support playing two and more clips simultaneously at all.
As for new audio system, in AGS 3.2.1 MIDI plays normally in parallel to XM music on a separate channel for me.
If you are using that one, you have to define at least 2 channels for the "music" type (or whichever type your tracks are assigned to). Also, there may be issue with sound priority (if there are not enough channels and already playing clips have higher priority than the new one, the new one will not start.
Ah, I'm glad to have found a bug. :)
As for the other issue, it was a case of me not allocating enough music channels. I'll remember to do that in the future.