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

Class for alerting user in case of incoming call. More...

#include <ringtoneplayer.h>

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

Public Slots

virtual void finishedPlaying (QAudio::State aState)
 
virtual void notify ()
 
void stop ()
 

Signals

void error (int aError, const QString &aExplanation)
 

Public Member Functions

 RingtonePlayer (Model &aModel, MController &aController)
 
 ~RingtonePlayer ()
 
void timerEvent (QTimerEvent *event)
 
virtual void callStatusChanged (quint32 aCallId, VoiceCallEngine::CallState aState)
 
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 Member Functions

void initInput ()
 

Private Attributes

QAudioFormat iFormat
 
QAudioOutput * iAudioOutput
 
QByteArray iAudioBuffer
 
bool iNeedsToRun
 
QFile * iRingtoneFile
 
int iTimerId
 
OpusDecoder * iDecoder
 
QByteArray iDecodedData
 
QMutex * iMutex
 
ModeliModel
 
MControlleriController
 

Detailed Description

Class for alerting user in case of incoming call.

Class that plays selected ringtone or remains silent, depending on users selections.

Constructor & Destructor Documentation

RingtonePlayer::RingtonePlayer ( Model aModel,
MController aController 
)

Constructor. When constructed, immediately begins to play. There is method for stop, and there is destructor. Destructor should not be called, calling stop will cause this class to deleteLater() itself.

RingtonePlayer::~RingtonePlayer ( )

Member Function Documentation

virtual qint64 RingtonePlayer::bytesAvailable ( ) const
inlinevirtual
virtual void RingtonePlayer::callStatusChanged ( quint32  aCallId,
VoiceCallEngine::CallState  aState 
)
virtual

Method that communicates changes in call state. From interface MCallStatusObserver.

Implements MVoiceCallEngine::MCallStatusObserver.

void RingtonePlayer::error ( int  aError,
const QString &  aExplanation 
)
signal

this is not method but signal ; if in error, get emit()ted

virtual void RingtonePlayer::finishedPlaying ( QAudio::State  aState)
virtualslot

Notify slot from actual player device

void RingtonePlayer::initInput ( )
private

initializes input and codec

virtual bool RingtonePlayer::isSequential ( ) const
inlineprotectedvirtual
virtual void RingtonePlayer::notify ( )
virtualslot

notify from audio output device

virtual bool RingtonePlayer::open ( OpenMode  mode)
protectedvirtual

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

virtual qint64 RingtonePlayer::readData ( char *  data,
qint64  maxSize 
)
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.

Parameters
datapointer to buffer where data will be written
maxSizemax data size available in buffer
Returns
number of bytes actually written into buffer
void RingtonePlayer::stop ( )
slot

method for stopping playback

void RingtonePlayer::timerEvent ( QTimerEvent *  event)

From QObject. Used for feeding ringtone data to audio device

virtual qint64 RingtonePlayer::writeData ( const char *  data,
qint64  maxSize 
)
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.

Parameters
datathat will not be written anywhere.
maxSizemax data size to be not written
Returns
always 0

Member Data Documentation

QByteArray RingtonePlayer::iAudioBuffer
private

first buffered here, then written in chunks

QAudioOutput* RingtonePlayer::iAudioOutput
private
MController& RingtonePlayer::iController
private
QByteArray RingtonePlayer::iDecodedData
private
OpusDecoder* RingtonePlayer::iDecoder
private

ringtones are also opus-coded

QAudioFormat RingtonePlayer::iFormat
private
Model& RingtonePlayer::iModel
private
QMutex* RingtonePlayer::iMutex
private
bool RingtonePlayer::iNeedsToRun
private
QFile* RingtonePlayer::iRingtoneFile
private
int RingtonePlayer::iTimerId
private

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