Microsoft DirectX 8.1 (C++)

Creating New Tune Requests

This topic applies to Windows XP Home Edition and Windows XP Professional only.

In some application scenarios or for testing, it may be preferable to create a tune request programmatically, instead of retrieving one from the Guide Store. The disadvantage to this approach is that it sacrifices network-type independence. When you obtain a tune request from the Guide Store, all the details concerning the network type are transparent to the application. When you create a new tune request, on the other hand, you must target a particular network type.

The following code illustrates how to create a tune request for a program on an ATSC network:

Dim objTuner
Dim objTSContainer
Dim objTuningSpace
Dim objTuneRequest
Dim objLocator

Set objTSContainer = CreateObject("BDATuner.SystemTuningSpaces")
Set objTuningSpace = objTSContainer("ATSC")
Set objTuneRequest = objTuningSpace.CreateTuneRequest
Set objLocator = CreateObject("BDATuner.ATSCLocator")
objLocator.PhysicalChannel = 46
objTuneRequest.Locator = objLocator
objTuneRequest.Channel = -1
objTuneRequest.MinorChannel = -1
MSVidCtl.View objTuneRequest
MSVidCtl.Run

The next example shows how to create a tune request to view a program on an analog TV network:

Dim objTuner
Dim objTSContainer
Dim objTuningSpace
Dim objTuneRequest

Set objTSContainer = CreateObject("BDATuner.SystemTuningSpaces")
Set objTuningSpace = objTSContainer("Cable")
Set objTuneRequest = objTuningSpace.CreateTuneRequest
objTuneRequest.Channel = 5
MSVidCtl.View objTuneRequest
MSVidCtl.Run

Note that to tune to a program on an ATSC network type, you must change the PhysicalChannel property on the ILocator object. On ATSC networks, the tune request's Channel property is just the channel number the broadcaster is advertising for the sake of end users. Usually it maps to the analog channel number the broadcaster has historically been associated with. A broadcaster may transmit up to three separate programs simultaneously on ATSC; the MinorChannel property may have a value of 1 through 3. For the Channel property, a value of -1 instructs the Video Control to use the default value provided in the broadcast stream. For the MinorChannel property, a value of -1 instructs the Video Control to tune to the first minor channel on which a signal is present.