📄 audiostreamengine.h
字号:
/*
* ============================================================================
* Name : CAudioStreamEngine from AudioStreamEngine.h
* Part of : AudioStream
* Created : 24.11.2003 by Nokia Forum
* Description:
* Declares engine for application.
* Version :
* Copyright: Nokia Corporation
* ============================================================================
*/
#ifndef AUDIOSTREAMENGINE_H
#define AUDIOSTREAMENGINE_H
// INCLUDES
#include <e32base.h>
#include <aknviewappui.h>
#include <mda\common\audio.h>
#include <MdaAudioInputStream.h> // audio input stream
#include <MdaAudioOutputStream.h> // audio output stream
#include "AudioStream.hrh"
#include "AudioStreamView.h"
#include "AudioStreamAppUi.h"
// FORWARD DECLARATIONS
class CAudioStreamView;
// CLASS DECLARATION
/**
* CAudioStreamEngine application engine class.
*
*/
class CAudioStreamEngine : public CBase, MMdaAudioInputStreamCallback,
MMdaAudioOutputStreamCallback
{
public:
/*!
* NewL()
*
* discussion Create new CAudioStreamEngine object
* return a pointer to the created instance of CAudioStreamEngine
*/
static CAudioStreamEngine* NewL(CAudioStreamAppUi* /* aAppUi */);
/*!
* NewLC()
*
* discussion Create new CAudioStreamEngine object
* return a pointer to the created instance of CAudioStreamEngine which
* has also been pushed to cleanup stack
*/
static CAudioStreamEngine* NewLC(CAudioStreamAppUi* /* aAppUi */);
/*!
* ~CAudioStreamEngine()
*
* discussion Destroy the object and release all memory objects
*/
~CAudioStreamEngine();
public: // New functions
/*!
* Play()
*
* discussion Plays the audio data sample
*/
void Play();
/*!
* Record()
*
* discussion Records an audio data sample
*/
void Record();
/*!
* Stop()
*
* discussion Stops the playing/recording of the audio data
*/
void Stop();
/*!
* LoadAudioFileL()
*
* discussion Loads an audio data from a file
*/
void LoadAudioFileL();
/*!
* SaveAudioFileL()
*
* discussion Saves the audio data into a file
*/
void SaveAudioFileL();
private: // in-class methods
/*!
* ShowMessageL()
*
* discussion Displays application messages for user on a label
*
* param aMsg text to be displayed
* param aReset if true, the label will be cleared before displaying aMsg,
* if false, aMsg text will be appended to existing message on label
*/
void ShowMessageL(const TDesC& /* aMsg */, TBool /* aReset=false */);
/*!
* MaiscOpenComplete()
*
* discussion A callback function that is called when
* CMdaAudioInputStream::Open() has completed, indicating that the audio
* input stream is ready for use.
*
* param aError KErrNone if the open succeeded, otherwise one of the system
* error codes.
*/
virtual void MaiscOpenComplete(TInt aError);
/*!
* MaiscBufferCopied()
*
* discussion A callback function that is called when a chunk of audio data
* has been copied to the descriptor specified in a
* CMdaAudioInputStream::ReadL().
*
* param aError KErrNone if the copy succeeded, KErrAbort if the input stream
* was closed for some reason, otherwise one of the system error codes.
*/
virtual void MaiscBufferCopied(TInt aError, const TDesC8& aBuffer);
/*!
* MaiscRecordComplete()
*
* discussion A callback function that is called when the input stream is
* closed using CMdaAudioInputStream::Stop().
*
* param aError KErrNone if the stop succeeded, otherwise one of the system
* error codes.
*/
virtual void MaiscRecordComplete(TInt aError);
/*!
* MaoscOpenComplete()
*
* discussion A callback function that is called when
* CMdaAudioOutputStream::Open() has completed, indicating that the audio
* output stream is ready for use.
*
* param aError KErrNone if the open succeeded, otherwise one of the system
* error codes.
*/
virtual void MaoscOpenComplete(TInt aError);
/*!
* MaoscBufferCopied()
*
* discussion A callback function that is called when a descriptor has been
* copied to the lower layers of MMF. It is also called when an error has
* occurred or when the client has stopped the stream playing before the
* descriptor has been fully copied (by calling
* CMdaAudioOutputStream::Stop())
*
* param aError KErrNone if the copy succeeded, otherwise one of the system
* error codes. KErrAbort indicates that the client has stopped the stream
* playing before the descriptor has been copied.
* param aBuffer reference to the buffer that has been copied.
*/
virtual void MaoscBufferCopied(TInt aError, const TDesC8& aBuffer);
/*!
* MaoscPlayComplete()
*
* discussion A callback function that is called when playback terminates as
* a result of a CMdaAudioOutputStream::Stop().
*
* param aError KErrNone if the close succeeded, otherwise one of the system
* error codes.
*/
virtual void MaoscPlayComplete(TInt aError);
public: // Functions from base classes
private: // Basic two-phase EPOC constructors
/*!
* ConstructL()
*
* discussion Perform the second phase construction of a CAudioStreamEngine
* object
*/
void ConstructL();
/*!
* CAudioStreamEngine()
*
* discussion Perform the first phase of two phase construction
*/
CAudioStreamEngine(CAudioStreamAppUi* /* aAppUi */);
private:
// enumeration of input/output stream status
enum TStatus
{
ENotReady,
EOpen
};
private: // data members
// application UI object reference
CAudioStreamAppUi* iAppUi;
// audio input stream object reference
CMdaAudioInputStream* iInputStream;
// audio output stream object reference
CMdaAudioOutputStream* iOutputStream;
// a buffer (pointer array) containing the audio data blocks
RPointerArray<TDes8> iStreamBuffer;
// audio data stream settings for input and output streams
TMdaAudioDataSettings iStreamSettings;
// status enumeration of input stream
TStatus iInputStatus;
// status enumeration of output stream
TStatus iOutputStatus;
// index of audio data block currently being played/recorded on the buffer
TInt iStreamIdx;
// application status message displayed to user
TBuf<64> iMsg;
// stream start (first audio block in buffer) and end index
TInt iStreamStart;
TInt iStreamEnd;
};
#endif // AUDIOSTREAMENGINE_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -