|Page (1) of 2 - 05/12/05||email article||print page|
Scripting System Streams in DVD Studio Pro, Part 3Switching audio streams on the fly
For this, you'll need to do some scripting. But unlike our previous tutorial (which you can read by clicking here), we won't be using a menu to accomplish this, so you won't be able to connect your script to a menu button. Instead, you'll be connecting it to a button on the user's remote control so that the audio can be switched without the need to stop the movie in progress.
Setting up the project
For this project, you will need to create a track that has multiple audio streams. In my case, that will mean a standard audio stream, plus a special stream that I've created that contains the director's commentary. These will be positioned in the A1 and A2 slots, respectively, in the Track Editor.
Of course, you can do this with more than two audio streams, and the streams you use don't have to be along the lines of a director's commentary. You can use multiple streams for multiple languages, multiple audio formats (surround, stereo) or anything else you can dream up.
Once you've set up your track with your alternate audio streams, you're ready to begin creating the script to enable switching on the fly.
Creating the script
To begin, add a new script to your project by choosing Project > Add to Project > Script. Then double-click the script to select it and activate the Script Editor.
Now, in order for this script to work, we're going to have to do two things. First, we're going to have to determine which audio stream is currently playing; then we're going to have to use this information as the basis for switching to a different stream.
Information about the current audio stream is stored in SPRM 1. So what we're going to do is collect this information and move it into one of our available GPRMs. So in the Script Editor, select the default Nop command. Then, in the Inspector palette, change this Nop command to "Set GPRM." By default, the Operation value will be set to "mov." This is fine. But you need to switch the Source Type to "SPRM" and the Source Value to "SPRM 1." Leave the Target as GPRM 0, unless you're using that GPRM for something else.
Now we need to create separate commands for each one of our audio streams. Essentially what we'll be doing is using a button on the remote to move sequentially through all of the streams availablefor our track. If the viewer is currently listening to audio stream 1, then clicking a button on the remote will switch to audio stream 2. Clicking it again will move back to audio stream 1, or, if you have more than two streams, it will move to stream 3, then stream 4, then stream 5, etc.
So create a new command in your script by clicking t6he little "+" sign in the Script Editor. Switch this command to "Set System Stream." Click the Audio checkbox, and then choose Audio Stream 1 from the pull-down menu on the right.
Then, at the bottom of the Inspector palette, click on the Compare Command checkbox. What we want to do here is ensure that the audio will switch to audio stream 1 only if the current audio track is audio stream 2 (or whatever the last audio stream in your track may be.) In my case, since I have two audio streams, I'll use the following: "Execute if GPRM 0 is = to Immediate with value 1."
Why? Each audio stream has a numeric value starting at 0. So, if audio stream 1 is currently playing, the value in GPRM 0 will be 0. If audio stream 2 is playing, the value in GPRM 0 will be 1. If audio stream 3 is playing, the value in GPRM 0 will be 2.
Related Keywords:apple dvd studio pro, scripting, switching audio, set system stream, audio stream, alternate audio track
To Comment on This Article, Click HERE
Most Recent Reader Comments:
Click Here To Read All Posts
Must be Registered to Respond (Free Registration!!!, CLICK HERE)
Source:Digital Media Online. All Rights Reserved