1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmhais/a3facl/src/audiocontext/audiocontext.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,163 @@
1.4 +/*
1.5 +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#ifndef AUDIOCONTEXT_H
1.23 +#define AUDIOCONTEXT_H
1.24 +
1.25 +#include <e32base.h>
1.26 +#include <a3f/a3fbase.h>
1.27 +#include <a3f/a3f_trace_utils.h>
1.28 +#include <a3f/a3fdevsoundaudiopauseresume.h>
1.29 +
1.30 +#include "mmrcclient.h"
1.31 +#include "multimediaresourcecontrolobserver.h"
1.32 +
1.33 +#include <a3f/maudiocontext.h>
1.34 +#include <a3f/maudiocontextobserver.h>
1.35 +
1.36 +#include "mlogicalsettingsobserver.h"
1.37 +
1.38 +
1.39 +class CAudioProcessingUnit;
1.40 +class CLogicalAudioStream;
1.41 +
1.42 +
1.43 +/**
1.44 +Panic category and codes
1.45 +*/
1.46 +_LIT(KAudioContextPanicCategory, "AudioContext");
1.47 +
1.48 +enum TAudioContextPanicCodes
1.49 + {
1.50 + ECloneLeftWhenReceivingResourceResponse = 1,
1.51 + };
1.52 +
1.53 +////
1.54 + // Implementation of the audio context.
1.55 + //
1.56 + // @see MAudioContext
1.57 + // @see MMultimediaResourceControlObserver
1.58 + // @see MLogicalSettingObserver
1.59 + //
1.60 + // @lib AudioComponentFramework.lib
1.61 + //
1.62 +NONSHARABLE_CLASS(CAudioContext) : public CBase,
1.63 + public MAudioContext,
1.64 + public MMultimediaResourceControlObserver,
1.65 + public MLogicalSettingObserver,
1.66 + public MA3FDevSoundAutoPauseResume
1.67 + {
1.68 +
1.69 +public:
1.70 +
1.71 + IMPORT_C static CAudioContext* NewL();
1.72 +
1.73 + IMPORT_C virtual ~CAudioContext();
1.74 +
1.75 + //
1.76 + IMPORT_C MLogicalChain* GetLogicalChain(TInt aIndex);
1.77 + IMPORT_C TInt MsgVersion();
1.78 + IMPORT_C RCriticalSection& CriticalSection();
1.79 + // from base class MAudioContext (A3F API)
1.80 + virtual TInt Commit ( );
1.81 + virtual TInt CreateAudioProcessingUnit (TUid aTypeId, MAudioProcessingUnit *& aProcessingUnit );
1.82 + virtual TInt CreateAudioStream ( MAudioStream *& aStream );
1.83 + virtual void DeleteAudioProcessingUnit ( MAudioProcessingUnit *& aProcessingUnit );
1.84 + virtual void DeleteAudioStream ( MAudioStream *& aStream );
1.85 + virtual TAudioContextId ContextId ( ) const;
1.86 + virtual TAny* Interface(TUid aType);
1.87 + virtual TInt RegisterAudioContextObserver ( MAudioContextObserver & aObserver );
1.88 + virtual TInt Reset ( );
1.89 + virtual TInt SetClientSettings(const TClientContextSettings &aSettings);
1.90 + virtual void UnregisterAudioContextObserver ( MAudioContextObserver & aObserver ) ;
1.91 +
1.92 + //from base class MMultimediaResourceControlObserver
1.93 + virtual void ReceiveResourceResponse(MLogicalChain *aMessage, TInt aError);
1.94 + virtual void ReceiveResourceUpdate(MLogicalChain *aMessage, TInt aError);
1.95 + virtual void ReceivePreemptionUpdate(MLogicalChain *aMessage, TInt aError);
1.96 + virtual void CanResume();
1.97 +
1.98 + //from MLogicalSettingObserver
1.99 + virtual void ReceiveComponentSettingsChange(TUid aId, TMMRCMessageType aMessageType);
1.100 +
1.101 + //Internals.
1.102 + //Resolve and get component context-unique component instance id.
1.103 + TAudioComponentId GetAndSetInstanceID();
1.104 + //Send a the notification about context event to all observers.
1.105 + void ContextEventSignal(TUid aEvent, TInt aError);
1.106 +
1.107 + //from MA3FDevSoundAutoPauseResume
1.108 + virtual TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData, MA3FDevSoundAutoPauseResumeObserver* aObserverPtr);
1.109 + virtual TInt CancelRegisterAsClient(TUid aEventType);
1.110 + virtual TInt WillResumePlay();
1.111 +
1.112 +private:
1.113 +
1.114 + CAudioContext();
1.115 +
1.116 + void ConstructL();
1.117 +
1.118 + void Panic(TAudioContextPanicCodes aCode);
1.119 +
1.120 +private:
1.121 + //Context identifier.
1.122 +
1.123 + TAudioContextId iContextId;
1.124 +
1.125 + //Array of components within this context (stream not included) (array members not own).
1.126 +
1.127 + RPointerArray<MAudioProcessingUnit> iAudioProcessingUnits;
1.128 +
1.129 +
1.130 + // Array of context observers.
1.131 + // Members not own.
1.132 +
1.133 + RPointerArray<MAudioContextObserver> iAudioContextObservers;
1.134 +
1.135 +
1.136 + //Multimedia Resource Control API.
1.137 +
1.138 + RMMRCClient iMMRC;
1.139 +
1.140 +
1.141 + //Client context identifiers.
1.142 +
1.143 + TClientContextSettings iClientSettings;
1.144 +
1.145 + //Audio type settings.
1.146 +
1.147 + TAudioTypeSettings iAudioTypeSettings;
1.148 +
1.149 + // Not owned
1.150 + MLogicalChain* iDesiredChain;
1.151 +
1.152 + // Owned
1.153 + MLogicalChain* iActualChain;
1.154 +
1.155 + TBool iInCommit;
1.156 +
1.157 + TBool iPreempted;
1.158 +
1.159 + MA3FDevSoundAutoPauseResumeObserver* iObserverPtr;
1.160 +
1.161 + TInt iMsgVersion;
1.162 +
1.163 + RCriticalSection iCriticalSection;
1.164 + };
1.165 +
1.166 +#endif // AUDIOCONTEXT_H