Menu window - Create Button Links - Special Links (Advanced)

There are few special functions that can be used as Menu Button Links

Special Links Commands
DVD-lab PRO has a special set of commands that can be called from the button


Set Audio - Directly Select which audio track will be played when you play the movie.
Set Subtitle - Directly Select which (if any) subtitle will be visible when you play the movie.

Set Audio/Subtitle will be combined with one of the following command:

+ Restart Menu - (Default) When user click on the Subtitle or Audio button on menu the Subtitle/Audio stream will be set and Menu (if motion or sound) will start playing from beginning. This is to prevent compatibility problems with some players.
+ Go To Next Menu - When user click on the Subtitle or Audio button on menu the Subtitle/Audio stream will be set and Next menu will play.
+ Go To Prev Menu - When user click on the Subtitle or Audio button on menu the Subtitle/Audio stream will be set and Previous menu will play..
+ Go To First Menu - When user click on the Subtitle or Audio button on menu the Subtitle/Audio stream will be set and First menu (a ROOT menu) will play.

The "+" commands can be used various way. When user click the button to select Audio or Subtitle, it can immediately return to parent (previous, ROOT) menu, next menu to set other settings or even play movie.

Note: Setting Audio or Subtitle Directly from button may not always work correctly on all DVD players. For greater compatibility accross many different players and for greater flexibility you should consider creating your own Audio/Subtitle Manager that uses Set GPRM and Link command. See more about this later.

Important: You can use this only from a VTS Menu.

Audio/Subtitle (Direct Setting) Examples

Note: We used big red text on menus to be visible in this manual. Normally using red text is a very bad choice. (Red can be good for highlighting)

Example 1: After User select Audio 1 or Audio 2, the movie will start playing right away.

This is done by setting each of the two buttons to select Audio Stream 1 and Audio Stream 2 and set the "+" command to "+ Go To Next Menu". Then we have to create the next menu - in our case we added VM Command object (Connections - Add - Add Command Object - In VTS Domain) that is placed in VTS Menu domain (so our Next menu will be the VM Command object). Then we link the VM Command to the Movie.

Example 2: We have Main Menu with buttons to Play movie and Setup Audio. Clicking Setup will get us to next movie where the current audio is highlighted. Changing the audio will get us back to main menu.

The basic is done simple way. The Audio Setup menu has 3 buttons for Audio 1, 2 and 3. Each links to Audio Stream 1,2 or 3, The "+" command is set as "+ Go To Prev Menu". So far so good.
Now how does the Audio Setup menu knows which button to highlight according to the current audio selection? For this trick we have to use VM Commands. This will be explained much later but as a preview here is the Custom VM Command in menu PRE Sequence:

GPRM0 = SPRM1
GPRM1 = 1024
if (GPRM0 == 1) GPRM1 = 2048
if (GPRM0 == 2) GPRM1 = 3072
SetHL_BTN GPRM1
Break
GPRM0 is set to the status of current Audio (SPRM1) 0,1,2...7
GPRM1 is set to 1024 for first audio. 1024 is first button (buttons are set as multiple of 1024)
if the current audio is 1 (second audio) then set the second button to be selected
if the current audio is 2 (third audio) then the third button is set
Now highlight the button according to the value in GPRM1
Do not execute any other commands below (they will change the highlighting)

Modify the code to highlight the buttons according to the Subtitle.
Instead of SPRM1 use SPRM2, but we have to change values as well. The SPRM2 if Subtitle1 is ON is 64, Subtitle 2 On is 65 etc...

GPRM0 = SPRM2
GPRM1 = 1024
if (GPRM0 == 64) GPRM1 = 2048
if (GPRM0 == 65) GPRM1 = 3072
if (GPRM0 == 66) GPRM1 = 4096
SetHL_BTN GPRM1
Break

Other Commands

Resume Movie - resume the movie from the last position. Works, for example, if you interrupt movie with menu button.

Set GPRM and Link
A
llows setting one of GPRM parameter to a custom value and then link to another menu or return to the same menu.

The DVD specs allows linking only within the domain - that means:

By default The Link To will be set to the same menu where we are editing the button. This will restart the menu (play music/motion from beginning). It is necessary to avoid some players lockup.

This function enables you to create a special button functionality that normally is not possible. For example you can create the full Audio/Subtitle or Language Manager. It really depends on the author what he can do and what functionality he needs.

Audio/Subtitle Manager Example

We mentioned previously that for greater player compatibility and flexibility we should create our own Audio/Subtitle manager. The task is not that dificult and we will reuse code mentioned previously.

A goal of this simple manager is to have two menus called from main menu, one for setting audio and other for setting subtitles. Each menu should by default select button that represent the current audio/subtitles regardless if it is selected with remote or on screen. Then when user select Audio or subtitle it should return back to the main menu from where user can press Play. The selection should be remembered even when a movie ends.

Important: You can use SetSTN commands only from within VTS domain. Therefore we can do our special menus as VTS, not VMG!

This is our simple Audio/Subtitle Manager project. We have Movie that has 3 Audio Tracks and 3 Subtitle Tracks. VTS ROOT Menu has link to Play movie or to set Audio or Subtitle. We need two additional menus for Audio and Subtitle selection and two VM Command objects in the VTS Domain (Menu: Connections - Add - Add Command Object - In VTS Domain)

Audio Setup menu has 3 buttons for selecting the audio. The Menu has a PRE command that is similar to one we had previously to highlight the currently selected audio stream.

Audio Setup PRE Command - highlight button according to the current selected Audio
GPRM0 = SPRM1
GPRM1 = 1024
if (GPRM0 == 1) GPRM1 = 2048
if (GPRM0 == 2) GPRM1 = 3072
SetHL_BTN GPRM1
Break

Instead of directly setting Audio stream on buttons we will use Set GPRM and Link command.

Let's say GPRM2 will be used to hold the new desired audio. So each button will set GPRM2 to different value (0,1,2) and then link to a VTS VM Command object "Audio Command"

Each button after setting GPRM2 links to Audio Command VM Object. This object has just one command that finally select the audio according to the GPRM2 parameter.

Audio Command VM Object
SetSTN (audio=GPRM2 )

The Audio Command VM Object links back to our main menu Menu 1.

Second menu is Subtitle Setup menu to choose a subtitle. Same as above, but with modified PRE commands for highlighting the current subtitle.

Subtitle Setup PRE Command - highlight button according to the current selected Subtitle
GPRM0 = SPRM2
GPRM1 = 1024
if (GPRM0 == 64) GPRM1 = 2048
if (GPRM0 == 65) GPRM1 = 3072
if (GPRM0 == 66) GPRM1 = 4096
SetHL_BTN GPRM1
Break

We will use GPRM3 to hold the new desired subtitle stream - we will use the same coding that DVD expects.
0 for selecting first subtitle stream and setting it OFF,
64 for selecting the same first subtitle stream but setting it ON,
65 for second subtitle ON
66 for third subtitle ON.

All buttons will link to "Sub Command" VM Object.

The "Sub Command" VM Object object has just one command that finally select the subtitle according to the GPRM3 parameter.

Sub Command VM Object
SetSTN (subp=GPRM3:off )

Again the Sub Command object links back to main Menu.

We are done with our simple Audio/Subtitle manager. This is of course just one way which may be modified to fit the project. We can, for example, modify it for Language Manager, that will select both Audio and subtitle according the Language preferences or we can create much more complex manager that involves "switched" menus where we can put Audio and Subtitle on the same page with a "selector" pointing at both current Audio and current Subtitle.

One other example of more complex Audio/ Subtitle Manager that uses different approach is here:

This would involve a multiple menu trick, that means we would need one menu for each combination (total 6 menus).
Tip: You start by making one menu complete and then use Menu - Add - Add Duplicate, then change the differences.

You need to fit this with commands. Here you don't necessarily need to use a VM Command object as above because each menu can be used to set the Audio and Subtitle in its PRE command (because simply each menu defines exactly the correct combination). That means we don't need to use buttons with Set GPRM either, or any other trick but simply link each button on each menu to the menu that corresponds to the new combination. A  lot of criss-cross linking!
From the Main menu we need to call this group of menus through one VTS VM Object that would be used to choose the correct menu according to the currently selected Audio and Subtitle combination... a case of employing some simple maths! Ok, a bit more help, we solved this Selection task using this code snippet:

GPRM0 = SPRM1
GPRM1 = SPRM2
GPRM0 *= 100
GPRM0 += GPRM1
if (GPRM0 == 64) LinkPGCN 4
if (GPRM0 == 65) LinkPGCN 5
if (GPRM0 == 100) LinkPGCN 6
if (GPRM0 == 164) LinkPGCN 7
if (GPRM0 == 165) LinkPGCN 8
LinkPGCN 3

but let's stop there. The rest is a good exercise for you to complete.

Other Special Link Commands

Link to Menu Cell - A special VM Command helper that sets the VM Command so the Menu (motion menu with delayed buttons) will jump to next cell.
VM Command - Type a single line of VM command directly to a button. See more info about VM here. (Buttons can have only single line VM command as per the DVD specs)