Phonon.AudioOutput Class Reference

[ phonon module]

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

继承 AbstractAudioOutput .

方法

Qt Signals


详细描述

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 使用 createPath() . To start playback, you call play() 在 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 AudioOutputDevice s 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 (). 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.


方法文档编制

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

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

创建新的 AudioOutput with the given parent that defines output to a physical 设备。

category can be used by mixer applications to group volume controls of applications into categories. That makes it easier for the user to identify the programs. The category is also used for the default output device that is configured centrally. As an example: often users want to have the audio signal of a VoIP application go to their USB headset while all other sounds should go to the internal soundcard.

另请参阅 Phonon.categoryToString () 和 outputDevice .

AudioOutput.__init__ ( self , QObject   parent  = None)

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

创建新的 AudioOutput that defines output to the system default device with the {Phonon.Category.}{ NoCategory } category

另请参阅 Phonon.categoryToString () 和 outputDevice .

Category AudioOutput.category ( self )

Returns the category of this output.

另请参阅 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 信号。

void outputDeviceChanged (const Phonon::AudioOutputDevice&)

This is the default overload of this signal.

This signal is emitted when the (hardware) device for the output 已改变。 newAudioOutputDevice is the new device.

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

另请参阅 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.

另请参阅 setVolume () 和 volume ().