|
Classified ads
|
Class for playback of audio stream, via speaker or other audio dev. More...
#include <audioplayer.h>


Public Slots | |
| void | insertAudioFrame (const QByteArray &aFrame) |
| void | finishedPlaying (QAudio::State aState) |
| void | notify () |
Signals | |
| void | error (int aError, const QString &aExplanation) |
| void | audioMaxLevel (float aMaxVolume) |
Public Member Functions | |
| AudioPlayer (Model &aModel, int aFrequency=8000, int aNumChannels=1, int aSampleSize=16) | |
| ~AudioPlayer () | |
| void | stop () |
| virtual qint64 | bytesAvailable () const |
Protected Member Functions | |
| virtual qint64 | writeData (const char *data, qint64 maxSize) |
| virtual qint64 | readData (char *data, qint64 maxSize) |
| virtual bool | open (OpenMode mode) |
| virtual bool | isSequential () const |
Private Attributes | |
| QAudioFormat | iFormat |
| QAudioOutput * | iAudioOutput |
| QByteArray | iAudioBuffer |
| bool | iNeedsToRun |
| Model & | iModel |
| const int | iFrequency |
| const int | iNumChannels |
| const int | iSampleSize |
Class for playback of audio stream, via speaker or other audio dev.
This class encapsulates audio output device and expects input as array of floats.
| AudioPlayer::AudioPlayer | ( | Model & | aModel, |
| int | aFrequency = 8000, |
||
| int | aNumChannels = 1, |
||
| int | aSampleSize = 16 |
||
| ) |
Constructor. Currently only samplesize 16 is supported, all other sizes will output only noise. Also see input data format at insertAudioFrame method.
| aFrequency | is number of samples per second |
| aNumChannels | is number of channels in stream |
| aSampleSize | is number of bits in each sample. As currently the audio format is in array of floats that are anyway in native format and in [-1,1] range this parameter is a little bit meaningless. |
| AudioPlayer::~AudioPlayer | ( | ) |
|
signal |
signals that communicates max value of a outputted frame
|
inlinevirtual |
|
signal |
this is not method but signal ; if in error, get emit()ted
|
slot |
Notify slot from actual player device
|
slot |
Method/slot for playing back snippet of audio.
| aFrame | 32-bit, native-encoding, floating point format audio/pcm data in 8kHz. Floating point range in [-1,1]. |
|
inlineprotectedvirtual |
|
slot |
notify from audio output device
|
protectedvirtual |
method for opening QIODevice: sets the open mode that's about it.
|
protectedvirtual |
From QIODevice: method that QAudioOutput class instance will use to read the actual audio data. Data comes from internal buffer and is inserted into buffer using insertAudioFrame.
| data | pointer to buffer where data will be written |
| maxSize | max data size available in buffer |
| void AudioPlayer::stop | ( | ) |
method for stopping playback
|
protectedvirtual |
Write-method of QIODevice - QIODevice here is used for feeding the player and data is actually written using insertAudioFrame method so implementation of this method is actually empty.
| data | that will not be written anywhere. |
| maxSize | max data size to be not written |
|
private |
first buffered here, then written in chunks
|
private |
|
private |
|
private |
datamodel
|
private |
|
private |
|
private |
|
private |
1.8.11