os/mm/devsoundextensions/effects/SrcLocation/SourceLocationEffect/Src/SourceLocationBase.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     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".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:   Implementation of the listenerlocation effect class
    15 *
    16 */
    17 
    18 
    19 
    20 
    21 // INCLUDE FILES
    22 
    23 #ifdef _DEBUG
    24 #include <e32svr.h>
    25 #endif
    26 
    27 #include <SourceLocationBase.h>
    28 #include <CustomInterfaceUtility.h>
    29 #include "SourceLocationProxy.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>
    36 
    37 #ifdef _DEBUG
    38 #define DEBPRN0         RDebug::Printf( "%s", __PRETTY_FUNCTION__);
    39 #define DEBPRN1(str)    RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str );
    40 #else
    41 #define DEBPRN0
    42 #define DEBPRN1(str)
    43 #endif
    44 
    45 // ============================ MEMBER FUNCTIONS ===============================
    46 
    47 // -----------------------------------------------------------------------------
    48 // CSourceLocation::CSourceLocation
    49 // C++ default constructor can NOT contain any code, that
    50 // might leave.
    51 // -----------------------------------------------------------------------------
    52 //
    53 EXPORT_C CSourceLocation::CSourceLocation()
    54     {
    55     }
    56 
    57 // Destructor
    58 EXPORT_C CSourceLocation::~CSourceLocation()
    59     {
    60     }
    61 
    62 
    63 // -----------------------------------------------------------------------------
    64 // CSourceLocation::NewL
    65 // Static function for creating an instance of the SourceLocation object.
    66 // -----------------------------------------------------------------------------
    67 //
    68 EXPORT_C CSourceLocation* CSourceLocation::NewL(
    69 	CMdaAudioInputStream& aUtility )
    70 	{
    71 
    72 	DEBPRN0;
    73     CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)aUtility.CustomInterface(KUidSourceLocationEffect);
    74 
    75 	if (sourceLocationProxy == NULL)
    76 		{
    77         DEBPRN1("No Adaptation Support - leaving");
    78     	User::Leave(KErrNotSupported);
    79 		}
    80 
    81     return sourceLocationProxy;
    82 	}
    83 
    84 // -----------------------------------------------------------------------------
    85 // CSourceLocation::NewL
    86 // Static function for creating an instance of the SourceLocation object.
    87 // -----------------------------------------------------------------------------
    88 //
    89 EXPORT_C CSourceLocation* CSourceLocation::NewL(
    90 	CMdaAudioOutputStream& aUtility )
    91 	{
    92 
    93 	DEBPRN0;
    94     CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)aUtility.CustomInterface(KUidSourceLocationEffect);
    95 
    96 	if (sourceLocationProxy == NULL)
    97 		{
    98         DEBPRN1("No Adaptation Support - leaving");
    99     	User::Leave(KErrNotSupported);
   100 		}
   101 
   102     return sourceLocationProxy;
   103 	}
   104 
   105 // -----------------------------------------------------------------------------
   106 // CSourceLocation::NewL
   107 // Static function for creating an instance of the SourceLocation object.
   108 // -----------------------------------------------------------------------------
   109 //
   110 EXPORT_C CSourceLocation* CSourceLocation::NewL(
   111 	CMdaAudioConvertUtility& aUtility )
   112 	{
   113 
   114     DEBPRN0;
   115    	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
   116     CleanupStack::PushL(customInterface);
   117 
   118 	CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
   119 
   120 	if ( !sourceLocationProxy )
   121 		{
   122 		DEBPRN1("No Adaptation Support - leaving");
   123 		User::Leave(KErrNotSupported);
   124 		}
   125 
   126 	CleanupStack::Pop(customInterface);
   127 
   128     return sourceLocationProxy;
   129 	}
   130 
   131 // -----------------------------------------------------------------------------
   132 // CSourceLocation::NewL
   133 // Static function for creating an instance of the SourceLocation object.
   134 // -----------------------------------------------------------------------------
   135 //
   136 EXPORT_C CSourceLocation* CSourceLocation::NewL(
   137 	CMdaAudioPlayerUtility& aUtility )
   138 	{
   139 
   140     DEBPRN0;
   141    	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
   142     CleanupStack::PushL(customInterface);
   143 
   144 	CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
   145 
   146 	if ( !sourceLocationProxy )
   147 		{
   148 		DEBPRN1("No Adaptation Support - leaving");
   149 		User::Leave(KErrNotSupported);
   150 		}
   151 
   152 	CleanupStack::Pop(customInterface);
   153 
   154     return sourceLocationProxy;
   155 	}
   156 
   157 // -----------------------------------------------------------------------------
   158 // CSourceLocation::NewL
   159 // Static function for creating an instance of the SourceLocation object.
   160 // -----------------------------------------------------------------------------
   161 //
   162 EXPORT_C CSourceLocation* CSourceLocation::NewL(
   163 	CMdaAudioRecorderUtility& aUtility,
   164 	TBool aRecordStream )
   165 	{
   166 
   167     DEBPRN0;
   168    	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility, aRecordStream);
   169     CleanupStack::PushL(customInterface);
   170 
   171 	CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
   172 
   173 	if ( !sourceLocationProxy )
   174 		{
   175 		DEBPRN1("No Adaptation Support - leaving");
   176 		User::Leave(KErrNotSupported);
   177 		}
   178 
   179 	CleanupStack::Pop(customInterface);
   180 
   181     return sourceLocationProxy;
   182 	}
   183 
   184 // -----------------------------------------------------------------------------
   185 // CSourceLocation::NewL
   186 // Static function for creating an instance of the SourceLocation object.
   187 // -----------------------------------------------------------------------------
   188 //
   189 EXPORT_C CSourceLocation* CSourceLocation::NewL(
   190 	CMdaAudioToneUtility& aUtility)
   191 	{
   192 
   193 	DEBPRN0;
   194     CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)aUtility.CustomInterface(KUidSourceLocationEffect);
   195 
   196 	if (sourceLocationProxy == NULL)
   197 		{
   198         DEBPRN1("No Adaptation Support - leaving");
   199     	User::Leave(KErrNotSupported);
   200 		}
   201 
   202     return sourceLocationProxy;
   203 	}
   204 
   205 // -----------------------------------------------------------------------------
   206 // CSourceLocation::NewL
   207 // Static function for creating an instance of the SourceLocation object.
   208 // -----------------------------------------------------------------------------
   209 //
   210 EXPORT_C CSourceLocation* CSourceLocation::NewL(
   211 	CMMFDevSound& aDevSound )
   212 	{
   213 
   214 	DEBPRN0;
   215     CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)aDevSound.CustomInterface(KUidSourceLocationEffect);
   216 
   217 	if (sourceLocationProxy == NULL)
   218 		{
   219         DEBPRN1("No Adaptation Support - leaving");
   220     	User::Leave(KErrNotSupported);
   221 		}
   222 
   223     return sourceLocationProxy;
   224 	}
   225 
   226 // -----------------------------------------------------------------------------
   227 // CSourceLocation::NewL
   228 // Static function for creating an instance of the SourceLocation object.
   229 // -----------------------------------------------------------------------------
   230 //
   231 EXPORT_C CSourceLocation* CSourceLocation::NewL(
   232 	CCustomCommandUtility* aUtility )
   233 	{
   234 
   235     DEBPRN0;
   236    	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
   237     CleanupStack::PushL(customInterface);
   238 
   239 	CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
   240 
   241 	if ( !sourceLocationProxy )
   242 		{
   243 		DEBPRN1("No Adaptation Support - leaving");
   244 		User::Leave(KErrNotSupported);
   245 		}
   246 
   247 	CleanupStack::Pop(customInterface);
   248 
   249     return sourceLocationProxy;
   250 	}
   251 
   252 // -----------------------------------------------------------------------------
   253 // CSourceLocation::NewL
   254 // Static function for creating an instance of the SourceLocation object.
   255 // -----------------------------------------------------------------------------
   256 //
   257 EXPORT_C CSourceLocation* CSourceLocation::NewL(
   258 	MCustomInterface& aCustomInterface )
   259 	{
   260 
   261     DEBPRN0;
   262 	CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)aCustomInterface.CustomInterface(KUidSourceLocationEffect);
   263 
   264 	if ( !sourceLocationProxy )
   265 		{
   266 		DEBPRN1("No Adaptation Support - leaving");
   267 		User::Leave(KErrNotSupported);
   268 		}
   269 
   270     return sourceLocationProxy;
   271 	}
   272 
   273 // -----------------------------------------------------------------------------
   274 // CSourceLocation::NewL
   275 // Static function for creating an instance of the SourceLocation object.
   276 // -----------------------------------------------------------------------------
   277 //
   278 EXPORT_C CSourceLocation* CSourceLocation::NewL(
   279     CMidiClientUtility& aUtility )
   280 	{
   281 
   282     DEBPRN0;
   283    	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
   284     CleanupStack::PushL(customInterface);
   285 
   286 	CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
   287 
   288 	if ( !sourceLocationProxy )
   289 		{
   290 		DEBPRN1("No Adaptation Support - leaving");
   291 		User::Leave(KErrNotSupported);
   292 		}
   293 
   294 	CleanupStack::Pop(customInterface);
   295 
   296     return sourceLocationProxy;
   297 	}
   298 
   299 // -----------------------------------------------------------------------------
   300 // CSourceLocation::NewL
   301 // Static function for creating an instance of the SourceLocation object.
   302 // -----------------------------------------------------------------------------
   303 //
   304 EXPORT_C CSourceLocation* CSourceLocation::NewL(
   305     CDrmPlayerUtility& aUtility )
   306 	{
   307 
   308     DEBPRN0;
   309    	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
   310     CleanupStack::PushL(customInterface);
   311 
   312 	CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
   313 
   314 	if ( !sourceLocationProxy )
   315 		{
   316 		DEBPRN1("No Adaptation Support - leaving");
   317 		User::Leave(KErrNotSupported);
   318 		}
   319 
   320 	CleanupStack::Pop(customInterface);
   321 
   322     return sourceLocationProxy;
   323 	}
   324 
   325 // -----------------------------------------------------------------------------
   326 // CSourceLocation::NewL
   327 // Static function for creating an instance of the SourceLocation object.
   328 // -----------------------------------------------------------------------------
   329 //
   330 EXPORT_C CSourceLocation* CSourceLocation::NewL(
   331     CVideoPlayerUtility& aUtility )
   332 	{
   333 
   334     DEBPRN0;
   335    	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
   336     CleanupStack::PushL(customInterface);
   337 
   338 	CSourceLocationProxy* sourceLocationProxy = (CSourceLocationProxy*)customInterface->CustomInterface(KUidSourceLocationEffect);
   339 
   340 	if ( !sourceLocationProxy )
   341 		{
   342 		DEBPRN1("No Adaptation Support - leaving");
   343 		User::Leave(KErrNotSupported);
   344 		}
   345 
   346 	CleanupStack::Pop(customInterface);
   347 
   348     return sourceLocationProxy;
   349 	}
   350 
   351 // -----------------------------------------------------------------------------
   352 // CSourceLocation::Uid
   353 // -----------------------------------------------------------------------------
   354 //
   355 EXPORT_C TUid CSourceLocation::Uid() const
   356 	{
   357 	return KUidSourceLocationEffect;
   358 	}
   359 
   360 
   361 // ========================== OTHER EXPORTED FUNCTIONS =========================
   362 
   363 // End of File
   364