Imports Leadtools
Imports Leadtools.Multimedia
Imports LeadtoolsMultimediaExamples.Fixtures
Public _result AsBoolean = FalsePublic _form As CaptureCtrlForm = New CaptureCtrlForm()
PublicSub AutoTuneExample()
' reference the capture control
Dim capturectrl As CaptureCtrl = _form.CaptureCtrl
Try' try set the analog video capture device, use your device name here
IfNot capturectrl.VideoDevices("Analog") IsNothingThen
capturectrl.VideoDevices("Analog").Selected = TrueEndIf' reference the TV tuner interface
Dim tvtuner As TVTuner = capturectrl.TVTuner
' Check if TV tuner is valid
IfNot tvtuner IsNothingThen' get the min and max channel info
Dim minChan AsInteger = tvtuner.ChannelMin
Dim maxChan AsInteger = tvtuner.ChannelMax
' select a channel between min and max to auto tune, do this for as many channels as desired
Dim tuneChan AsInteger = 25
Dim ok AsInteger = tvtuner.AutoTune(tuneChan)
' if we auto-tuned successfully, store the info
If ok <> 0 Then' store the auto tune information
tvtuner.StoreAutoTune()
' set the result to what we expect
_result = TrueEndIfEndIfCatch e1 As Exception
_result = FalseEndTryEnd Sub
using Leadtools;
using Leadtools.Multimedia;
using LeadtoolsMultimediaExamples.Fixtures;
publicbool _result = false;
public CaptureCtrlForm _form = new CaptureCtrlForm();
publicvoid AutoTuneExample()
{
// reference the capture control
CaptureCtrl capturectrl = _form.CaptureCtrl;
try
{
// try set the analog video capture device, use your device name here
if (capturectrl.VideoDevices["Analog"] != null)
capturectrl.VideoDevices["Analog"].Selected = true;
// reference the TV tuner interface
TVTuner tvtuner = capturectrl.TVTuner;
// check whether there is a valid TV tuner
if (tvtuner != null)
{
// get the min and max channel info
int minChan = tvtuner.ChannelMin;
int maxChan = tvtuner.ChannelMax;
// select a channel between min and max to auto tune, do this for as many channels as desired
int tuneChan = 25;
int ok = tvtuner.AutoTune(tuneChan);
// if we auto-tuned successfully, store the info
if (ok != 0)
{
// store the auto tune information
tvtuner.StoreAutoTune();
// set the result to what we expect
_result = true;
}
}
}
catch (Exception)
{
_result = false;
}
}