Update contrib.
2 * Copyright (c) 2004-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 AUDIOSTREAMMANAGER_H
21 #define AUDIOSTREAMMANAGER_H
24 #include <ecom/ecom.h>
25 #include <a3f/a3f_trace_utils.h>
26 #include <a3f/a3fbase.h>
27 #include <a3f/maudiostream.h>
30 A generic AudioComponent base class implementation.
31 @see MAudioProcessingUnit
33 NONSHARABLE_CLASS(CAudioStreamManager) : public CBase,
37 static CAudioStreamManager* NewL(TUid aImplementationUid);
40 Releases all resources and deletes all objects owned by this instance.
42 virtual ~CAudioStreamManager();
45 virtual TInt RegisterAudioStreamObserver(MAudioStreamObserver& aObserver);
46 virtual void UnregisterAudioStreamObserver(MAudioStreamObserver& aObserver);
47 virtual TInt SetAudioType(const TAudioTypeSettings& aAudioTypeSettings);
48 virtual void GetAudioType(TAudioTypeSettings& aAudioTypeSettings) const;
49 virtual TAudioStreamId InstanceId() const;
50 CAudioStreamManager();
53 TAudioStreamId iAudioStreamId;
54 TAudioTypeSettings iAudioTypeSettings;
55 RPointerArray<MAudioStreamObserver> iAudioStreamObserver;
63 // Interface's (abstract base class's) destructor
64 inline CAudioStreamManager::~CAudioStreamManager()
66 iAudioStreamObserver.Close();
67 REComSession::DestroyedImplementation(iDtor_ID_Key);
70 // Interface's (abstract base class's) static factory method implementation.
71 // Asks ECOM plugin framework to instantiate appropriate concret plugin
73 inline CAudioStreamManager* CAudioStreamManager::NewL(TUid aImplementationUid)
75 TAny* ptr = REComSession::CreateImplementationL( aImplementationUid , _FOFF(CAudioStreamManager, iDtor_ID_Key));
76 return static_cast<CAudioStreamManager*>(ptr);
79 inline CAudioStreamManager::CAudioStreamManager()
84 // ---------------------------------------------------------------------------
85 // CAudioStreamManager::RegisterAudioStreamObserver
86 // ---------------------------------------------------------------------------
87 inline TInt CAudioStreamManager::RegisterAudioStreamObserver(MAudioStreamObserver& aObserver)
89 TInt err = iAudioStreamObserver.Find(&aObserver);
90 if(err == KErrNotFound)
92 err = iAudioStreamObserver.Append(&aObserver);
96 err = KErrAlreadyExists;
101 // ---------------------------------------------------------------------------
102 // CAudioStreamManager::UnregisterAudioStreamObserver
103 // ---------------------------------------------------------------------------
104 inline void CAudioStreamManager::UnregisterAudioStreamObserver(MAudioStreamObserver& aObserver)
106 TInt idxOrErr = iAudioStreamObserver.Find(&aObserver);
107 if( idxOrErr != KErrNotFound )
109 iAudioStreamObserver.Remove(idxOrErr);
113 // ---------------------------------------------------------------------------
114 // CAudioStreamManager::InstanceId
115 // ---------------------------------------------------------------------------
116 inline TAudioStreamId CAudioStreamManager::InstanceId() const
118 return iAudioStreamId;
121 // ---------------------------------------------------------------------------
122 // CAudioStreamManager::SetAudioType
123 // ---------------------------------------------------------------------------
124 inline TInt CAudioStreamManager::SetAudioType(const TAudioTypeSettings& aAudioTypeSettings)
127 iAudioTypeSettings = aAudioTypeSettings;
131 // ---------------------------------------------------------------------------
132 // CAudioStreamManager::GetAudioType
133 // ---------------------------------------------------------------------------
134 inline void CAudioStreamManager::GetAudioType(TAudioTypeSettings& aAudioTypeSettings) const
136 aAudioTypeSettings = iAudioTypeSettings;
138 #endif // CAUDIOSTREAMFACTORY_H