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


/* 
* ============================================================================= 
*  Name        : FullDuplexEngineBase.cpp 
*  Part of     : FullDuplexEx 
*  Description : Declaration for engine base class - both the CFullDuplexEngine 
                 and CInputStreamThread are derived from this class 
                  
*  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 __FULLDUPLEXENGINEBASE_H__ 
#define __FULLDUPLEXENGINEBASE_H__ 
 
#include  
 
// CONSTANTS 
 
// Audio priority and preferences needed for enabling full-duplex 
#ifdef __SERIES60_3X__ 
 
#define KAudioPrefOutput            0x05220001 
#define KAudioPrefInput             0x05210001 
 
#else // S60 2nd Edition FP2 + FP3 
 
#define KAudioPrefOutput            0x01350001 
#define KAudioPrefInput             0x01360001 
 
#endif 
 
#define KAudioPriority              99 
 
// default MMF audio buffer size (4096 bytes) 
const TUint KBufferLength = 0x1000;     
 
/****************************************************************************** 
*  Class Name:  CFullDuplexEngineBase 
******************************************************************************/ 
class CFullDuplexEngineBase : public MDevSoundObserver 
    { 
public: 
 
    enum TStreamState 
        { 
        ENotReady,      // not yet initialized / init error 
        EReady,         
        EPlaying, 
        ERecording, 
        ERestartNeeded  // audio device was lost to a higher-priority  
                        // client -> reinitialization needed. 
        }; 
 
    virtual ~CFullDuplexEngineBase() {} 
 
    virtual TStreamState State() { return iStreamStatus; } 
 
protected: 
    CFullDuplexEngineBase(); 
     
    // empty implementation for callback methods from MDevSoundObserver 
    virtual void InitializeComplete(TInt aError) {} 
    virtual void BufferToBeFilled(CMMFBuffer* aBuffer) {} 
    virtual void PlayError(TInt aError) {}  
 
    virtual void ToneFinished(TInt /*aError*/) {} 
    virtual void BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) {} 
    virtual void RecordError(TInt /*aError*/) {} 
    virtual void ConvertError(TInt /*aError*/) {} 
    virtual void DeviceMessage (TUid /*aMessageType*/,  
                                const TDesC8& /*aMsg*/) {} 
    virtual void SendEventToClient(const TMMFEvent& /*aEvent*/) {} 
 
protected: 
 
    TStreamState iStreamStatus; 
     
    CMMFDevSound* iMMFDevSound; 
    TMMFPrioritySettings  iPrioritySettings; 
    }; 
 
#endif // __FULLDUPLEXENGINEBASE_H__