Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

AudioOutput Class

(Phonon::AudioOutput)

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

 #include <Phonon/AudioOutput>

Inherits: QObject and MediaNode.

This class was introduced in Qt 4.4.

Properties

  • 1 property inherited from QObject

Public Functions

AudioOutput(Phonon::Category category, QObject * parent = 0)
AudioOutput(QObject * parent = 0)
Phonon::Category category() const
bool isMuted() const
QString name() const
AudioOutputDevice outputDevice() const
qreal volume() const
qreal volumeDecibel() const

Public Slots

void setMuted(bool mute)
void setName(const QString & newName)
bool setOutputDevice(const Phonon::AudioOutputDevice & newAudioOutputDevice)
void setVolume(qreal newVolume)
void setVolumeDecibel(qreal newVolumeDecibel)
  • 1 public slot inherited from QObject

Signals

void mutedChanged(bool muted)
void outputDeviceChanged(const Phonon::AudioOutputDevice & newAudioOutputDevice)
void volumeChanged(qreal newVolume)

Additional Inherited Members

  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

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.

See also Phonon::VolumeSlider, Music Player Example, BackendCapabilities, and Phonon Module.

Property Documentation

muted : bool

This property tells whether the output is muted.

Muting the output has the same effect as calling setVolume(0.0).

Access functions:

bool isMuted() const
void setMuted(bool mute)

Notifier signal:

void mutedChanged(bool muted)

name : QString

This is the name that appears in Mixer applications that control the volume of this output.

Access functions:

QString name() const
void setName(const QString & newName)

outputDevice : AudioOutputDevice

This property holds the (hardware) destination for the output.

The default device is determined by the Category and the global configuration for that category. Normally you don't need to override this setting - letting the user change the global configuration is the right choice. You can still override the device though, if you have good reasons to do so.

Access functions:

AudioOutputDevice outputDevice() const
bool setOutputDevice(const Phonon::AudioOutputDevice & newAudioOutputDevice)

See also outputDeviceChanged().

volume : qreal

This is the current loudness of the output.

(it is using Stevens' law to calculate the change in voltage internally).

Access functions:

qreal volume() const
void setVolume(qreal newVolume)

Notifier signal:

void volumeChanged(qreal newVolume)

See also volumeDecibel.

volumeDecibel : qreal

This is the current volume of the output in decibel.

0 dB means no change in volume, -6dB means an attenuation of the voltage to 50% and an attenuation of the power to 25%, -inf dB means silence.

Access functions:

qreal volumeDecibel() const
void setVolumeDecibel(qreal newVolumeDecibel)

See also volume.

Member Function Documentation

AudioOutput::AudioOutput(Phonon::Category category, QObject * parent = 0)

Creates a new AudioOutput with the given parent that defines output to a physical device.

The 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.

See also Phonon::categoryToString() and outputDevice.

AudioOutput::AudioOutput(QObject * parent = 0)

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

See also Phonon::categoryToString() and outputDevice.

Phonon::Category AudioOutput::category() const

Returns the category of this output.

See also Phonon::AudioOutput::AudioOutput().

void AudioOutput::outputDeviceChanged(const Phonon::AudioOutputDevice & newAudioOutputDevice) [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.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web