📄 playeradapter.h
字号:
#ifndef __CPLAYERADAPTER__
#define __CPLAYERADAPTER__
#include <MdaAudioSamplePlayer.h>
/*!
@class CPlayerAdapter
@discussion An instance of class CPlayerAdapter is an adapter object for
the CMdaAudioPlayerUtility class.
*/
class CPlayerAdapter : public CBase, public MMdaAudioPlayerCallback
{
public:
/*!
@function NewL
@discussion Create a CPlayerAdapter object using two phase construction,
and return a pointer to the created object
@param aFileName the audio file
@param aAppUi the User Interface
@result pointer to new object
*/
static CPlayerAdapter* NewL(const TDesC& aFileName);
/*!
@function NewLC
@discussion Create a CPlayerAdapter object using two phase construction,
and return a pointer to the created object
@param aFileName the audio file
@param aAppUi the User Interface
@result pointer to new object
*/
static CPlayerAdapter* NewLC(const TDesC& aFileName);
/*!
@function ~CPlayerAdapter
@discussion Destroy the object and release all memory objects
*/
~CPlayerAdapter();
public:
/*!
@function Play
@discussion Begin playback of the audio sample.
*/
void Play();
/*!
@function Stop
@discussion Stop playback of the audio sample.
Note that this implementation of the virtual function does not leave.
*/
void Stop();
/**
* Retrieves whether this file is currently being played.
* @return true if playback of this file is currently active.
*/
TBool IsPlaying();
void SetVolume(TInt aVolume);
void SetVolumeFraction(TInt aFraction);
public:
// from MMdaAudioPlayerCallback
/*!
@function MapcInitComplete
@discussion Handle the event when initialisation of the audio player utility is complete.
@param aError The status of the audio sample after initialisation
@param aDuration The duration of the sample
*/
void MapcInitComplete(TInt aError,
const TTimeIntervalMicroSeconds& aDuration);
/*!
@function MapcInitComplete
@discussion Handle the event when when the audio player utility completes asynchronous playing.
@param aError The status of playback
*/
void MapcPlayComplete(TInt aError);
private:
/*!
@function CPlayerAdapter
@discussion Perform the first phase of two phase construction
@param aAppUi the Ui to use
*/
CPlayerAdapter();
/*!
@function ConstructL
@discussion Perform the second phase construction of a CPlayerAdapter object
*/
void ConstructL(const TDesC& aFileName);
public:
TBool iWantToPlay;
private:
/** The current state of the audio player utility. */
enum TAudioState
{
ENotReady,
EReadyToPlay,
EPlaying
};
TAudioState iState;
/** The audio player utility object. */
CMdaAudioPlayerUtility* iMdaAudioPlayerUtility;
TInt iVolumeFraction;
};
#endif // __CPLAYERADAPTER__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -