×
Namespaces

Variants
Actions

Talk:Playing audio files using Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search
{{{width}}}
06 Sep
2009
Article Review by kamalakshan (20090906)

This article provides very well written classes for playing audio files using both CMdaAudioRecorderUtility or CMdaAudioPlayerUtility. Any one beginning to play audio files will find this article good enough to suite their requirements - whether its playing it from a file or from the buffer.

Although it provide the content about how to use the CMdaAudioPlayerUtility, it does not work at all if you just follow the written code to run the program. Does not work at all.

If you want to build it with Qt, you need to change the inheritances. e.g. like this:

/*
* AudioPlayer.h
*
* Created on: 02.02.2010
* Author: TAMHAN
*/

 
#ifndef AUDIOPLAYER_H_
#define AUDIOPLAYER_H_
 
#include <MdaAudioSamplePlayer.h>
#include <MdaAudioSampleEditor.h>
#include <Mda\Client\Utility.h>
#include "CExampleTimer.h"
 
const TInt KReFreshTimeOut = 1000000; // re-fresh every second
//
class MExamplePlayStateObserver
{
public:
virtual void StateUpdate(CMdaAudioClipUtility::TState aState, TInt aPosition, TInt aDuration)=0;
};
 
 
class CAudioPlayer : MMdaObjectStateChangeObserver, CBase, MExampleTimerNotify
{
public:
static CAudioPlayer* NewL(MExamplePlayStateObserver& aObserver);
static CAudioPlayer* NewLC(MExamplePlayStateObserver& aObserver);
~CAudioPlayer();
public: // public functions
void PlayL(const TDesC& aFileName);
void StopL(void);
void SetVolume(TInt& aVolume);
protected: // from MMdaObjectStateChangeObserver & MExampleTimerNotify
void MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode);
void TimerExpired(TAny* aTimer,TInt aError);
private:// interna functions
void ReportStateAndTime(void);
void ConstructL();
CAudioPlayer(MExamplePlayStateObserver& aObserver);
private:
MExamplePlayStateObserver& iObserver;
CMdaAudioRecorderUtility* iPlayerUtility;
TInt iVolume;
TMdaFileClipLocation iCurrentFile;
CExampleTimer* iExampleTimer;
};
 
#endif /* AUDIOPLAYER_H_ */

TAMHAN


 

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×