os/mm/devsoundextensions/effects/SrcLocation/SourceLocationEffect/Src/SourceLocationBase.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsoundextensions/effects/SrcLocation/SourceLocationEffect/Src/SourceLocationBase.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,364 @@
1.4 +/*
1.5 +* Copyright (c) 2006 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: Implementation of the listenerlocation effect class
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +
1.24 +// INCLUDE FILES
1.25 +
1.26 +#ifdef _DEBUG
1.27 +#include <e32svr.h>
1.28 +#endif
1.29 +
1.30 +#include <SourceLocationBase.h>
1.31 +#include <CustomInterfaceUtility.h>
1.32 +#include "SourceLocationProxy.h"
1.33 +#include <DrmAudioSamplePlayer.h>
1.34 +#include <mdaaudioinputstream.h>
1.35 +#include <mdaaudiooutputstream.h>
1.36 +#include <mdaaudiotoneplayer.h>
1.37 +#include <mmf/server/sounddevice.h>
1.38 +#include <videoplayer.h>
1.39 +
1.40 +#ifdef _DEBUG
1.41 +#define DEBPRN0 RDebug::Printf( "%s", __PRETTY_FUNCTION__);
1.42 +#define DEBPRN1(str) RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str );
1.43 +#else
1.44 +#define DEBPRN0
1.45 +#define DEBPRN1(str)
1.46 +#endif
1.47 +
1.48 +// ============================ MEMBER FUNCTIONS ===============================
1.49 +
1.50 +// -----------------------------------------------------------------------------
1.51 +// CSourceLocation::CSourceLocation
1.52 +// C++ default constructor can NOT contain any code, that
1.53 +// might leave.
1.54 +// -----------------------------------------------------------------------------
1.55 +//
1.56 +EXPORT_C CSourceLocation::CSourceLocation()
1.57 + {
1.58 + }
1.59 +
1.60 +// Destructor
1.61 +EXPORT_C CSourceLocation::~CSourceLocation()
1.62 + {
1.63 + }
1.64 +
1.65 +
1.66 +// -----------------------------------------------------------------------------
1.67 +// CSourceLocation::NewL
1.68 +// Static function for creating an instance of the SourceLocation object.
1.69 +// -----------------------------------------------------------------------------
1.70 +//
1.71 +EXPORT_C CSourceLocation* CSourceLocation::NewL(
1.72 + CMdaAudioInputStream& aUtility )
1.73 + {
1.74 +
1.75 + DEBPRN0;
1.76 + CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)aUtility.CustomInterface(KUidSourceLocationEffect);
1.77 +
1.78 + if (sourceLocationProxy == NULL)
1.79 + {
1.80 + DEBPRN1("No Adaptation Support - leaving");
1.81 + User::Leave(KErrNotSupported);
1.82 + }
1.83 +
1.84 + return sourceLocationProxy;
1.85 + }
1.86 +
1.87 +// -----------------------------------------------------------------------------
1.88 +// CSourceLocation::NewL
1.89 +// Static function for creating an instance of the SourceLocation object.
1.90 +// -----------------------------------------------------------------------------
1.91 +//
1.92 +EXPORT_C CSourceLocation* CSourceLocation::NewL(
1.93 + CMdaAudioOutputStream& aUtility )
1.94 + {
1.95 +
1.96 + DEBPRN0;
1.97 + CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)aUtility.CustomInterface(KUidSourceLocationEffect);
1.98 +
1.99 + if (sourceLocationProxy == NULL)
1.100 + {
1.101 + DEBPRN1("No Adaptation Support - leaving");
1.102 + User::Leave(KErrNotSupported);
1.103 + }
1.104 +
1.105 + return sourceLocationProxy;
1.106 + }
1.107 +
1.108 +// -----------------------------------------------------------------------------
1.109 +// CSourceLocation::NewL
1.110 +// Static function for creating an instance of the SourceLocation object.
1.111 +// -----------------------------------------------------------------------------
1.112 +//
1.113 +EXPORT_C CSourceLocation* CSourceLocation::NewL(
1.114 + CMdaAudioConvertUtility& aUtility )
1.115 + {
1.116 +
1.117 + DEBPRN0;
1.118 + CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
1.119 + CleanupStack::PushL(customInterface);
1.120 +
1.121 + CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
1.122 +
1.123 + if ( !sourceLocationProxy )
1.124 + {
1.125 + DEBPRN1("No Adaptation Support - leaving");
1.126 + User::Leave(KErrNotSupported);
1.127 + }
1.128 +
1.129 + CleanupStack::Pop(customInterface);
1.130 +
1.131 + return sourceLocationProxy;
1.132 + }
1.133 +
1.134 +// -----------------------------------------------------------------------------
1.135 +// CSourceLocation::NewL
1.136 +// Static function for creating an instance of the SourceLocation object.
1.137 +// -----------------------------------------------------------------------------
1.138 +//
1.139 +EXPORT_C CSourceLocation* CSourceLocation::NewL(
1.140 + CMdaAudioPlayerUtility& aUtility )
1.141 + {
1.142 +
1.143 + DEBPRN0;
1.144 + CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
1.145 + CleanupStack::PushL(customInterface);
1.146 +
1.147 + CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
1.148 +
1.149 + if ( !sourceLocationProxy )
1.150 + {
1.151 + DEBPRN1("No Adaptation Support - leaving");
1.152 + User::Leave(KErrNotSupported);
1.153 + }
1.154 +
1.155 + CleanupStack::Pop(customInterface);
1.156 +
1.157 + return sourceLocationProxy;
1.158 + }
1.159 +
1.160 +// -----------------------------------------------------------------------------
1.161 +// CSourceLocation::NewL
1.162 +// Static function for creating an instance of the SourceLocation object.
1.163 +// -----------------------------------------------------------------------------
1.164 +//
1.165 +EXPORT_C CSourceLocation* CSourceLocation::NewL(
1.166 + CMdaAudioRecorderUtility& aUtility,
1.167 + TBool aRecordStream )
1.168 + {
1.169 +
1.170 + DEBPRN0;
1.171 + CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility, aRecordStream);
1.172 + CleanupStack::PushL(customInterface);
1.173 +
1.174 + CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
1.175 +
1.176 + if ( !sourceLocationProxy )
1.177 + {
1.178 + DEBPRN1("No Adaptation Support - leaving");
1.179 + User::Leave(KErrNotSupported);
1.180 + }
1.181 +
1.182 + CleanupStack::Pop(customInterface);
1.183 +
1.184 + return sourceLocationProxy;
1.185 + }
1.186 +
1.187 +// -----------------------------------------------------------------------------
1.188 +// CSourceLocation::NewL
1.189 +// Static function for creating an instance of the SourceLocation object.
1.190 +// -----------------------------------------------------------------------------
1.191 +//
1.192 +EXPORT_C CSourceLocation* CSourceLocation::NewL(
1.193 + CMdaAudioToneUtility& aUtility)
1.194 + {
1.195 +
1.196 + DEBPRN0;
1.197 + CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)aUtility.CustomInterface(KUidSourceLocationEffect);
1.198 +
1.199 + if (sourceLocationProxy == NULL)
1.200 + {
1.201 + DEBPRN1("No Adaptation Support - leaving");
1.202 + User::Leave(KErrNotSupported);
1.203 + }
1.204 +
1.205 + return sourceLocationProxy;
1.206 + }
1.207 +
1.208 +// -----------------------------------------------------------------------------
1.209 +// CSourceLocation::NewL
1.210 +// Static function for creating an instance of the SourceLocation object.
1.211 +// -----------------------------------------------------------------------------
1.212 +//
1.213 +EXPORT_C CSourceLocation* CSourceLocation::NewL(
1.214 + CMMFDevSound& aDevSound )
1.215 + {
1.216 +
1.217 + DEBPRN0;
1.218 + CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)aDevSound.CustomInterface(KUidSourceLocationEffect);
1.219 +
1.220 + if (sourceLocationProxy == NULL)
1.221 + {
1.222 + DEBPRN1("No Adaptation Support - leaving");
1.223 + User::Leave(KErrNotSupported);
1.224 + }
1.225 +
1.226 + return sourceLocationProxy;
1.227 + }
1.228 +
1.229 +// -----------------------------------------------------------------------------
1.230 +// CSourceLocation::NewL
1.231 +// Static function for creating an instance of the SourceLocation object.
1.232 +// -----------------------------------------------------------------------------
1.233 +//
1.234 +EXPORT_C CSourceLocation* CSourceLocation::NewL(
1.235 + CCustomCommandUtility* aUtility )
1.236 + {
1.237 +
1.238 + DEBPRN0;
1.239 + CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
1.240 + CleanupStack::PushL(customInterface);
1.241 +
1.242 + CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
1.243 +
1.244 + if ( !sourceLocationProxy )
1.245 + {
1.246 + DEBPRN1("No Adaptation Support - leaving");
1.247 + User::Leave(KErrNotSupported);
1.248 + }
1.249 +
1.250 + CleanupStack::Pop(customInterface);
1.251 +
1.252 + return sourceLocationProxy;
1.253 + }
1.254 +
1.255 +// -----------------------------------------------------------------------------
1.256 +// CSourceLocation::NewL
1.257 +// Static function for creating an instance of the SourceLocation object.
1.258 +// -----------------------------------------------------------------------------
1.259 +//
1.260 +EXPORT_C CSourceLocation* CSourceLocation::NewL(
1.261 + MCustomInterface& aCustomInterface )
1.262 + {
1.263 +
1.264 + DEBPRN0;
1.265 + CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)aCustomInterface.CustomInterface(KUidSourceLocationEffect);
1.266 +
1.267 + if ( !sourceLocationProxy )
1.268 + {
1.269 + DEBPRN1("No Adaptation Support - leaving");
1.270 + User::Leave(KErrNotSupported);
1.271 + }
1.272 +
1.273 + return sourceLocationProxy;
1.274 + }
1.275 +
1.276 +// -----------------------------------------------------------------------------
1.277 +// CSourceLocation::NewL
1.278 +// Static function for creating an instance of the SourceLocation object.
1.279 +// -----------------------------------------------------------------------------
1.280 +//
1.281 +EXPORT_C CSourceLocation* CSourceLocation::NewL(
1.282 + CMidiClientUtility& aUtility )
1.283 + {
1.284 +
1.285 + DEBPRN0;
1.286 + CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
1.287 + CleanupStack::PushL(customInterface);
1.288 +
1.289 + CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
1.290 +
1.291 + if ( !sourceLocationProxy )
1.292 + {
1.293 + DEBPRN1("No Adaptation Support - leaving");
1.294 + User::Leave(KErrNotSupported);
1.295 + }
1.296 +
1.297 + CleanupStack::Pop(customInterface);
1.298 +
1.299 + return sourceLocationProxy;
1.300 + }
1.301 +
1.302 +// -----------------------------------------------------------------------------
1.303 +// CSourceLocation::NewL
1.304 +// Static function for creating an instance of the SourceLocation object.
1.305 +// -----------------------------------------------------------------------------
1.306 +//
1.307 +EXPORT_C CSourceLocation* CSourceLocation::NewL(
1.308 + CDrmPlayerUtility& aUtility )
1.309 + {
1.310 +
1.311 + DEBPRN0;
1.312 + CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
1.313 + CleanupStack::PushL(customInterface);
1.314 +
1.315 + CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
1.316 +
1.317 + if ( !sourceLocationProxy )
1.318 + {
1.319 + DEBPRN1("No Adaptation Support - leaving");
1.320 + User::Leave(KErrNotSupported);
1.321 + }
1.322 +
1.323 + CleanupStack::Pop(customInterface);
1.324 +
1.325 + return sourceLocationProxy;
1.326 + }
1.327 +
1.328 +// -----------------------------------------------------------------------------
1.329 +// CSourceLocation::NewL
1.330 +// Static function for creating an instance of the SourceLocation object.
1.331 +// -----------------------------------------------------------------------------
1.332 +//
1.333 +EXPORT_C CSourceLocation* CSourceLocation::NewL(
1.334 + CVideoPlayerUtility& aUtility )
1.335 + {
1.336 +
1.337 + DEBPRN0;
1.338 + CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
1.339 + CleanupStack::PushL(customInterface);
1.340 +
1.341 + CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
1.342 +
1.343 + if ( !sourceLocationProxy )
1.344 + {
1.345 + DEBPRN1("No Adaptation Support - leaving");
1.346 + User::Leave(KErrNotSupported);
1.347 + }
1.348 +
1.349 + CleanupStack::Pop(customInterface);
1.350 +
1.351 + return sourceLocationProxy;
1.352 + }
1.353 +
1.354 +// -----------------------------------------------------------------------------
1.355 +// CSourceLocation::Uid
1.356 +// -----------------------------------------------------------------------------
1.357 +//
1.358 +EXPORT_C TUid CSourceLocation::Uid() const
1.359 + {
1.360 + return KUidSourceLocationEffect;
1.361 + }
1.362 +
1.363 +
1.364 +// ========================== OTHER EXPORTED FUNCTIONS =========================
1.365 +
1.366 +// End of File
1.367 +