QRadioTuner Class
The QRadioTuner class provides an interface to the systems analog radio device. More...
| Header: | #include <QRadioTuner> |
| qmake: | QT += multimedia |
| Inherits: | QMediaObject |
This class is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Public Types
| enum | Band { AM, FM, SW, LW, FM2 } |
| enum | Error { NoError, ResourceError, OpenError, OutOfRangeError } |
| enum | SearchMode { SearchFast, SearchGetStationId } |
| enum | State { ActiveState, StoppedState } |
| enum | StereoMode { ForceStereo, ForceMono, Auto } |
Properties
|
Public Functions
| QRadioTuner::Band | band() const |
| int | frequency() const |
| bool | isAntennaConnected() const |
| bool | isMuted() const |
| bool | isSearching() const |
| bool | isStereo() const |
| QRadioData * | radioData() const |
| void | setStereoMode(QRadioTuner::StereoMode mode) |
| int | signalStrength() const |
| QRadioTuner::State | state() const |
| QRadioTuner::StereoMode | stereoMode() const |
| int | volume() const |
Public Slots
| void | setBand(QRadioTuner::Band band) |
| void | setFrequency(int frequency) |
| void | setMuted(bool muted) |
| void | setVolume(int volume) |
Signals
| void | antennaConnectedChanged(bool connectionStatus) |
| void | bandChanged(QRadioTuner::Band band) |
| void | frequencyChanged(int frequency) |
| void | mutedChanged(bool muted) |
| void | searchingChanged(bool searching) |
| void | signalStrengthChanged(int signalStrength) |
| void | stateChanged(QRadioTuner::State state) |
| void | stereoStatusChanged(bool stereo) |
| void | volumeChanged(int volume) |
Detailed Description
You can control the systems analog radio device using this interface, for example:
radio = new QRadioTuner; connect(radio, SIGNAL(frequencyChanged(int)), this, SLOT(freqChanged(int))); if (radio->isBandSupported(QRadioTuner::FM)) { radio->setBand(QRadioTuner::FM); radio->setFrequency(yourRadioStationFrequency); radio->setVolume(100); radio->start(); }
The radio object will emit signals for any changes in state such as: bandChanged(), frequencyChanged(), stereoStatusChanged(), searchingChanged(), signalStrengthChanged(), volumeChanged(), mutedChanged().
You can change between the frequency bands using setBand() however it is recommended that you check to make sure the band is available first using isBandSupported().
See also QRadioData and Radio Overview.
Member Type Documentation
enum QRadioTuner::Band
Enumerates radio frequency bands.
| Constant | Value | Description |
|---|---|---|
QRadioTuner::AM | 0 | 520 to 1610 kHz, 9 or 10kHz channel spacing, extended 1610 to 1710 kHz |
QRadioTuner::FM | 1 | 87.5 to 108.0 MHz, except Japan 76-90 MHz |
QRadioTuner::SW | 2 | 1.711 to 30.0 MHz, divided into 15 bands. 5kHz channel spacing |
QRadioTuner::LW | 3 | 148.5 to 283.5 kHz, 9kHz channel spacing (Europe, Africa, Asia) |
QRadioTuner::FM2 | 4 | range not defined, used when area supports more than one FM range. |
enum QRadioTuner::Error
Enumerates radio tuner error conditions.
| Constant | Value | Description |
|---|---|---|
QRadioTuner::NoError | 0 | No errors have occurred. |
QRadioTuner::ResourceError | 1 | There is no radio service available. |
QRadioTuner::OpenError | 2 | Unable to open radio device. |
QRadioTuner::OutOfRangeError | 3 | An attempt to set a frequency or band that is not supported by radio device. |
enum QRadioTuner::SearchMode
Enumerates how the radio tuner should search for stations.
| Constant | Value | Description |
|---|---|---|
QRadioTuner::SearchFast | 0 | Use only signal strength when searching. |
QRadioTuner::SearchGetStationId | 1 | After finding a strong signal, wait for the RDS station id (PI) before continuing. |
enum QRadioTuner::State
Enumerates radio tuner states.
| Constant | Value | Description |
|---|---|---|
QRadioTuner::ActiveState | 0 | The tuner is started and active. |
QRadioTuner::StoppedState | 1 | The tuner device is stopped. |
enum QRadioTuner::StereoMode
Enumerates radio tuner policy for receiving stereo signals.
| Constant | Value | Description |
|---|---|---|
QRadioTuner::ForceStereo | 0 | Provide stereo mode, converting if required. |
QRadioTuner::ForceMono | 1 | Provide mono mode, converting if required. |
QRadioTuner::Auto | 2 | Uses the stereo mode matching the station. |
Property Documentation
antennaConnected : const bool
This property holds whether there is an antenna connected
Access functions:
| bool | isAntennaConnected() const |
Notifier signal:
| void | antennaConnectedChanged(bool connectionStatus) |
band : Band
This property holds the frequency band a radio tuner is tuned to.
Access functions:
| QRadioTuner::Band | band() const |
| void | setBand(QRadioTuner::Band band) |
Notifier signal:
| void | bandChanged(QRadioTuner::Band band) |
See also QRadioTuner::Band.
frequency : int
This property holds the frequency in Hertz a radio tuner is tuned to.
Access functions:
| int | frequency() const |
| void | setFrequency(int frequency) |
Notifier signal:
| void | frequencyChanged(int frequency) |
muted : bool
This property holds whether a radio tuner's audio output is muted.
Access functions:
| bool | isMuted() const |
| void | setMuted(bool muted) |
Notifier signal:
| void | mutedChanged(bool muted) |
radioData : QRadioData* const
holds an instance of QRadioData
The instance of QRadioData is already bound to this instance of QRadioTuner.
Access functions:
| QRadioData * | radioData() const |
searching : const bool
This property holds whether a radio tuner is currently scanning for a signal.
Access functions:
| bool | isSearching() const |
Notifier signal:
| void | searchingChanged(bool searching) |
See also searchForward(), searchBackward(), and cancelSearch().
signalStrength : const int
This property holds the strength of the current radio signal as a percentage.
Access functions:
| int | signalStrength() const |
Notifier signal:
| void | signalStrengthChanged(int signalStrength) |
state : const State
Return the current radio tuner state.
Access functions:
| QRadioTuner::State | state() const |
Notifier signal:
| void | stateChanged(QRadioTuner::State state) |
See also QRadioTuner::State.
stereo : const bool
This property holds whether a radio tuner is receiving a stereo signal.
Access functions:
| bool | isStereo() const |
Notifier signal:
| void | stereoStatusChanged(bool stereo) |
stereoMode : StereoMode
This property holds the stereo mode of a radio tuner.
Access functions:
| QRadioTuner::StereoMode | stereoMode() const |
| void | setStereoMode(QRadioTuner::StereoMode mode) |
volume : int
This property holds the volume of a radio tuner's audio output as a percentage.
Access functions:
| int | volume() const |
| void | setVolume(int volume) |
Notifier signal:
| void | volumeChanged(int volume) |