Classified ads
Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
AudioSource Class Reference

opposite of audiosink. More...

#include <audiosource.h>

Inheritance diagram for AudioSource:
Inheritance graph
[legend]
Collaboration diagram for AudioSource:
Collaboration graph
[legend]

Public Slots

void processCapturedAudio ()
 
void inputStatusChanged (QAudio::State aState)
 

Signals

void frameCaptured (const QByteArray &aFrame, quint32 aSeqNo)
 
void audioMaxLevel (float aMaxVolume)
 

Public Member Functions

 AudioSource (Model &aModel)
 
 ~AudioSource ()
 
quint32 getCurrentSeqNo () const
 
void stopCapturing ()
 

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
 
void timerEvent (QTimerEvent *event)
 

Private Attributes

QAudioFormat iFormat
 
QAudioInput * iAudioInput
 
QByteArray iAudioBuffer
 
quint32 iSeqNo
 
bool iNeedsToRun
 
ModeliModel
 
int iTimerId
 

Detailed Description

opposite of audiosink.

Class for capturing audio. This class provides 16-bit PCM digital audio in 8kHz sample rate in pieces of 480 samples, each exactly 60ms long. Output format is in floating point numbers in range [0,1].

Constructor & Destructor Documentation

AudioSource::AudioSource ( Model aModel)

Constructor.

AudioSource::~AudioSource ( )

Member Function Documentation

void AudioSource::audioMaxLevel ( float  aMaxVolume)
signal

This is actually average audio volume, in range [0,1]

void AudioSource::frameCaptured ( const QByteArray &  aFrame,
quint32  aSeqNo 
)
signal

Emitted when complete audio frame is ready to be processed

Parameters
aFrameis the audio data. Content of the byte array is floats in range [-1,1]
aSeqNosequence number of the captured frame, it will sequentially increase as time passes
quint32 AudioSource::getCurrentSeqNo ( ) const
inline

getter-method for next sequence number

void AudioSource::inputStatusChanged ( QAudio::State  aState)
slot

Input status changed

virtual bool AudioSource::isSequential ( ) const
inlineprotectedvirtual
virtual bool AudioSource::open ( OpenMode  mode)
protectedvirtual

method for opening QIODevice: sets the open mode that's about it.

void AudioSource::processCapturedAudio ( )
slot

Method called by timer every now and then that does processing of captured data

virtual qint64 AudioSource::readData ( char *  data,
qint64  maxSize 
)
protectedvirtual

From QIODevice: in current implementation this method does nothing, audio is processed internally and this QIODevice implementation does not allow reading.

Returns
0 always
void AudioSource::stopCapturing ( )

method for stopping capture

void AudioSource::timerEvent ( QTimerEvent *  event)
protected

From QObject. Used for forwarding audio from buffer.

virtual qint64 AudioSource::writeData ( const char *  data,
qint64  maxSize 
)
protectedvirtual

From QIODevice: method where audio data will be written from actual audio source: this class AudioSource inherits QIODevice and will offer itself as data sink of iAudioInput

Parameters
dataaudio data
maxSizemax data size to be written
Returns
number of bytes actually written

Member Data Documentation

QByteArray AudioSource::iAudioBuffer
private
QAudioInput* AudioSource::iAudioInput
private
QAudioFormat AudioSource::iFormat
private
Model& AudioSource::iModel
private
bool AudioSource::iNeedsToRun
private
quint32 AudioSource::iSeqNo
private
int AudioSource::iTimerId
private

The documentation for this class was generated from the following file: