Tutorial: Page (1) of 4 - 11/30/04 Email this story to a friend. email article Print this page (Article printing at MyDmn.com).print page facebook
Scripting in DVD Studio Pro, Series 2 Part 2: Bit-wise operations and binary number conversion By Dave Nagel In Part 1 of our second series on DVD Studio Pro scripting, we began to explore scripting in the context of SPRMs, the registers that hold information about a DVD player's configuration. Specifically we addressed a method for retrieving information from an SPRM and using it in a script. But now we move to the next level to explore the more complex issues of working with bits within SPRMs and performing bit-wise operations to cull specific pieces of information from an SPRM.

Before we get started, if you're a beginner at DVD scripting, I urge you to go back and read our first series on scripting in DVD Studio Pro, dealing with the bare basics of creating commands and working with various operations. You should read at least the first two articles in Series 1 to give yourself a decent foundation in the principles of scripting. And you should definitely take a look at the first article in Series 2 to gain an understanding of how SPRMs are integrated into scripts.

DVD Studio Pro Scripting, Series 1
Part 1: General scripting information
Part 2: Creating an interactive quiz
Part 3: Keeping track of time
Part 4: Pausing and resuming a timer

DVD Studio Pro Scripting, Series 2
Part 1: The basics of working with SPRMs

Bits and bit-wise operations
So you've seen how to retrieve information from an SPRM and how to move it into a GPRM for integration into your scripts. But not all SPRMs are the same. Some of them keep pieces of information in specific bits within the SPRM so that you're not just asking, "Hey, what's up with SPRM 15?" but rather, "Hey, what's up with bits 11 and 14 within SPRM 15?" Except it's not as simple as that.



If you've read the DVD Studio Pro manual, you know that this sort of thing involves bit-wise operations and binary numbers. The manual (ever-so-helpfully) explains that you need to know about binary numbers to use bit-wise operations, but doesn't bother actually to tell you about them. Don't worry; I will.

Sample project using binaries and bit-wise operations
Here's what we're going to do. We're going to take a hypothetical situation where we want to find out about a DVD player's audio configuration. It the player has DTS capabilities, we'll play the DTS track automatically; it the player doesn't have DTS capabilities but does have AC-3 capabilities, we'll set the AC-3 track to play automatically; and if, on the very off chance, it has neither of these capabilities, we'll set it to play our stereo PCM track. (This would not be a good idea for an approach to track selection unless you also give the user a chance to override this script by manually choosing the preferred audio track. Also keep in mind that a user doesn't necessarily have a surround sound setup just because the player is capable of surround sound. So use this sort of thing with discretion.)

The script we'll create for this will be used as a pre-script for our main feature, which itself will have three audio streams: DTS, AC-3 and stereo. (In the image below, the "audio1.cpt" file is the DTS track; remember that DVD Studio Pro only supports DTS in the .cpt format right now.)



Before we get started, if you wish, you can download my completed script by clicking here.

Initial script setup
To determine which stream will be played, we'll need to access SPRM 15, which is the register that contains information about a DVD player's audio capabilities. So, just as in our previous tutorial, we're going to get this information and put it into a GPRM--in this case, GPRM 7, which I've chosen arbitrarily from among the eight available GPRMs.

1. Create a new script (Project > Add to Project > Script).

2. Select the script in the Outline tab.

3. In the Script Editor, select the first command ("Nop").

4. In the Inspector palette, change this command to "Set GPRM." Set the Operation to "mov." Set the Source Type to "SPRM." Set the Source Value to "SPRM 15." And set the target to "GPRM 7."




Page: 1 2 3 4 Next Page


Related Sites: Creative Mac ,   Digital Producer ,   Audio Video Producer ,   Corporate Media News ,   Digital Post Production ,   DVD Creation ,   Presentation Master ,   Oceania ,   MacDVDPro ,   DVD Studio Pro
Related Newsletter: DMN Newsletter ,   Timeline Newsletter ,   Mac Alert Newsletter ,   KNews Newsletter ,   Digital Media Net ,   DVD Viewpoint ,   DMNForums ,   Tutorial Finder

DMO TEXT LINKS
(Click here to place a textlink on this site)

AV-HS450 16+ Input HD/SD Switcher w/ dual screen MultiViewer
This 16+ input switcher is the best value in its class.
Its exclusive dual screen MultiViewer lets you view up to 20 windows on just two displays.
CLICK HERE!!!

HOT THREADS on DMN Forums
Content-type: text/html  Rss  Add to Google Reader or
Homepage    Add to My AOL  Add to Excite MIX  Subscribe in
NewsGator Online 
Real-Time - what users are saying - Right Now!
    • Re: Acid Pro 7 loops question • JohnnyRoy
    • Re: Rendering to .avi files • yigalsela
Content Insider #148 - The iGen
NO...Doesn't have a thing to do with "that" smartphone...or "that" store...or "that" tablet. It's the next generation. Kids and we mean little kids. That's what today's products are being designed for/targeted at. You happen to buy one...fine. Watch a little, little kid pick up a smartphone. He/she just uses it. They've come pre-wired and we're still trying to figure out how to IM. It's the IGen. They want it instantly. They want to use it instantly. They expect their photos, their video, their music, their stuff immediately when/where/how they want it. Read More
eBay Essential Training: Proxy Bidding
In this clip, lynda.com host Mark Abdelnour takes a look at proxy bidding. He discusses the strategy and how it works. He also discusses the maximum bid, and when to use Proxy bidding. Read More
Insider #149 - Game Demographics
The blood, gore, adrenalin challenges that were unveiled at E3 and enjoyed at ComicCon are fun to look at, easy to hold but are they really the games people want to plunk down their credit cards to own or rent time with? Seems as though the investors, the players who control the controllers have a different idea of a "good" game than the kids who develop them. While mobs of people play educational, informational, stimulating games our kid huddles in his room and mumbles "The Few, The Proud, The Gamers." Read More
Social Media #3
Part of a series of articles to plainly explain what organizations need to consider and carry out in today's social media. Read More
@ Copyright, 2010 Digital Media Online, All Rights Reserved