Tip: Care with timelines, music, objects and loops

edited December 2014 in General discussions
Thought I'd share yesterdays grief I had using a piece of music in a timeline track that contained a loop. Here's what the object and timeline looked like:
[TitleObject]
Graphic		=	TitleGraphic
Position	= (90, 90, -0.2)
Alpha = 0.95
TrackList = TitleTrack

[TitleTrack]
0 = >Object.Create TitleCreditsObject # Object.SetOwner < ^
1 = Object.AddSound ^ ThemeMusic
4 = >Object.Create TitleTouchObject # Object.SetOwner < ^
8 = >Object.Create TitleRulesObject # Object.SetOwner < ^
12 = Object.Enable ^ True ; dummy command to pad time
Loop = True

In windows, everything sounded fine when I started the game. I wanted the music to only occur when the TitleObject existed.

All was sweet, then I tested on Android. After a few seconds, it sounded like there was another copy of the music playing at the same time but, was out of phase, and it got worse as it went along.

After pulling my hair out for a day checking event code, I finally looked at the TitleTrack and realised my mistake.

For every loop in my TitleTrack which runs for 12 seconds, the another copy of the music would start at second 1. Not what I intended.

Windows covered this up due to the speed of the machine keeping copies in phase at first, but it was very obvious on a lower powered android device.

The solution is to of course, not play the music in the track, but to attach the music to the object itself.
[TitleObject]
Graphic		=	TitleGraphic
Position	= (90, 90, -0.2)
Alpha = 0.95
SoundList = ThemeMusic

[TitleTrackMobile]
0 = >Object.Create TitleCreditsObject # Object.SetOwner < ^
4 = >Object.Create TitleTouchObject # Object.SetOwner < ^
8 = >Object.Create TitleRulesObject # Object.SetOwner < ^
12 = Object.Enable ^ True ; dummy command to pad time
Loop = True

Problem solved and another good reason to check the simplest things first.

Comments

  • edited December 2014
    Another option, if you want to keep your initial 1 second delay, would be to use two tracks instead of one:
    [TitleObject]
    TrackList = TitleTrack # MusicTrack
    
    [MusicTrack]
    1 = Object.AddSound ^ ThemeMusic
    
    [TitleTrack]
    ...
    
  • edited December 2014
    Actually... yes I do! Thanks, I'll defintely do the second timeline track.
  • edited December 2014
    Timelines, the ORX's foul sorcery =)
  • edited December 2014
    haha! No... me and timelines have a bit of a thing going on these days. :)
  • edited December 2014
    Well, I don't think I can say anything against what a grown up man and a grown up time line do B)

    PS: Sorry for the off topic.
Sign In or Register to comment.