Related products: Video Capture SDK .Net

FM Radio and TV Tuning in Video Capture SDK .Net

1. Get list of available TV Tuners

foreach (string tunerDevice in VideoCapture1.TVTuner_Devices)
{
  cbTVTuner.Items.Add(tunerDevice);
}

2. Get list of available TV formats

foreach (string tunerTVFormat in VideoCapture1.TVTuner_TVFormats())
{
  cbTVSystem.Items.Add(tunerTVFormat);
}

3. Get list of countries

foreach (string tunerCountry in VideoCapture1.TVTuner_Countries)
{
  cbTVCountry.Items.Add(tunerCountry);
}

4. Select TV Tuner

VideoCapture1.TVTuner_Name = cbTVTuner.Text;

5. Read TV Tuner settings

VideoCapture1.TVTuner_Read();

6. Get list of available TV modes

foreach (string tunerMode in VideoCapture1.TVTuner_Modes())
{
  cbTVMode.Items.Add(tunerMode);
}

7. Get current audio and video frequencies

edVideoFreq.Text = Convert.ToString(VideoCapture1.TVTuner_VideoFrequency);
edAudioFreq.Text = Convert.ToString(VideoCapture1.TVTuner_AudioFrequency);

8. Select signal source

cbTVInput.SelectedIndex = cbTVInput.Items.IndexOf(VideoCapture1.TVTuner_InputType);

9. Select work mode

cbTVMode.SelectedIndex = cbTVMode.Items.IndexOf(VideoCapture1.TVTuner_Mode);

10. Select TV system (PAL, NTSC, SECAM, etc.)

cbTVSystem.SelectedIndex = cbTVSystem.Items.IndexOf(VideoCapture1.TVTuner_TVFormat);

11. Select country

cbTVCountry.SelectedIndex = cbTVCountry.Items.IndexOf(VideoCapture1.TVTuner_Country);

12. Write event code

private void VideoCapture1_OnTVTunerTuneChannels(object sender, TVTunerTuneChannelsEventArgs e)
{
  pbChannels.Value = e.Progress;

  if (e.SignalPresent)
  {
    cbTVChannel.Items.Add(e.Channel.ToString());
  }

  if (e.Channel == -1)
  {
    pbChannels.Value = 0;
    MessageBox.Show("AutoTune complete");
  }

  Application.DoEvents();
}

13. Start tune process

const int KHz = 1000;
const int MHz = 1000000; 

VideoCapture1.TVTuner_Read(); 
cbTVChannel.Items.Clear();

// For FM Tuning, you can specify the initial frequencies and the scanning pitch 
if ((cbTVMode.SelectedIndex != -1) && (cbTVMode.Text == "FM Radio")) 
{
  VideoCapture1.TVTuner_FM_Tuning_StartFrequency = 100 * MHz; 
  VideoCapture1.TVTuner_FM_Tuning_StopFrequency = 110 * MHz; 
  VideoCapture1.TVTuner_FM_Tuning_Step = 100 * KHz;
};

VideoCapture1.TVTuner_TuneChannels_Start();

Once each channel is found, the event will be called and the channel will be added to the combobox. Also, you can specify the frequency and number of each channel manually.

14. Set channel by number

VideoCapture1.TVTuner_Channel = Convert.ToInt32(edChannel.Text); 
VideoCapture1.TVTuner_Apply();

15. Set channel by frequency

VideoCapture1.TVTuner_Channel = -1; // must be -1 to use frequency 
VideoCapture1.TVTuner_Frequency = Convert.ToInt32(edChannel.Text); 
VideoCapture1.TVTuner_Apply();

VisioForge © 2006-2020

  • GitHub-Mark-64px
  • Twitter Социальные Иконка
  • VisioForge Facebook page
  • YouTube channel