|  | Home · All Classes · Modules

# Phonon.AudioOutput Class Reference
[phonon module]

The AudioOutput class is used to send data to audio output devices. More...

Inherits AbstractAudioOutput.

### Methods

- __init__ (self, Category category, QObject parent = None)
- __init__ (self, QObject parent = None)
- Category category (self)
- bool isMuted (self)
- QString name (self)
- AudioOutputDevice outputDevice (self)
- setMuted (self, bool mute)
- setName (self, QString newName)
- bool setOutputDevice (self, AudioOutputDevice newAudioOutputDevice)
- setVolume (self, float newVolume)
- setVolumeDecibel (self, float newVolumeDecibel)
- float volume (self)
- float volumeDecibel (self)

### Qt Signals

- void mutedChanged (bool)
- void outputDeviceChanged (const Phonon::AudioOutputDevice&)
- void volumeChanged (qreal)

## Detailed Description

The AudioOutput class is used to send data to audio output devices.

The AudioOutput class plays sound over a sound device. The audio output needs to be connected to a MediaObject using createPath(). To start playback, you call play() on the media object.

         Phonon.MediaObject *mediaObject = new Phonon.MediaObject(this);
         mediaObject->setCurrentSource(Phonon.MediaSource("/mymusic/barbiegirl.wav"));
         Phonon.AudioOutput *audioOutput =
             new Phonon.AudioOutput(Phonon.MusicCategory, this);
         Phonon.Path path = Phonon.createPath(mediaObject, audioOutput);

The class supports changing the volume(). It is also possible to mute the sound.

To find out what AudioOutputDevices are available for AudioOutput, you can call BackendCapabilities.availableAudioOutputDevices(). A default device is selected by the backend, but it is possible to set the device to be used with setOutputDevice(). The outputDeviceChanged() signal will be emitted if the device changes.

If an error occurs with the playback, for instance, if no valid output device is found, the media object will receive a stateChanged() signal with the ErrorState.

Note that the default values of properties are dependent on the backend.

## Method Documentation

### AudioOutput.__init__ (self, Category category, QObject parent = None)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

### AudioOutput.__init__ (self, QObject parent = None)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

Creates a new AudioOutput that defines output to the system default device with the {Phonon.Category.}{NoCategory} category

See also Phonon.categoryToString() and outputDevice.

### Category AudioOutput.category (self)

Returns the category of this output.

See also Phonon.AudioOutput.AudioOutput().

### bool AudioOutput.isMuted (self)

### QString AudioOutput.name (self)

### AudioOutputDevice AudioOutput.outputDevice (self)

### AudioOutput.setMuted (self, bool mute)

This method is also a Qt slot with the C++ signature `void setMuted(bool)`.

### AudioOutput.setName (self, QString newName)

This method is also a Qt slot with the C++ signature `void setName(const QString&)`.

### bool AudioOutput.setOutputDevice (self, AudioOutputDevice newAudioOutputDevice)

This method is also a Qt slot with the C++ signature `bool setOutputDevice(const Phonon::AudioOutputDevice&)`.

### AudioOutput.setVolume (self, float newVolume)

This method is also a Qt slot with the C++ signature `void setVolume(qreal)`.

### AudioOutput.setVolumeDecibel (self, float newVolumeDecibel)

This method is also a Qt slot with the C++ signature `void setVolumeDecibel(qreal)`.

### float AudioOutput.volume (self)

### float AudioOutput.volumeDecibel (self)

## Qt Signal Documentation

### void mutedChanged (bool)

This is the default overload of this signal.

This signal is emitted when the muted property has changed. The muted value passed by the signal indicates the state of the muted property. As this property can change by IPC (DBus) calls a UI element showing the muted property should listen to this signal.

### void outputDeviceChanged (const Phonon::AudioOutputDevice&)

This is the default overload of this signal.

This signal is emitted when the (hardware) device for the output has changed. newAudioOutputDevice is the new device.

The change can happen either through setOutputDevice or if the global configuration for the used category has changed.

See also outputDevice.

### void volumeChanged (qreal)

This is the default overload of this signal.

This signal is emitted whenever the volume has changed. As the volume can change without a call to setVolume (calls over dbus) this is important to keep a widget showing the current volume up to date.

newVolume is the new volume level.

See also setVolume() and volume().