os/mm/devsoundextensions/effects/SrcOrientation/SourceOrientationEffect/Src/SourceOrientationBase.cpp
Update contrib.
2 * Copyright (c) 2006 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.
14 * Description: Implementation of the listenerlocation effect class
27 #include <SourceOrientationBase.h>
28 #include <CustomInterfaceUtility.h>
29 #include "SourceOrientationProxy.h"
30 #include <DrmAudioSamplePlayer.h>
31 #include <mdaaudioinputstream.h>
32 #include <mdaaudiooutputstream.h>
33 #include <mdaaudiotoneplayer.h>
34 #include <mmf/server/sounddevice.h>
35 #include <videoplayer.h>
38 #define DEBPRN0 RDebug::Printf( "%s", __PRETTY_FUNCTION__);
39 #define DEBPRN1(str) RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str );
45 // ============================ MEMBER FUNCTIONS ===============================
47 // -----------------------------------------------------------------------------
48 // CSourceOrientation::CSourceOrientation
49 // C++ default constructor can NOT contain any code, that
51 // -----------------------------------------------------------------------------
53 EXPORT_C CSourceOrientation::CSourceOrientation()
58 EXPORT_C CSourceOrientation::~CSourceOrientation()
63 // -----------------------------------------------------------------------------
64 // CSourceOrientation::NewL
65 // Static function for creating an instance of the SourceOrientation object.
66 // -----------------------------------------------------------------------------
68 EXPORT_C CSourceOrientation* CSourceOrientation::NewL(
69 CMdaAudioInputStream& aUtility )
73 CSourceOrientationProxy* sourceOrientationProxy = (CSourceOrientationProxy*)aUtility.CustomInterface(KUidSourceOrientationEffect);
75 if (sourceOrientationProxy == NULL)
77 DEBPRN1("No Adaptation Support - leaving");
78 User::Leave(KErrNotSupported);
81 return sourceOrientationProxy;
84 // -----------------------------------------------------------------------------
85 // CSourceOrientation::NewL
86 // Static function for creating an instance of the SourceOrientation object.
87 // -----------------------------------------------------------------------------
89 EXPORT_C CSourceOrientation* CSourceOrientation::NewL(
90 CMdaAudioOutputStream& aUtility )
94 CSourceOrientationProxy* sourceOrientationProxy = (CSourceOrientationProxy*)aUtility.CustomInterface(KUidSourceOrientationEffect);
96 if (sourceOrientationProxy == NULL)
98 DEBPRN1("No Adaptation Support - leaving");
99 User::Leave(KErrNotSupported);
102 return sourceOrientationProxy;
105 // -----------------------------------------------------------------------------
106 // CSourceOrientation::NewL
107 // Static function for creating an instance of the SourceOrientation object.
108 // -----------------------------------------------------------------------------
110 EXPORT_C CSourceOrientation* CSourceOrientation::NewL(
111 CMdaAudioConvertUtility& aUtility )
115 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
116 CleanupStack::PushL(customInterface);
118 CSourceOrientationProxy* sourceOrientationProxy = (CSourceOrientationProxy*)customInterface->CustomInterface(KUidSourceOrientationEffect);
120 if ( !sourceOrientationProxy )
122 DEBPRN1("No Adaptation Support - leaving");
123 User::Leave(KErrNotSupported);
126 CleanupStack::Pop(customInterface);
128 return sourceOrientationProxy;
131 // -----------------------------------------------------------------------------
132 // CSourceOrientation::NewL
133 // Static function for creating an instance of the SourceOrientation object.
134 // -----------------------------------------------------------------------------
136 EXPORT_C CSourceOrientation* CSourceOrientation::NewL(
137 CMdaAudioPlayerUtility& aUtility )
141 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
142 CleanupStack::PushL(customInterface);
144 CSourceOrientationProxy* sourceOrientationProxy = (CSourceOrientationProxy*)customInterface->CustomInterface(KUidSourceOrientationEffect);
146 if ( !sourceOrientationProxy )
148 DEBPRN1("No Adaptation Support - leaving");
149 User::Leave(KErrNotSupported);
152 CleanupStack::Pop(customInterface);
154 return sourceOrientationProxy;
157 // -----------------------------------------------------------------------------
158 // CSourceOrientation::NewL
159 // Static function for creating an instance of the SourceOrientation object.
160 // -----------------------------------------------------------------------------
162 EXPORT_C CSourceOrientation* CSourceOrientation::NewL(
163 CMdaAudioRecorderUtility& aUtility,
164 TBool aRecordStream )
168 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility, aRecordStream);
169 CleanupStack::PushL(customInterface);
171 CSourceOrientationProxy* sourceOrientationProxy = (CSourceOrientationProxy*)customInterface->CustomInterface(KUidSourceOrientationEffect);
173 if ( !sourceOrientationProxy )
175 DEBPRN1("No Adaptation Support - leaving");
176 User::Leave(KErrNotSupported);
179 CleanupStack::Pop(customInterface);
181 return sourceOrientationProxy;
184 // -----------------------------------------------------------------------------
185 // CSourceOrientation::NewL
186 // Static function for creating an instance of the SourceOrientation object.
187 // -----------------------------------------------------------------------------
189 EXPORT_C CSourceOrientation* CSourceOrientation::NewL(
190 CMdaAudioToneUtility& aUtility )
194 CSourceOrientationProxy* sourceOrientationProxy = (CSourceOrientationProxy*)aUtility.CustomInterface(KUidSourceOrientationEffect);
196 if (sourceOrientationProxy == NULL)
198 DEBPRN1("No Adaptation Support - leaving");
199 User::Leave(KErrNotSupported);
202 return sourceOrientationProxy;
205 // -----------------------------------------------------------------------------
206 // CSourceOrientation::NewL
207 // Static function for creating an instance of the SourceOrientation object.
208 // -----------------------------------------------------------------------------
210 EXPORT_C CSourceOrientation* CSourceOrientation::NewL(
211 CMMFDevSound& aDevSound )
215 CSourceOrientationProxy* sourceOrientationProxy = (CSourceOrientationProxy*)aDevSound.CustomInterface(KUidSourceOrientationEffect);
217 if (sourceOrientationProxy == NULL)
219 DEBPRN1("No Adaptation Support - leaving");
220 User::Leave(KErrNotSupported);
223 return sourceOrientationProxy;
226 // -----------------------------------------------------------------------------
227 // CSourceOrientation::NewL
228 // Static function for creating an instance of the SourceOrientation object.
229 // -----------------------------------------------------------------------------
231 EXPORT_C CSourceOrientation* CSourceOrientation::NewL(
232 CCustomCommandUtility* aUtility )
236 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
237 CleanupStack::PushL(customInterface);
239 CSourceOrientationProxy* sourceOrientationProxy = (CSourceOrientationProxy*)customInterface->CustomInterface(KUidSourceOrientationEffect);
241 if ( !sourceOrientationProxy )
243 DEBPRN1("No Adaptation Support - leaving");
244 User::Leave(KErrNotSupported);
247 CleanupStack::Pop(customInterface);
249 return sourceOrientationProxy;
252 // -----------------------------------------------------------------------------
253 // CSourceOrientation::NewL
254 // Static function for creating an instance of the SourceOrientation object.
255 // -----------------------------------------------------------------------------
257 EXPORT_C CSourceOrientation* CSourceOrientation::NewL(
258 MCustomInterface& aCustomInterface )
262 CSourceOrientationProxy* sourceOrientationProxy = (CSourceOrientationProxy*)aCustomInterface.CustomInterface(KUidSourceOrientationEffect);
264 if ( !sourceOrientationProxy )
266 DEBPRN1("No Adaptation Support - leaving");
267 User::Leave(KErrNotSupported);
270 return sourceOrientationProxy;
273 // -----------------------------------------------------------------------------
274 // CSourceOrientation::NewL
275 // Static function for creating an instance of the SourceOrientation object.
276 // -----------------------------------------------------------------------------
278 EXPORT_C CSourceOrientation* CSourceOrientation::NewL(
279 CMidiClientUtility& aUtility )
283 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
284 CleanupStack::PushL(customInterface);
286 CSourceOrientationProxy* sourceOrientationProxy = (CSourceOrientationProxy*)customInterface->CustomInterface(KUidSourceOrientationEffect);
288 if ( !sourceOrientationProxy )
290 DEBPRN1("No Adaptation Support - leaving");
291 User::Leave(KErrNotSupported);
294 CleanupStack::Pop(customInterface);
296 return sourceOrientationProxy;
299 // -----------------------------------------------------------------------------
300 // CSourceOrientation::NewL
301 // Static function for creating an instance of the SourceOrientation object.
302 // -----------------------------------------------------------------------------
304 EXPORT_C CSourceOrientation* CSourceOrientation::NewL(
305 CDrmPlayerUtility& aUtility )
309 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
310 CleanupStack::PushL(customInterface);
312 CSourceOrientationProxy* sourceOrientationProxy = (CSourceOrientationProxy*)customInterface->CustomInterface(KUidSourceOrientationEffect);
314 if ( !sourceOrientationProxy )
316 DEBPRN1("No Adaptation Support - leaving");
317 User::Leave(KErrNotSupported);
320 CleanupStack::Pop(customInterface);
322 return sourceOrientationProxy;
325 // -----------------------------------------------------------------------------
326 // CSourceOrientation::NewL
327 // Static function for creating an instance of the SourceOrientation object.
328 // -----------------------------------------------------------------------------
330 EXPORT_C CSourceOrientation* CSourceOrientation::NewL(
331 CVideoPlayerUtility& aUtility )
335 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
336 CleanupStack::PushL(customInterface);
338 CSourceOrientationProxy* sourceOrientationProxy = (CSourceOrientationProxy*)customInterface->CustomInterface(KUidSourceOrientationEffect);
340 if ( !sourceOrientationProxy )
342 DEBPRN1("No Adaptation Support - leaving");
343 User::Leave(KErrNotSupported);
346 CleanupStack::Pop(customInterface);
348 return sourceOrientationProxy;
351 // -----------------------------------------------------------------------------
352 // CSourceOrientation::Uid
353 // -----------------------------------------------------------------------------
355 EXPORT_C TUid CSourceOrientation::Uid() const
357 return KUidSourceOrientationEffect;
361 // ========================== OTHER EXPORTED FUNCTIONS =========================