⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 audiomp3engine.h

📁 封装了Symbian OS 3rd的音频播放器
💻 H
字号:
/*
============================================================================
 Name        : AudioMp3Engine.h
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : CAudioMp3Engine declaration
============================================================================
*/

#ifndef AUDIOMP3ENGINE_H
#define AUDIOMP3ENGINE_H
#include <e32std.h>
#include <e32base.h>

#if !defined(__MDA_COMMON_AUDIO_H__)
	#include <mda\common\audio.h>
#endif

#if !defined(__MDA_CLIENT_UTILITY_H__)
	#include <Mda\Client\Utility.h>
#endif

#if !defined(__MDA_COMMON_RESOURCE_H__)
	#include <Mda\Common\Resource.h>
#endif

#if !defined(__MDAAUDIOOUTPUTSTREAM_H__)
	#include <MdaAudioOutputStream.h>
#endif


const TInt KVolSliderLength = 10;
const TInt KInitialVolume = 9;
const TInt KNumBuf = 2;
const TInt KBufferSize = 5000;

class CEikonEnv;
class CMP3DecodeEngine;


class CAudioMp3Engine : public CBase
{
public:
	enum TEngineStatus
		{
		EEngineNotReady,
		EEngineReady,
		EEngineToPause,
		EEnginePause,
		EEnginePlaying        
		};

public: 
	~CAudioMp3Engine();
	static CAudioMp3Engine* NewL();
	static CAudioMp3Engine* NewLC();

public:
	void PlayL();
	void Pause();
	void StopL();
	void SetRepeat(TBool aRepeat);
	void OpenL(TFileName  aFileName);


	virtual void MaoscOpenComplete(TInt aError);
	virtual void MaoscBufferCopied(TInt aError, const TDesC8& aBuffer);
	virtual void MaoscPlayComplete(TInt aError);

	inline TInt Volume();

	inline TBool StreamReady(); 
	inline TBool StreamPlaying();
	inline TBool StreamPause();
	inline TBool StreamRepeat();

	void SetVolume(TInt aVol);
protected:
   void ShowErrorMsg(TInt aResourceBuf, TInt aError);

private:
	CAudioMp3Engine();
	void ConstructL();
	void NextBuffer(const TDesC8& aBuffer);

private:
	TInt iVolume;               // volume
	TInt iVolStep;      
	TBool iFileOK;              // indicates if file has been successfully read to buffer 
	TEngineStatus iMp3Status;      // engine status
	TBool iPlayFile;            // which buffer is currently in use
	TBool iRepeat;
	TUint16* aa; 
	TPtr imp3Buf; 
	TBool iStart;
	TBuf8<KBufferSize> iBufList[KNumBuf];

	CMdaAudioOutputStream* iStream;
	TMdaAudioDataSettings iSettings;

	CEikonEnv* iEnv;

	CMP3DecodeEngine * imp3;
	RFs fss;
	TFileName tFullFileName;
	TInt  fm;

	TInt  bufx;

};

// INLINES

inline TInt CAudioMp3Engine::Volume() { return iVolume; }
inline TBool CAudioMp3Engine::StreamReady() { return (iMp3Status == EEngineReady)?ETrue:EFalse; }
inline TBool CAudioMp3Engine::StreamPlaying() { return (iMp3Status == EEnginePlaying)?ETrue:EFalse; }
inline TBool CAudioMp3Engine::StreamPause() { return (iMp3Status == EEnginePause)?ETrue:EFalse; }
inline TBool CAudioMp3Engine::StreamRepeat(){ return iRepeat; }
// writes 2 bytes to buffer in LSB order

#endif 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -