Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QAudioOutput Class Reference
[QtBluetoothModule, QtMediaModule, QtPimModule, QtTelephonyModule]

The QAudioOutput class provides an interface for sending live audio samples to the default audio output device. More...

    #include <QAudioOutput>

Inherits QIODevice.

Public Functions

Protected Functions

Additional Inherited Members


Detailed Description

The QAudioOutput class provides an interface for sending live audio samples to the default audio output device.

The QAudioOutput class provides an interface for sending live audio samples to the default output device. It is intended for use by media streaming applications that can produce a stream of 8-bit unsigned or 16-bit signed audio samples. The sound output will be mixed with audio data from other applications.

The usual sequence for opening the default audio output device is as follows:

    QAudioOutput *audio = new QAudioOutput();
    audio->setFrequency( 11025 );
    audio->setChannels( 1 );
    audio->setBitsPerSample( 8 );
    audio->open( QIODevice::WriteOnly );

See also QAudioInput.


Member Function Documentation

QAudioOutput::QAudioOutput ( QObject * parent = 0 )

Construct a new audio output stream and attach it to parent. The default parameters are 44100 Hz Stereo, with 16-bit samples.

QAudioOutput::QAudioOutput ( const QByteArray & device, QObject * parent = 0 )

Construct a new audio output stream and attach it to parent. The default parameters are 44100 Hz Stereo, with 16-bit samples.

The device parameter is implementation-specific, and might not be honored by all implementations. It is usually an Alsa device name such as plughw:0,0. The string default can be passed for device if the client application wishes to use the default device and is not concerned with what that default device may be called.

QAudioOutput::~QAudioOutput ()

Destroy this audio output stream.

int QAudioOutput::bitsPerSample () const

Returns the number of bits per sample (8 or 16). If the value is 16, the samples must be signed and in host byte order. If bitsPerSample() is 8, the samples must be unsigned.

See also setBitsPerSample().

int QAudioOutput::channels () const

Returns the number of playback channels. The default value is 2.

See also setChannels().

void QAudioOutput::close ()   [virtual]

Closes this audio output stream.

Reimplemented from QIODevice.

int QAudioOutput::frequency () const

Returns the current frequency of audio samples. The default value is 44100.

See also setFrequency().

bool QAudioOutput::isSequential () const   [virtual]

Determines if this QIODevice is sequential. Always returns true.

Reimplemented from QIODevice.

bool QAudioOutput::open ( QIODevice::OpenMode mode )

Opens this audio output stream in mode. Returns true if the audio output stream could be opened; false otherwise.

qint64 QAudioOutput::readData ( char * data, qint64 maxlen )   [virtual protected]

Reads up to maxlen bytes into data. Not used for audio output devices.

Reimplemented from QIODevice.

void QAudioOutput::setBitsPerSample ( int value )

Sets the number of bits per sample to value (8 or 16). Should be called before open(). If the value is 16, the samples must be signed and in host byte order. If bitsPerSample() is 8, the samples must be unsigned.

See also bitsPerSample().

void QAudioOutput::setChannels ( int value )

Sets the number of playback channels to value. Should be called before open().

See also channels().

void QAudioOutput::setFrequency ( int value )

Sets the frequency of audio samples to value. Should be called before open().

See also frequency().

qint64 QAudioOutput::writeData ( const char * data, qint64 len )   [virtual protected]

Writes len bytes from data to the audio output stream.

If bitsPerSample() is 16, the samples must be signed and in host byte order. If bitsPerSample() is 8, the samples must be unsigned.

Reimplemented from QIODevice.


Copyright © 2009 Nokia Trademarks
Qt Extended 4.4.3