The tuner API enables you to set or modify band settings to provide access to public or custom radio bands. It provides a unified interface for applications to access and control tuner resources. With the tuner API, you can control public and custom bands, enumerate tuners, query the attributes of tuners, and change tuner settings.
The following table shows tuner API functions.
Function |
Description |
TunerQuery | Identifies the tuner devices registered in the system |
TunerGetDevCaps | Determines the capabilities of a specific tuner, including the bands supported |
TunerGetBandInfo | Determines the size and identification of the current band |
TunerOpen | Gets a handle to a tuner resource |
TunerGetConfig TunerSetConfig | Gets or modifies the current tuner settings |
TunerGetSignalInfo | Obtains signal information, such as whether or not a stereo signal is present, whether or not the frequency setting is valid, and signal strength |
TunerClose | Releases the device resource |
The following code example shows how to initialize and set up a tuner.
// Get the tuner device capabilities. The application is using
// tuner device 1.
if(!TunerGetDevCaps(1, &CapTuner))
{
return FALSE;
}
// Be sure that the tuner supports both AM and FM.
if((CapTuner.dwTunerCaps&(BAND_AM|BAND_FM)) != (BAND_AM|BAND_FM))
{
return FALSE;
}
// Open the tuner. The application is using tuner device 1.
m_hTuner = TunerOpen(1);
if(m_hTuner == INVALID_HANDLE_VALUE) return E_FAIL; //No tuner
hr = SetBand(m_dwCurrentBand);
if(FAILED(hr)) return E_FAIL;
return NOERROR;
}