QRadioTuner Class▲
-
Header: QRadioTuner
-
qmake: QT += multimedia
-
Inherits: QMediaObject
-
Group: QRadioTuner is part of multimedia, multimedia_radio
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-&
gt;isBandSupported(QRadioTuner::
FM)) {
radio-&
gt;setBand(QRadioTuner::
FM);
radio-&
gt;setFrequency(yourRadioStationFrequency);
radio-&
gt;setVolume(100
);
radio-&
gt;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▲
See also QRadioData, 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▲
[read-only] 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:
-
band() const
-
void setBand( band)
Notifier signal:
-
void bandChanged( band)
See Also▲
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)
[read-only] radioData : QRadioData* const▲
holds an instance of QRadioData
The instance of QRadioData is already bound to this instance of QRadioTuner.
Access functions:
-
*radioData() const
[read-only] 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▲
See also searchForward(), searchBackward(), cancelSearch()
[read-only] 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 strength)
[read-only] state : const State▲
Return the current radio tuner state.
Access functions:
-
state() const
Notifier signal:
-
void stateChanged( state)
See Also▲
See also QRadioTuner::State
[read-only] 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:
-
stereoMode() const
-
void setStereoMode( 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)
Member Function Documentation▲
[explicit] QRadioTuner::QRadioTuner(QObject *parent = nullptr)▲
Constructs a radio tuner based on a media service allocated by the default media service provider.
The parent is passed to QMediaObject.
[virtual] QRadioTuner::~QRadioTuner()▲
Destroys a radio tuner.
[override virtual] QMultimedia::AvailabilityStatus QRadioTuner::availability() const▲
Reimplements: QMediaObject::availability() const.
Returns the availability of the radio tuner.
void QRadioTuner::bandChanged(QRadioTuner::Band band)▲
Signals a radio tuner's band has changed.
Notifier signal for property band.
void QRadioTuner::cancelSearch()▲
QRadioTuner::Error QRadioTuner::error() const▲
void QRadioTuner::error(QRadioTuner::Error error)▲
Signals that an error occurred.
QString QRadioTuner::errorString() const▲
void QRadioTuner::frequencyChanged(int frequency)▲
Signals that the frequency a radio tuner is tuned to has changed.
Notifier signal for property frequency.
QPair<int, int> QRadioTuner::frequencyRange(QRadioTuner::Band band) const▲
Returns a frequency band's minimum and maximum frequency.
int QRadioTuner::frequencyStep(QRadioTuner::Band band) const▲
Returns the number of Hertz to increment the frequency by when stepping through frequencies within a given band.
bool QRadioTuner::isBandSupported(QRadioTuner::Band band) const▲
Identifies if a frequency band is supported by a radio tuner.
Returns true if the band is supported, and false if it is not.
void QRadioTuner::mutedChanged(bool muted)▲
Signals that the muted state of a radio tuner's audio output has changed.
Notifier signal for property muted.
void QRadioTuner::searchAllStations(QRadioTuner::SearchMode searchMode = QRadioTuner::SearchFast)▲
Search all stations in current band
Emits QRadioTuner::stationFound(int, QString) for every found station. After searching is completed, QRadioTuner::searchingChanged(bool) is emitted (false). If searchMode is set to SearchGetStationId, searching waits for station id (PI) on each frequency.
See Also▲
See also searchForward(), searchBackward(), searching
void QRadioTuner::searchBackward()▲
Starts a backwards scan for a signal, starting from the current frequency.
See Also▲
See also searchForward(), cancelSearch(), searching
void QRadioTuner::searchForward()▲
Starts a forward scan for a signal, starting from the current frequency.
See Also▲
See also searchBackward(), cancelSearch(), searching
void QRadioTuner::searchingChanged(bool searching)▲
Signals that the searching state of a radio tuner has changed.
Notifier signal for property searching.
void QRadioTuner::setBand(QRadioTuner::Band band)▲
Sets a radio tuner's frequency band.
Changing the band will reset the frequency to the new band's minimum frequency.
Setter function for property band.
See Also▲
See also band()
void QRadioTuner::setFrequency(int frequency)▲
Sets a radio tuner's frequency.
If the tuner is set to a frequency outside the current band, the band will be changed to one occupied by the new frequency.
Setter function for property frequency.
See Also▲
See also frequency()
void QRadioTuner::signalStrengthChanged(int strength)▲
Signals that the strength of the signal received by a radio tuner has changed.
Notifier signal for property signalStrength.
void QRadioTuner::start()▲
Activate the radio device.
void QRadioTuner::stateChanged(QRadioTuner::State state)▲
This signal is emitted when the state changes to state.
Notifier signal for property state.
void QRadioTuner::stationFound(int frequency, QString stationId)▲
Signals that a station was found in frequency with stationId Program Identification code.
void QRadioTuner::stereoStatusChanged(bool stereo)▲
Signals that the stereo state of a radio tuner has changed.
Notifier signal for property stereo.
void QRadioTuner::stop()▲
Deactivate the radio device.
void QRadioTuner::volumeChanged(int volume)▲
Signals that the volume of a radio tuner's audio output has changed.
Notifier signal for property volume.