Programming Example: Looping One Clip Seamlessly into Another with Timecode

This is an interesting programming example of how powerful the Uncompressed Binloop can be in an attraction.

In this script, we have a PreShow (Clip 1) that will loop forever until it is told to seamlessly transition into the main show (Clip 2). Afterwards, it will automatically transition back into the preshow loop. 

We also are generating  SMPTE Timecode so other products can take advantage of, and trigger based on that data. The main show begins at the Timecode 01:00:00.00 mark. Below, I will walk you through what each of the four sequences does.


It is good programming practice to break out subsystems in your script. In this case, there are two "Timeline" sequences, whose purpose is to either play the preshow (Sequence #6) or play the feature show (Sequence #7). Then there are two sequences that have the show control logic built into them (Sequence #2 and #3).

Open the attached script, and check out the details below:

Sequence #6: Timeline_Preshow

The purpose of this sequence is to loop the preshow over and over again forever.

In Sequence #6, we S-Play Clip 1, and after five seconds we re-trigger the sequence. In this example, our preshow is 5 seconds long, thus the re-triggering after 5 seconds.

Sequence #7: Timeline_Feature

The purpose of this sequence is to kill the preshow loop, play the feature show once, and restart the preshow loop.

Sequence #7 is triggered via SMPTE Timecode. A second before the SPlay is triggered to begin the show, we are stopping the Timeline_Preshow loop. Otherwise, the preshow would loop for all eternity.

We're then S-Playing the feature show, and once the show is over, we're re-starting the preshow.

Sequence #2: Show_StartPreshow

The purpose of this sequence is to start the Timeline_Preshow sequence. This sequence is triggered to start initially by a button press input, but then automatically turns on and off by the Timeline_Feature sequence.

First, we need to kill the feature show and SMPTE Timecode. We disarm (reset) the Timeline_Feature sequence to kill it from running, then change the SMPTE Timecode to 00:00:00.00. Finally, we stop the timecode from running.

After those functions have completed, we start the Timeline_Preshow loop.

Sequence #3: Show_StartFeature

The purpose of this sequence is to start the Timeline_Feature Sequence at the exact moment needed to insure a seamless transition from the preshow into the feature show. This sequence is triggered to run via a button press input.

This is where it gets a bit complex. 

First, we have to get the current position of the Timeline_Preshow event. This is so we can calculate how long it will be until the sequence hits it's loop point. We use the Get Seq Time event.

Second, we have to calculate the current position of the preshow media. NOTE: The media is not aligned with the sequence time itself (when the sequence loops, the media does not hit it's loop point at that time). In our example, there is a 2 second difference because of the S-Play delay we are using on the Uncompressed Binloop. Thus, we have to account for that. The If statement in this section does the math to calculate this. Example: If the tcPreshowSequencePosition is a 1.1 seconds, then then tcPreshowMediaPosition is at 4.1 seconds.

Since we found out the current position of the Timeline_Preshow event, and then from that calculated the current position of the media, we can now calculate the media content remaining before the preshow loop point hits again. If it's less than three seconds (which in our example it is: 5 seconds minus 4.1 seconds = .9 seconds) we'll add 5 seconds as .9 seconds is not enough to S-Play or enough time for the SMPTE timecode to pre-roll.

Now the script jumps into action! We know the time left until we can safely transition into the feature show. Thus, we calculate the SMPTE StartPosition, Set SMPTE to that, and start the SMPTE running!

Finally, we arm the Timeline_Feature so it begins reading the SMPTE timecode and triggering events based off of it.

Have more questions? Submit a request