QRadioTuner

The QRadioTuner class provides an interface to the systems analog radio device. More

Inheritance diagram of PySide2.QtMultimedia.QRadioTuner

Synopsis

Functions

Slots

Signals

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() .

class PySide2.QtMultimedia.QRadioTuner([parent=None])
param parent:

PySide2.QtCore.QObject

Constructs a radio tuner based on a media service allocated by the default media service provider.

The parent is passed to QMediaObject .

PySide2.QtMultimedia.QRadioTuner.State

Enumerates radio tuner states.

Constant

Description

QRadioTuner.ActiveState

The tuner is started and active.

QRadioTuner.StoppedState

The tuner device is stopped.

PySide2.QtMultimedia.QRadioTuner.Band

Enumerates radio frequency bands.

Constant

Description

QRadioTuner.AM

520 to 1610 kHz, 9 or 10kHz channel spacing, extended 1610 to 1710 kHz

QRadioTuner.FM

87.5 to 108.0 MHz, except Japan 76-90 MHz

QRadioTuner.SW

1.711 to 30.0 MHz, divided into 15 bands. 5kHz channel spacing

QRadioTuner.LW

148.5 to 283.5 kHz, 9kHz channel spacing (Europe, Africa, Asia)

QRadioTuner.FM2

range not defined, used when area supports more than one FM range.

PySide2.QtMultimedia.QRadioTuner.Error

Enumerates radio tuner error conditions.

Constant

Description

QRadioTuner.NoError

No errors have occurred.

QRadioTuner.ResourceError

There is no radio service available.

QRadioTuner.OpenError

Unable to open radio device.

QRadioTuner.OutOfRangeError

An attempt to set a frequency or band that is not supported by radio device.

PySide2.QtMultimedia.QRadioTuner.StereoMode

Enumerates radio tuner policy for receiving stereo signals.

Constant

Description

QRadioTuner.ForceStereo

Provide stereo mode, converting if required.

QRadioTuner.ForceMono

Provide mono mode, converting if required.

QRadioTuner.Auto

Uses the stereo mode matching the station.

PySide2.QtMultimedia.QRadioTuner.SearchMode

Enumerates how the radio tuner should search for stations.

Constant

Description

QRadioTuner.SearchFast

Use only signal strength when searching.

QRadioTuner.SearchGetStationId

After finding a strong signal, wait for the RDS station id (PI) before continuing.

PySide2.QtMultimedia.QRadioTuner.antennaConnectedChanged(connectionStatus)
Parameters:

connectionStatus – bool

PySide2.QtMultimedia.QRadioTuner.band()
Return type:

Band

This property holds the frequency band a radio tuner is tuned to..

See also

Band

PySide2.QtMultimedia.QRadioTuner.bandChanged(band)
Parameters:

bandBand

PySide2.QtMultimedia.QRadioTuner.cancelSearch()

Stops scanning for a signal.

See also

searchForward() searchBackward() searching

PySide2.QtMultimedia.QRadioTuner.error()
Return type:

Error

Returns the error state of a radio tuner.

See also

errorString()

PySide2.QtMultimedia.QRadioTuner.error(error)
Parameters:

errorError

PySide2.QtMultimedia.QRadioTuner.errorString()
Return type:

str

Returns a description of a radio tuner’s error state.

See also

error()

PySide2.QtMultimedia.QRadioTuner.frequency()
Return type:

int

This property holds the frequency in Hertz a radio tuner is tuned to..

PySide2.QtMultimedia.QRadioTuner.frequencyChanged(frequency)
Parameters:

frequency – int

PySide2.QtMultimedia.QRadioTuner.frequencyRange(band)
Parameters:

bandBand

Return type:

Returns a frequency band ‘s minimum and maximum frequency.

PySide2.QtMultimedia.QRadioTuner.frequencyStep(band)
Parameters:

bandBand

Return type:

int

Returns the number of Hertz to increment the frequency by when stepping through frequencies within a given band .

PySide2.QtMultimedia.QRadioTuner.isAntennaConnected()
Return type:

bool

This property holds whether there is an antenna connected.

PySide2.QtMultimedia.QRadioTuner.isBandSupported(b)
Parameters:

bBand

Return type:

bool

Identifies if a frequency band is supported by a radio tuner.

Returns true if the band is supported, and false if it is not.

PySide2.QtMultimedia.QRadioTuner.isMuted()
Return type:

bool

This property holds whether a radio tuner’s audio output is muted..

PySide2.QtMultimedia.QRadioTuner.isSearching()
Return type:

bool

This property holds whether a radio tuner is currently scanning for a signal..

PySide2.QtMultimedia.QRadioTuner.isStereo()
Return type:

bool

This property holds whether a radio tuner is receiving a stereo signal..

PySide2.QtMultimedia.QRadioTuner.mutedChanged(muted)
Parameters:

muted – bool

PySide2.QtMultimedia.QRadioTuner.radioData()
Return type:

PySide2.QtMultimedia.QRadioData

This property holds an instance of QRadioData .

The instance of QRadioData is already bound to this instance of QRadioTuner .

PySide2.QtMultimedia.QRadioTuner.searchAllStations([searchMode=QRadioTuner.SearchFast])
Parameters:

searchModeSearchMode

Search all stations in current band

Emits stationFound (int, QString ) for every found station. After searching is completed, searchingChanged (bool) is emitted (false). If searchMode is set to SearchGetStationId , searching waits for station id (PI) on each frequency.

See also

searchForward() searchBackward() searching

PySide2.QtMultimedia.QRadioTuner.searchBackward()

Starts a backwards scan for a signal, starting from the current frequency .

See also

searchForward() cancelSearch() searching

PySide2.QtMultimedia.QRadioTuner.searchForward()

Starts a forward scan for a signal, starting from the current frequency .

See also

searchBackward() cancelSearch() searching

PySide2.QtMultimedia.QRadioTuner.searchingChanged(searching)
Parameters:

searching – bool

PySide2.QtMultimedia.QRadioTuner.setBand(band)
Parameters:

bandBand

This property holds the frequency band a radio tuner is tuned to..

See also

Band

PySide2.QtMultimedia.QRadioTuner.setFrequency(frequency)
Parameters:

frequency – int

This property holds the frequency in Hertz a radio tuner is tuned to..

PySide2.QtMultimedia.QRadioTuner.setMuted(muted)
Parameters:

muted – bool

This property holds whether a radio tuner’s audio output is muted..

PySide2.QtMultimedia.QRadioTuner.setStereoMode(mode)
Parameters:

modeStereoMode

This property holds the stereo mode of a radio tuner..

PySide2.QtMultimedia.QRadioTuner.setVolume(volume)
Parameters:

volume – int

This property holds the volume of a radio tuner’s audio output as a percentage..

PySide2.QtMultimedia.QRadioTuner.signalStrength()
Return type:

int

This property holds the strength of the current radio signal as a percentage..

PySide2.QtMultimedia.QRadioTuner.signalStrengthChanged(signalStrength)
Parameters:

signalStrength – int

PySide2.QtMultimedia.QRadioTuner.start()

Activate the radio device.

PySide2.QtMultimedia.QRadioTuner.state()
Return type:

State

Return the current radio tuner state.

See also

State

PySide2.QtMultimedia.QRadioTuner.stateChanged(state)
Parameters:

stateState

PySide2.QtMultimedia.QRadioTuner.stationFound(frequency, stationId)
Parameters:
  • frequency – int

  • stationId – str

PySide2.QtMultimedia.QRadioTuner.stereoMode()
Return type:

StereoMode

This property holds the stereo mode of a radio tuner..

PySide2.QtMultimedia.QRadioTuner.stereoStatusChanged(stereo)
Parameters:

stereo – bool

PySide2.QtMultimedia.QRadioTuner.stop()

Deactivate the radio device.

PySide2.QtMultimedia.QRadioTuner.volume()
Return type:

int

This property holds the volume of a radio tuner’s audio output as a percentage..

PySide2.QtMultimedia.QRadioTuner.volumeChanged(volume)
Parameters:

volume – int