Update contrib.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
20 #ifndef AUDIOPROCESSINGUNIT_H
21 #define AUDIOPROCESSINGUNIT_H
24 #include <ecom/ecom.h>
25 #include <a3f/a3f_trace_utils.h>
26 #include <a3f/audioprocessingunittypeuids.h>
27 #include <a3f/maudioprocessingunit.h>
28 #include <a3f/maudioprocessingunitobserver.h>
30 #include "componentparameters.h"
31 #include "mlogicalsettingsobserver.h"
35 A generic AudioComponent base class implementation.
36 @see MAudioProcessingUnit
38 class CAudioProcessingUnit: public CBase,
39 public MAudioProcessingUnit
44 static CAudioProcessingUnit* NewL(TComponentParameters aParameters);
48 Releases all resources and deletes all objects owned by this instance.
50 virtual ~CAudioProcessingUnit();
52 // from base class MAudioProcessingUnit
53 virtual TAudioComponentId InstanceId() const;
54 virtual TAudioContextId ContextId() const;
55 virtual TBool IsTypeOf(TUid aTypeId) const;
56 virtual TAny* Interface(TUid aType);
57 virtual TInt RegisterProcessingUnitObserver(MAudioProcessingUnitObserver& aObserver);
58 virtual void UnregisterProcessingUnitObserver(MAudioProcessingUnitObserver& aObserver);
60 CAudioProcessingUnit(TAny* aParam);
67 TAudioContextId iContextId;
69 // Component instance Id
70 TAudioComponentId iInstanceId;
72 // Array of component observers.
73 RPointerArray<MAudioProcessingUnitObserver> iAudioProcessingUnitObservers;
76 MLogicalSettingObserver* iSettingsObserver;
82 // Interface's (abstract base class's) destructor
83 inline CAudioProcessingUnit::~CAudioProcessingUnit()
85 iAudioProcessingUnitObservers.Close();
86 REComSession::DestroyedImplementation(iDtor_ID_Key);
89 // Interface's (abstract base class's) static factory method implementation.
90 // Asks ECOM plugin framework to instantiate appropriate concret plugin
92 inline CAudioProcessingUnit* CAudioProcessingUnit::NewL(TComponentParameters aParameters)
94 TAny* ptr = REComSession::CreateImplementationL( aParameters.iTypeUid , _FOFF(CAudioProcessingUnit, iDtor_ID_Key), static_cast<TAny*>(&aParameters));
95 return static_cast<CAudioProcessingUnit*>(ptr);
98 inline CAudioProcessingUnit::CAudioProcessingUnit(TAny* aParam)
100 TComponentParameters* param = static_cast<TComponentParameters*>(aParam);
101 iType = param->iTypeUid;
102 iInstanceId = param->iInstanceId;
103 iContextId = param->iContextId;
104 iSettingsObserver = param->iSettingsObserver;
107 // ---------------------------------------------------------------------------
108 // from class MAudioProcessingUnit
109 // CLogicalAudioCodec::GetContextId
110 // ---------------------------------------------------------------------------
111 inline TAudioContextId CAudioProcessingUnit::ContextId() const
116 inline TAudioComponentId CAudioProcessingUnit::InstanceId() const
121 // ---------------------------------------------------------------------------
122 // from class MAudioProcessingUnit
123 // CLogicalAudioCodec::RegisterComponentObserver
124 // ---------------------------------------------------------------------------
125 inline TInt CAudioProcessingUnit::RegisterProcessingUnitObserver(MAudioProcessingUnitObserver& aObserver)
127 TInt err = iAudioProcessingUnitObservers.Find(&aObserver);
128 if( err != KErrNotFound )
130 err = KErrAlreadyExists;
134 err = iAudioProcessingUnitObservers.Append(&aObserver);
139 // ---------------------------------------------------------------------------
140 // from class MAudioProcessingUnit
141 // CLogicalAudioCodec::UnregisterComponentObserver
142 // ---------------------------------------------------------------------------
143 inline void CAudioProcessingUnit::UnregisterProcessingUnitObserver(MAudioProcessingUnitObserver& aObserver)
145 TInt idxOrErr = iAudioProcessingUnitObservers.Find(&aObserver);
146 if( idxOrErr != KErrNotFound )
148 iAudioProcessingUnitObservers.Remove(idxOrErr);
152 inline TBool CAudioProcessingUnit::IsTypeOf(TUid) const {return EFalse;}
153 inline TAny* CAudioProcessingUnit::Interface(TUid) { TAny* any(NULL); return any;}
155 #endif // AUDIOPROCESSINGUNIT_H