www.pudn.com > Full-Duplex_Audio_Example.rar > fullduplexengine.h


/* 
* ============================================================================= 
*  Name        : FullDuplexEngine.h 
*  Part of     : FullDuplexEx 
*  Description : Declaration for engine class - runs the audio output stream 
                 interacts with UI and is also responsible for creating the 
                 input stream thread 
                  
*  Version     :  
* 
*  Copyright © 2007 Nokia. All rights reserved. 
*  This material, including documentation and any related  
*  computer programs, is protected by copyright controlled by  
*  Nokia. All rights are reserved. Copying, including  
*  reproducing, storing, adapting or translating, any  
*  or all of this material requires the prior written consent of  
*  Nokia. This material also contains confidential  
*  information which may not be disclosed to others without the  
*  prior written consent of Nokia. 
* ============================================================================= 
*/ 
 
#ifndef __FULLDUPLEXENGINE_H__ 
#define __FULLDUPLEXENGINE_H__ 
 
#include "FullDuplexEngineBase.h" 
#include "SharedData.h" 
 
 
/****************************************************************************** 
*  Class Name:	MNotifierCallback 
   Description: Mixin class for printing messages on UI container 
******************************************************************************/ 
class MNotifierCallback 
    { 
public: 
    virtual void Print(const TDesC& aText) = 0; 
    virtual void UpdateProgress(TInt aBufLen) = 0; 
    }; 
 
/****************************************************************************** 
*  Class Name:	CFullDuplexEngine 
******************************************************************************/ 
class CFullDuplexEngine : public CFullDuplexEngineBase 
	{ 
public: 
    /** 
        * Static Symbian NewL constructor. 
        * @params Pointer to object implementing MNotifierCallback interface 
        * @return Pointer to a new CFullDuplexEngine object. 
        */ 
	static CFullDuplexEngine* NewL(MNotifierCallback* aConsole,  
	                               const TFourCC& aFourCC); 
	 
	/** 
        * Destructor. 
        */ 
	virtual ~CFullDuplexEngine(); 
	 
	/** 
        * Starts streaming (both output + input streams). 
        */ 
    void StartL(); 
    /** 
        * Stops streaming (both input+output streams). 
        */ 
	void Stop(); 
	 
    /** 
        * Attempts initialization of both streams. 
        * @return KErrNone if OK, otherwise one of the system-wide errors. 
        */ 
    TInt Initialize(); 
 
private: 
    /** 
        * Standard Symbian 2nd phase constructor [private] 
        */ 
	void ConstructL(const TFourCC& aFourCC); 
	/** 
        * Constructor [private] 
        */ 
	CFullDuplexEngine(MNotifierCallback* aConsole); 
	 
	/** 
        * Sends a command (TUserCommand) to the input stream by raising a 
        * user-defined exception in input stream thread. 
        */ 
	void SendCmd(TUserCommand aCmd); 
 
    /** 
        * Helper function for displaying formatted messages on screen 
        */ 
    void FormatPrint(const TDesC& aMsg, TInt aValue); 
 
	// from MDevSoundObserver 
	virtual void InitializeComplete(TInt aError); 
	virtual void BufferToBeFilled(CMMFBuffer* aBuffer); 
	virtual void PlayError(TInt aError);	 
 
private: 
 
	TSharedData	iShared;        // contains data shared between the two threads 
    RThread iFDIThread;         // handle to input stream thread 
     
    MNotifierCallback* iConsole;  
	}; 
 
#endif	// __FULLDUPLEXENGINE_H__