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::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::~RingtonePlayer ( )

Member Function Documentation

◆ bytesAvailable()

virtual qint64 RingtonePlayer::bytesAvailable ( ) const
inlinevirtual

◆ callStatusChanged()

virtual void RingtonePlayer::callStatusChanged ( quint32  aCallId,
VoiceCallEngine::CallState  aState 
)
virtual

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

◆ error

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

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

◆ finishedPlaying

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

Notify slot from actual player device

◆ initInput()

void RingtonePlayer::initInput ( )
private

initializes input and codec

◆ isSequential()

virtual bool RingtonePlayer::isSequential ( ) const
inlineprotectedvirtual

◆ notify

virtual void RingtonePlayer::notify ( )
virtualslot

notify from audio output device

◆ open()

virtual bool RingtonePlayer::open ( OpenMode  mode)
protectedvirtual

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

◆ readData()

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

◆ stop

void RingtonePlayer::stop ( )
slot

method for stopping playback

◆ timerEvent()

void RingtonePlayer::timerEvent ( QTimerEvent *  event)

From QObject. Used for feeding ringtone data to audio device

◆ writeData()

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

◆ iAudioBuffer

QByteArray RingtonePlayer::iAudioBuffer
private

first buffered here, then written in chunks

◆ iAudioOutput

QAudioOutput* RingtonePlayer::iAudioOutput
private

◆ iController

MController& RingtonePlayer::iController
private

◆ iDecodedData

QByteArray RingtonePlayer::iDecodedData
private

◆ iDecoder

OpusDecoder* RingtonePlayer::iDecoder
private

ringtones are also opus-coded

◆ iFormat

QAudioFormat RingtonePlayer::iFormat
private

◆ iModel

Model& RingtonePlayer::iModel
private

◆ iMutex

QMutex* RingtonePlayer::iMutex
private

◆ iNeedsToRun

bool RingtonePlayer::iNeedsToRun
private

◆ iRingtoneFile

QFile* RingtonePlayer::iRingtoneFile
private

◆ iTimerId

int RingtonePlayer::iTimerId
private

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