devsound/a3fdevsound/src/mmfdevsoundproxy/mmfdevsoundproxy.cpp
changeset 13 efebd1779a59
parent 0 40261b775718
child 15 c1e808730d6c
equal deleted inserted replaced
0:40261b775718 13:efebd1779a59
    15 
    15 
    16 
    16 
    17 
    17 
    18 // INCLUDE FILES
    18 // INCLUDE FILES
    19 #include "mmfdevsoundproxy.h"
    19 #include "mmfdevsoundproxy.h"
       
    20 #ifdef _DEBUG
       
    21 #include <e32debug.h>
       
    22 
       
    23 #define SYMBIAN_DEBPRN0(str)                RDebug::Print(str, this)
       
    24 #define SYMBIAN_DEBPRN1(str, val1)          RDebug::Print(str, this, val1)
       
    25 #define SYMBIAN_DEBPRN2(str, val1, val2)    RDebug::Print(str, this, val1, val2)
       
    26 #else
       
    27 #define SYMBIAN_DEBPRN0(str)
       
    28 #define SYMBIAN_DEBPRN1(str, val1)
       
    29 #define SYMBIAN_DEBPRN2(str, val1, val2)
       
    30 #endif //_DEBUG
    20 
    31 
    21 // SYMBIAN_CHECK used to add extra asserts when MACRO is added - helps debugging overall A3F
    32 // SYMBIAN_CHECK used to add extra asserts when MACRO is added - helps debugging overall A3F
    22 
    33 
    23 #ifdef SYMBIAN_FULL_STATE_CHECK
    34 #ifdef SYMBIAN_FULL_STATE_CHECK
    24    #define SYMBIAN_CHECK(c,p) __ASSERT_ALWAYS(c,p)
    35    #define SYMBIAN_CHECK(c,p) __ASSERT_ALWAYS(c,p)
    78 // (other items were commented in a header).
    89 // (other items were commented in a header).
    79 // -----------------------------------------------------------------------------
    90 // -----------------------------------------------------------------------------
    80 //
    91 //
    81 EXPORT_C void RMMFDevSoundProxy::Close()
    92 EXPORT_C void RMMFDevSoundProxy::Close()
    82 	{
    93 	{
       
    94 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Close - Enter"));
    83 	if (iAudioServerProxy)
    95 	if (iAudioServerProxy)
    84 		{
    96 		{
    85 		if (iAudioServerProxy->Handle() != NULL)
    97 		if (iAudioServerProxy->Handle() != NULL)
    86 			{
    98 			{
    87 			TMMFDevSoundProxySettings set;
    99 			TMMFDevSoundProxySettings set;
   101 		iMsgQueueHandler->Cancel();
   113 		iMsgQueueHandler->Cancel();
   102 		delete iMsgQueueHandler;
   114 		delete iMsgQueueHandler;
   103 		iMsgQueueHandler = NULL;
   115 		iMsgQueueHandler = NULL;
   104 		}
   116 		}
   105 	iMsgQueue.Close();
   117 	iMsgQueue.Close();
       
   118 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Close - Exit"));
   106 	}
   119 	}
   107 
   120 
   108 // -----------------------------------------------------------------------------
   121 // -----------------------------------------------------------------------------
   109 // RMMFDevSoundProxy::Open
   122 // RMMFDevSoundProxy::Open
   110 // Open a DevSound server session
   123 // Open a DevSound server session
   111 // (other items were commented in a header).
   124 // (other items were commented in a header).
   112 // -----------------------------------------------------------------------------
   125 // -----------------------------------------------------------------------------
   113 //
   126 //
   114 EXPORT_C TInt RMMFDevSoundProxy::Open()
   127 EXPORT_C TInt RMMFDevSoundProxy::Open()
   115 	{
   128 	{
       
   129 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Open - Enter"));
   116 	TInt err = iMsgQueue.CreateGlobal(KNullDesC, KMaxMessageQueueItems);
   130 	TInt err = iMsgQueue.CreateGlobal(KNullDesC, KMaxMessageQueueItems);
   117 	// global, accessible to all that have its handle
   131 	// global, accessible to all that have its handle
   118 	
   132 	
   119 	if (err == KErrNone)
   133 	if (err == KErrNone)
   120 		{
   134 		{
   137 		}
   151 		}
   138 	if (err)
   152 	if (err)
   139 		{	
   153 		{	
   140 		Close();
   154 		Close();
   141 		}
   155 		}
       
   156 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::Open - Exit [%d]"), err);
   142 	return err;
   157 	return err;
   143 	}
   158 	}
   144 
   159 
   145 // -----------------------------------------------------------------------------
   160 // -----------------------------------------------------------------------------
   146 // RMMFDevSoundProxy::PostOpen
   161 // RMMFDevSoundProxy::PostOpen
   147 // Finish opening process
   162 // Finish opening process
   148 // -----------------------------------------------------------------------------
   163 // -----------------------------------------------------------------------------
   149 //
   164 //
   150 EXPORT_C TInt RMMFDevSoundProxy::PostOpen()
   165 EXPORT_C TInt RMMFDevSoundProxy::PostOpen()
   151 	{
   166 	{
   152 	return SendReceive(EMMFDevSoundProxyPostOpen, iDestinationPckg);
   167 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PostOpen - Enter"));
       
   168 	TInt err = SendReceive(EMMFDevSoundProxyPostOpen, iDestinationPckg);
       
   169 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::PostOpen - Exit [%d]"), err);
       
   170 	return err;
   153 	}
   171 	}
   154 
   172 
   155 
   173 
   156 // -----------------------------------------------------------------------------
   174 // -----------------------------------------------------------------------------
   157 // RMMFDevSoundProxy::SetDevSoundInfo
   175 // RMMFDevSoundProxy::SetDevSoundInfo
   159 // (other items were commented in a header).
   177 // (other items were commented in a header).
   160 // -----------------------------------------------------------------------------
   178 // -----------------------------------------------------------------------------
   161 //
   179 //
   162 EXPORT_C TInt RMMFDevSoundProxy::SetDevSoundInfo()
   180 EXPORT_C TInt RMMFDevSoundProxy::SetDevSoundInfo()
   163 	{
   181 	{
   164 	return SendReceive(EMMFAudioLaunchRequests);
   182 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetDevSoundInfo - Enter"));
       
   183 	TInt err = SendReceive(EMMFAudioLaunchRequests);
       
   184 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetDevSoundInfo - Exit [%d]"), err);
       
   185 	return err;
   165 	}
   186 	}
   166 
   187 
   167 // -----------------------------------------------------------------------------
   188 // -----------------------------------------------------------------------------
   168 // RMMFDevSoundProxy::InitializeL
   189 // RMMFDevSoundProxy::InitializeL
   169 // Initialize DevSound for a specific mode.
   190 // Initialize DevSound for a specific mode.
   173 EXPORT_C void RMMFDevSoundProxy::InitializeL(
   194 EXPORT_C void RMMFDevSoundProxy::InitializeL(
   174 							MDevSoundObserver& aDevSoundObserver,
   195 							MDevSoundObserver& aDevSoundObserver,
   175 							TMMFState aMode,
   196 							TMMFState aMode,
   176 							MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver)
   197 							MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver)
   177 	{
   198 	{
       
   199 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::InitializeL - Enter"));
   178 	TInt err = KErrNone;
   200 	TInt err = KErrNone;
   179 	iDevSoundObserver = &aDevSoundObserver;
   201 	iDevSoundObserver = &aDevSoundObserver;
   180 	
   202 	
   181 	if (!(iState==EIdle || iState==EInitialized))
   203 	if (!(iState==EIdle || iState==EInitialized))
   182 		{
   204 		{
   193 			{
   215 			{
   194 			StartReceivingMsgQueueHandlerEventsL(aDevSoundCIObserver);
   216 			StartReceivingMsgQueueHandlerEventsL(aDevSoundCIObserver);
   195 			iState = EInitializing;
   217 			iState = EInitializing;
   196 			}	
   218 			}	
   197 		}
   219 		}
   198 	
   220 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::InitializeL - Exit [%d]"), err);
   199 	User::LeaveIfError(err);
   221 	User::LeaveIfError(err);
   200 	}
   222 	}
   201 
   223 
   202 // -----------------------------------------------------------------------------
   224 // -----------------------------------------------------------------------------
   203 // RMMFDevSoundProxy::InitializeL
   225 // RMMFDevSoundProxy::InitializeL
   225 								MDevSoundObserver& aDevSoundObserver,
   247 								MDevSoundObserver& aDevSoundObserver,
   226 								TFourCC aDesiredFourCC,
   248 								TFourCC aDesiredFourCC,
   227 								TMMFState aMode,
   249 								TMMFState aMode,
   228 								MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver)
   250 								MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver)
   229 	{
   251 	{
       
   252 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::InitializeL - Enter"));
   230 	TInt err = KErrNone;
   253 	TInt err = KErrNone;
   231 	if(aMode == EMMFStateTonePlaying)
   254 	if(aMode == EMMFStateTonePlaying)
   232 		{
   255 		{
   233 		User::Leave(KErrNotSupported);
   256 		User::Leave(KErrNotSupported);
   234 		}
   257 		}
   249 			{
   272 			{
   250 			StartReceivingMsgQueueHandlerEventsL(aDevSoundCIObserver);
   273 			StartReceivingMsgQueueHandlerEventsL(aDevSoundCIObserver);
   251 			iState = EInitializing;
   274 			iState = EInitializing;
   252 			}	
   275 			}	
   253 		}
   276 		}
   254 
   277 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::InitializeL - Exit [%d]"), err);
   255 	User::LeaveIfError(err);
   278 	User::LeaveIfError(err);
   256 	}
   279 	}
   257 
   280 
   258 // -----------------------------------------------------------------------------
   281 // -----------------------------------------------------------------------------
   259 // RMMFDevSoundProxy::Capabilities
   282 // RMMFDevSoundProxy::Capabilities
   261 // (other items were commented in a header).
   284 // (other items were commented in a header).
   262 // -----------------------------------------------------------------------------
   285 // -----------------------------------------------------------------------------
   263 //
   286 //
   264 EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Capabilities()
   287 EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Capabilities()
   265 	{
   288 	{
       
   289 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Capabilities - Enter"));
   266 	// TODO should we use the following ? SYMBIAN_CHECK(iState>=EInitialized, Panic(EMMFDevSoundProxyCapabilitiesInWrongState));
   290 	// TODO should we use the following ? SYMBIAN_CHECK(iState>=EInitialized, Panic(EMMFDevSoundProxyCapabilitiesInWrongState));
   267 	if (iState < EInitialized)
   291 	if (iState < EInitialized)
   268 		{
   292 		{
   269 		// call has been made before we are initialized. Not much we can do, so return
   293 		// call has been made before we are initialized. Not much we can do, so return
   270 		// dummy values but hit debugger on the emulator
   294 		// dummy values but hit debugger on the emulator
   271 		__DEBUGGER()
   295 		__DEBUGGER()
   272 		RDebug::Print(_L("BRDBG:CapabilitiesCalledWhenNotInitialised")); // TODO Remove or redo as trace				
   296 		RDebug::Print(_L("BRDBG:CapabilitiesCalledWhenNotInitialised")); // TODO Remove or redo as trace
       
   297 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Capabilities - Exit"));
   273 		return KZeroCapabilities;
   298 		return KZeroCapabilities;
   274 		}
   299 		}
   275 	TMMFDevSoundProxySettings set;
   300 	TMMFDevSoundProxySettings set;
   276 	TMMFDevSoundProxySettingsPckg pckg(set);
   301 	TMMFDevSoundProxySettingsPckg pckg(set);
   277 	TInt err = SendReceiveResult(EMMFDevSoundProxyCapabilities,
   302 	TInt err = SendReceiveResult(EMMFDevSoundProxyCapabilities,
   278 					iDestinationPckg,
   303 					iDestinationPckg,
   279 					KNullDesC8,
   304 					KNullDesC8,
   280 					pckg);
   305 					pckg);
   281 	if (err == KErrNone)
   306 	if (err == KErrNone)
   282 		{
   307 		{
       
   308 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Capabilities - Exit"));
   283 		return pckg().iCaps;
   309 		return pckg().iCaps;
   284 		}
   310 		}
   285 	else
   311 	else
   286 		{
   312 		{
       
   313 		SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::Capabilities - Exit [%d]"), err);
   287 		return KZeroCapabilities;
   314 		return KZeroCapabilities;
   288 		}
   315 		}
   289 	}
   316 	}
   290 
   317 
   291 // -----------------------------------------------------------------------------
   318 // -----------------------------------------------------------------------------
   294 // (other items were commented in a header).
   321 // (other items were commented in a header).
   295 // -----------------------------------------------------------------------------
   322 // -----------------------------------------------------------------------------
   296 //
   323 //
   297 EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Config()
   324 EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Config()
   298 	{
   325 	{
       
   326 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Config - Enter"));
   299 	// TODO should we use the following ? SYMBIAN_CHECK(iState>=EInitialized, Panic(EMMFDevSoundProxyConfigInWrongState));
   327 	// TODO should we use the following ? SYMBIAN_CHECK(iState>=EInitialized, Panic(EMMFDevSoundProxyConfigInWrongState));
   300 	if (iState < EInitialized)
   328 	if (iState < EInitialized)
   301 		{
   329 		{
   302 		// call has been made before we are initialized. Not much we can do, so return
   330 		// call has been made before we are initialized. Not much we can do, so return
   303 		// dummy values but hit debugger on the emulator
   331 		// dummy values but hit debugger on the emulator
   304 		__DEBUGGER()
   332 		__DEBUGGER()
   305 		RDebug::Print(_L("BRDBG:ConfigCalledWhenNotInitialised")); // TODO Remove or redo as trace				
   333 		RDebug::Print(_L("BRDBG:ConfigCalledWhenNotInitialised")); // TODO Remove or redo as trace
       
   334 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Config - Exit"));
   306 		return KZeroCapabilities;
   335 		return KZeroCapabilities;
   307 		}
   336 		}
   308 	TMMFDevSoundProxySettings set;
   337 	TMMFDevSoundProxySettings set;
   309 	TMMFDevSoundProxySettingsPckg pckg(set);
   338 	TMMFDevSoundProxySettingsPckg pckg(set);
   310 	SendReceiveResult(EMMFDevSoundProxyConfig,
   339 	SendReceiveResult(EMMFDevSoundProxyConfig,
   311 					iDestinationPckg,
   340 					iDestinationPckg,
   312 					KNullDesC8,
   341 					KNullDesC8,
   313 					pckg);
   342 					pckg);
       
   343 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Config - Exit"));
   314 	return pckg().iConfig;
   344 	return pckg().iConfig;
   315 	}
   345 	}
   316 
   346 
   317 // -----------------------------------------------------------------------------
   347 // -----------------------------------------------------------------------------
   318 // RMMFDevSoundProxy::SetConfigL
   348 // RMMFDevSoundProxy::SetConfigL
   321 // -----------------------------------------------------------------------------
   351 // -----------------------------------------------------------------------------
   322 //
   352 //
   323 EXPORT_C void RMMFDevSoundProxy::SetConfigL(
   353 EXPORT_C void RMMFDevSoundProxy::SetConfigL(
   324 	const TMMFCapabilities& aConfig )
   354 	const TMMFCapabilities& aConfig )
   325 	{
   355 	{
       
   356 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetConfigL - Enter"));
   326 	TInt err = KErrNone;
   357 	TInt err = KErrNone;
   327 	
   358 	
   328 	if (iState==EInitialized)
   359 	if (iState==EInitialized)
   329 		{
   360 		{
   330 		TMMFDevSoundProxySettings set;
   361 		TMMFDevSoundProxySettings set;
   331 		set.iConfig = aConfig;
   362 		set.iConfig = aConfig;
   332 		TMMFDevSoundProxySettingsPckg pckg(set);
   363 		TMMFDevSoundProxySettingsPckg pckg(set);
   333 		TInt err = SendReceive(EMMFDevSoundProxySetConfig,
   364 		err = SendReceive(EMMFDevSoundProxySetConfig,
   334 							iDestinationPckg,
   365 							iDestinationPckg,
   335 							pckg);
   366 							pckg);
   336 		User::LeaveIfError(err);
       
   337 		}
   367 		}
   338 	else
   368 	else
   339 		{
   369 		{
   340 		RDebug::Print(_L("BRDBG:SetConfigCalledWhenNotInitialised")); // TODO Remove or redo as trace				
   370 		RDebug::Print(_L("BRDBG:SetConfigCalledWhenNotInitialised")); // TODO Remove or redo as trace				
   341 		err = KErrNotReady;
   371 		err = KErrNotReady;
   342 		}
   372 		}
   343 
   373 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetConfigL - Exit [%d]"), err);
   344 	User::LeaveIfError(err);
   374 	User::LeaveIfError(err);
   345 	}
   375 	}
   346 
   376 
   347 // -----------------------------------------------------------------------------
   377 // -----------------------------------------------------------------------------
   348 // RMMFDevSoundProxy::MaxVolume
   378 // RMMFDevSoundProxy::MaxVolume
   350 // (other items were commented in a header).
   380 // (other items were commented in a header).
   351 // -----------------------------------------------------------------------------
   381 // -----------------------------------------------------------------------------
   352 //
   382 //
   353 EXPORT_C TInt RMMFDevSoundProxy::MaxVolume()
   383 EXPORT_C TInt RMMFDevSoundProxy::MaxVolume()
   354 	{
   384 	{
       
   385 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::MaxVolume - Enter"));
   355 	TMMFDevSoundProxySettings set;
   386 	TMMFDevSoundProxySettings set;
   356 	TMMFDevSoundProxySettingsPckg pckg(set);
   387 	TMMFDevSoundProxySettingsPckg pckg(set);
   357 	SendReceiveResult(EMMFDevSoundProxyMaxVolume,
   388 	SendReceiveResult(EMMFDevSoundProxyMaxVolume,
   358 					iDestinationPckg,
   389 					iDestinationPckg,
   359 					KNullDesC8,
   390 					KNullDesC8,
   360 					pckg);
   391 					pckg);
       
   392 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::MaxVolume - Exit"));
   361 	return pckg().iMaxVolume;
   393 	return pckg().iMaxVolume;
   362 	}
   394 	}
   363 
   395 
   364 // -----------------------------------------------------------------------------
   396 // -----------------------------------------------------------------------------
   365 // RMMFDevSoundProxy::Volume
   397 // RMMFDevSoundProxy::Volume
   367 // (other items were commented in a header).
   399 // (other items were commented in a header).
   368 // -----------------------------------------------------------------------------
   400 // -----------------------------------------------------------------------------
   369 //
   401 //
   370 EXPORT_C TInt RMMFDevSoundProxy::Volume()
   402 EXPORT_C TInt RMMFDevSoundProxy::Volume()
   371 	{
   403 	{
       
   404 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Volume - Enter"));
   372 	TMMFDevSoundProxySettings set;
   405 	TMMFDevSoundProxySettings set;
   373 	TMMFDevSoundProxySettingsPckg pckg(set);
   406 	TMMFDevSoundProxySettingsPckg pckg(set);
   374 	SendReceiveResult(EMMFDevSoundProxyVolume,
   407 	SendReceiveResult(EMMFDevSoundProxyVolume,
   375 					iDestinationPckg,
   408 					iDestinationPckg,
   376 					KNullDesC8,
   409 					KNullDesC8,
   377 					pckg);
   410 					pckg);
       
   411 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Volume - Exit"));
   378 	return pckg().iVolume;
   412 	return pckg().iVolume;
   379 	}
   413 	}
   380 
   414 
   381 // -----------------------------------------------------------------------------
   415 // -----------------------------------------------------------------------------
   382 // RMMFDevSoundProxy::SetVolume
   416 // RMMFDevSoundProxy::SetVolume
   384 // (other items were commented in a header).
   418 // (other items were commented in a header).
   385 // -----------------------------------------------------------------------------
   419 // -----------------------------------------------------------------------------
   386 //
   420 //
   387 EXPORT_C TInt RMMFDevSoundProxy::SetVolume(TInt aVolume )
   421 EXPORT_C TInt RMMFDevSoundProxy::SetVolume(TInt aVolume )
   388 	{
   422 	{
       
   423 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetVolume - Enter"));
   389 	TMMFDevSoundProxySettings set;
   424 	TMMFDevSoundProxySettings set;
   390 	set.iVolume = aVolume;
   425 	set.iVolume = aVolume;
   391 	TMMFDevSoundProxySettingsPckg pckg(set);
   426 	TMMFDevSoundProxySettingsPckg pckg(set);
   392 	return SendReceive(EMMFDevSoundProxySetVolume,
   427 	TInt err = SendReceive(EMMFDevSoundProxySetVolume,
   393 					iDestinationPckg,
   428 					iDestinationPckg,
   394 					pckg);
   429 					pckg);
       
   430 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetVolume - Exit [%d]"), err);
       
   431 	return err;
   395 	}
   432 	}
   396 
   433 
   397 // -----------------------------------------------------------------------------
   434 // -----------------------------------------------------------------------------
   398 // RMMFDevSoundProxy::MaxGain
   435 // RMMFDevSoundProxy::MaxGain
   399 // Returns maximum gain supported by DevSound server for recording.
   436 // Returns maximum gain supported by DevSound server for recording.
   400 // (other items were commented in a header).
   437 // (other items were commented in a header).
   401 // -----------------------------------------------------------------------------
   438 // -----------------------------------------------------------------------------
   402 //
   439 //
   403 EXPORT_C TInt RMMFDevSoundProxy::MaxGain()
   440 EXPORT_C TInt RMMFDevSoundProxy::MaxGain()
   404 	{
   441 	{
       
   442 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::MaxGain - Enter"));
   405 	TMMFDevSoundProxySettings set;
   443 	TMMFDevSoundProxySettings set;
   406 	TMMFDevSoundProxySettingsPckg pckg(set);
   444 	TMMFDevSoundProxySettingsPckg pckg(set);
   407 	SendReceiveResult(EMMFDevSoundProxyMaxGain,
   445 	SendReceiveResult(EMMFDevSoundProxyMaxGain,
   408 					iDestinationPckg,
   446 					iDestinationPckg,
   409 					KNullDesC8,
   447 					KNullDesC8,
   410 					pckg);
   448 					pckg);
       
   449 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::MaxGain - Exit"));
   411 	return pckg().iMaxGain;
   450 	return pckg().iMaxGain;
   412 	}
   451 	}
   413 
   452 
   414 // -----------------------------------------------------------------------------
   453 // -----------------------------------------------------------------------------
   415 // RMMFDevSoundProxy::Gain
   454 // RMMFDevSoundProxy::Gain
   417 // (other items were commented in a header).
   456 // (other items were commented in a header).
   418 // -----------------------------------------------------------------------------
   457 // -----------------------------------------------------------------------------
   419 //
   458 //
   420 EXPORT_C TInt RMMFDevSoundProxy::Gain()
   459 EXPORT_C TInt RMMFDevSoundProxy::Gain()
   421 	{
   460 	{
       
   461 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Gain - Enter"));
   422 	TMMFDevSoundProxySettings set;
   462 	TMMFDevSoundProxySettings set;
   423 	TMMFDevSoundProxySettingsPckg pckg(set);
   463 	TMMFDevSoundProxySettingsPckg pckg(set);
   424 	SendReceiveResult(EMMFDevSoundProxyGain,
   464 	SendReceiveResult(EMMFDevSoundProxyGain,
   425 				iDestinationPckg,
   465 				iDestinationPckg,
   426 				KNullDesC8,
   466 				KNullDesC8,
   427 				pckg);
   467 				pckg);
       
   468 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Gain - Exit"));
   428 	return pckg().iGain;
   469 	return pckg().iGain;
   429 	}
   470 	}
   430 
   471 
   431 // -----------------------------------------------------------------------------
   472 // -----------------------------------------------------------------------------
   432 // RMMFDevSoundProxy::SetGain
   473 // RMMFDevSoundProxy::SetGain
   435 // -----------------------------------------------------------------------------
   476 // -----------------------------------------------------------------------------
   436 //
   477 //
   437 EXPORT_C TInt RMMFDevSoundProxy::SetGain(
   478 EXPORT_C TInt RMMFDevSoundProxy::SetGain(
   438 	TInt aGain )
   479 	TInt aGain )
   439 	{
   480 	{
       
   481 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetGain - Enter"));
   440 	TMMFDevSoundProxySettings set;
   482 	TMMFDevSoundProxySettings set;
   441 	set.iGain = aGain;
   483 	set.iGain = aGain;
   442 	TMMFDevSoundProxySettingsPckg pckg(set);
   484 	TMMFDevSoundProxySettingsPckg pckg(set);
   443 	return SendReceive(EMMFDevSoundProxySetGain,
   485 
       
   486 	TInt err = SendReceive(EMMFDevSoundProxySetGain,
   444 					iDestinationPckg,
   487 					iDestinationPckg,
   445 					pckg);
   488 					pckg);
       
   489 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetGain - Exit [%d]"), err);
       
   490 	return err;
   446 	}
   491 	}
   447 
   492 
   448 // -----------------------------------------------------------------------------
   493 // -----------------------------------------------------------------------------
   449 // RMMFDevSoundProxy::GetPlayBalanceL
   494 // RMMFDevSoundProxy::GetPlayBalanceL
   450 // Returns play balance.
   495 // Returns play balance.
   453 //
   498 //
   454 EXPORT_C void RMMFDevSoundProxy::GetPlayBalanceL(
   499 EXPORT_C void RMMFDevSoundProxy::GetPlayBalanceL(
   455 		TInt& aLeftPercentage,
   500 		TInt& aLeftPercentage,
   456 		TInt& aRightPercentage )
   501 		TInt& aRightPercentage )
   457 	{
   502 	{
       
   503 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetPlayBalanceL - Enter"));
   458 	TMMFDevSoundProxySettings set;
   504 	TMMFDevSoundProxySettings set;
   459 	TMMFDevSoundProxySettingsPckg pckg(set);
   505 	TMMFDevSoundProxySettingsPckg pckg(set);
   460 	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyPlayBalance,
   506 	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyPlayBalance,
   461 									iDestinationPckg,
   507 									iDestinationPckg,
   462 									KNullDesC8,
   508 									KNullDesC8,
   463 									pckg));
   509 									pckg));
   464 	aLeftPercentage = pckg().iLeftPercentage;
   510 	aLeftPercentage = pckg().iLeftPercentage;
   465 	aRightPercentage = pckg().iRightPercentage;
   511 	aRightPercentage = pckg().iRightPercentage;
       
   512 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetPlayBalanceL - Exit"));
   466 	}
   513 	}
   467 
   514 
   468 // -----------------------------------------------------------------------------
   515 // -----------------------------------------------------------------------------
   469 // RMMFDevSoundProxy::SetPlayBalanceL
   516 // RMMFDevSoundProxy::SetPlayBalanceL
   470 // Sets playbalance.
   517 // Sets playbalance.
   473 //
   520 //
   474 EXPORT_C void RMMFDevSoundProxy::SetPlayBalanceL(
   521 EXPORT_C void RMMFDevSoundProxy::SetPlayBalanceL(
   475 					TInt aLeftPercentage,
   522 					TInt aLeftPercentage,
   476 					TInt aRightPercentage )
   523 					TInt aRightPercentage )
   477 	{
   524 	{
       
   525 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetPlayBalanceL - Enter"));
   478 	TMMFDevSoundProxySettings set;
   526 	TMMFDevSoundProxySettings set;
   479 	set.iLeftPercentage = aLeftPercentage;
   527 	set.iLeftPercentage = aLeftPercentage;
   480 	set.iRightPercentage = aRightPercentage;
   528 	set.iRightPercentage = aRightPercentage;
   481 	TMMFDevSoundProxySettingsPckg pckg(set);
   529 	TMMFDevSoundProxySettingsPckg pckg(set);
   482 	User::LeaveIfError(SendReceive(EMMFDevSoundProxySetPlayBalance,
   530 	User::LeaveIfError(SendReceive(EMMFDevSoundProxySetPlayBalance,
   483 								iDestinationPckg,
   531 								iDestinationPckg,
   484 								pckg));
   532 								pckg));
       
   533 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetPlayBalanceL - Exit"));
   485 	}
   534 	}
   486 
   535 
   487 // -----------------------------------------------------------------------------
   536 // -----------------------------------------------------------------------------
   488 // RMMFDevSoundProxy::GetRecordBalanceL
   537 // RMMFDevSoundProxy::GetRecordBalanceL
   489 // Returns record balance.
   538 // Returns record balance.
   492 //
   541 //
   493 EXPORT_C void RMMFDevSoundProxy::GetRecordBalanceL(
   542 EXPORT_C void RMMFDevSoundProxy::GetRecordBalanceL(
   494 					TInt& aLeftPercentage,
   543 					TInt& aLeftPercentage,
   495 					TInt& aRightPercentage )
   544 					TInt& aRightPercentage )
   496 	{
   545 	{
       
   546 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetRecordBalanceL - Enter"));
   497 	TMMFDevSoundProxySettings set;
   547 	TMMFDevSoundProxySettings set;
   498 	TMMFDevSoundProxySettingsPckg pckg(set);
   548 	TMMFDevSoundProxySettingsPckg pckg(set);
   499 	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyRecordBalance,
   549 	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyRecordBalance,
   500 										iDestinationPckg,
   550 										iDestinationPckg,
   501 										KNullDesC8,
   551 										KNullDesC8,
   502 										pckg));
   552 										pckg));
   503 	aLeftPercentage = pckg().iLeftPercentage;
   553 	aLeftPercentage = pckg().iLeftPercentage;
   504 	aRightPercentage = pckg().iRightPercentage;
   554 	aRightPercentage = pckg().iRightPercentage;
       
   555 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetRecordBalanceL - Exit"));
   505 	}
   556 	}
   506 
   557 
   507 // -----------------------------------------------------------------------------
   558 // -----------------------------------------------------------------------------
   508 // RMMFDevSoundProxy::SetRecordBalanceL
   559 // RMMFDevSoundProxy::SetRecordBalanceL
   509 // Sets record balance.
   560 // Sets record balance.
   512 //
   563 //
   513 EXPORT_C void RMMFDevSoundProxy::SetRecordBalanceL(
   564 EXPORT_C void RMMFDevSoundProxy::SetRecordBalanceL(
   514 				TInt aLeftPercentage,
   565 				TInt aLeftPercentage,
   515 				TInt aRightPercentage )
   566 				TInt aRightPercentage )
   516 	{
   567 	{
       
   568 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetRecordBalanceL - Enter"));
   517 	TMMFDevSoundProxySettings set;
   569 	TMMFDevSoundProxySettings set;
   518 	set.iLeftPercentage = aLeftPercentage;
   570 	set.iLeftPercentage = aLeftPercentage;
   519 	set.iRightPercentage = aRightPercentage;
   571 	set.iRightPercentage = aRightPercentage;
   520 	TMMFDevSoundProxySettingsPckg pckg(set);
   572 	TMMFDevSoundProxySettingsPckg pckg(set);
   521 	User::LeaveIfError(SendReceive(EMMFDevSoundProxySetRecordBalance,
   573 	User::LeaveIfError(SendReceive(EMMFDevSoundProxySetRecordBalance,
   522 									iDestinationPckg,
   574 									iDestinationPckg,
   523 									pckg));
   575 									pckg));
       
   576 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetRecordBalanceL - Exit"));
   524 	}
   577 	}
   525 
   578 
   526 // -----------------------------------------------------------------------------
   579 // -----------------------------------------------------------------------------
   527 // RMMFDevSoundProxy::PlayInitL
   580 // RMMFDevSoundProxy::PlayInitL
   528 // Initilaizes DevSound to play digital audio and starts the play process.
   581 // Initilaizes DevSound to play digital audio and starts the play process.
   529 // (other items were commented in a header).
   582 // (other items were commented in a header).
   530 // -----------------------------------------------------------------------------
   583 // -----------------------------------------------------------------------------
   531 //
   584 //
   532 EXPORT_C void RMMFDevSoundProxy::PlayInitL()
   585 EXPORT_C void RMMFDevSoundProxy::PlayInitL()
   533 	{
   586 	{
       
   587 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayInitL - Enter"));
   534 	if (!iDevSoundObserver || iState!=EInitialized)
   588 	if (!iDevSoundObserver || iState!=EInitialized)
   535 		{
   589 		{
   536 		if (iState == EPlaying || iState == EPlayingBufferWait)
   590 		if (iState == EPlaying || iState == EPlayingBufferWait)
   537 		    {
   591 		    {
   538 		    // treat PlayInitL() during play as Resume()
   592 		    // treat PlayInitL() during play as Resume()
   539 		    User::LeaveIfError(Resume());
   593 		    User::LeaveIfError(Resume());
       
   594 		    SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayInitL - Exit"));
   540 		    return;
   595 		    return;
   541 		    }
   596 		    }
   542 		User::Leave(KErrNotReady);
   597 		User::Leave(KErrNotReady);
   543 		}
   598 		}
   544 
   599 
   545 	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayInit,
   600 	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayInit,
   546 							iDestinationPckg));
   601 							iDestinationPckg));
   547 	iState = EPlaying;
   602 	iState = EPlaying;
       
   603 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayInitL - Exit"));
   548 	}
   604 	}
   549 
   605 
   550 // -----------------------------------------------------------------------------
   606 // -----------------------------------------------------------------------------
   551 // RMMFDevSoundProxy::RecordInitL
   607 // RMMFDevSoundProxy::RecordInitL
   552 // Initilaizes DevSound to record digital audio and starts the record process.
   608 // Initilaizes DevSound to record digital audio and starts the record process.
   553 // (other items were commented in a header).
   609 // (other items were commented in a header).
   554 // -----------------------------------------------------------------------------
   610 // -----------------------------------------------------------------------------
   555 //
   611 //
   556 EXPORT_C void RMMFDevSoundProxy::RecordInitL()
   612 EXPORT_C void RMMFDevSoundProxy::RecordInitL()
   557 	{
   613 	{
       
   614 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordInitL - Enter"));
   558 	if (!iDevSoundObserver || iState!=EInitialized)
   615 	if (!iDevSoundObserver || iState!=EInitialized)
   559 		{
   616 		{
   560 		if(iState == ERecording || iState == ERecordingBufferWait || iState == ERecordingInLastBufferCycle 
   617 		if(iState == ERecording || iState == ERecordingBufferWait || iState == ERecordingInLastBufferCycle 
   561                                                                   || iState == ERecordingResumingInLastBufferCycle)
   618                                                                   || iState == ERecordingResumingInLastBufferCycle)
   562 		    { 
   619 		    { 
   563 		    // treat RecordInitL() during record as Resume()
   620 		    // treat RecordInitL() during record as Resume()
   564             User::LeaveIfError(Resume());
   621             User::LeaveIfError(Resume());
       
   622             SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordInitL - Exit"));
   565             return;
   623             return;
   566 		    }
   624 		    }
   567         User::Leave(KErrNotReady);
   625         User::Leave(KErrNotReady);
   568         }
   626         }
   569 	
   627 	
   570 	User::LeaveIfError(SendReceive(EMMFDevSoundProxyRecordInit,
   628 	User::LeaveIfError(SendReceive(EMMFDevSoundProxyRecordInit,
   571 								iDestinationPckg));
   629 								iDestinationPckg));
   572 	iState = ERecording;
   630 	iState = ERecording;
       
   631 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordInitL - Exit"));
   573 	}
   632 	}
   574 
   633 
   575 // -----------------------------------------------------------------------------
   634 // -----------------------------------------------------------------------------
   576 // RMMFDevSoundProxy::PlayData
   635 // RMMFDevSoundProxy::PlayData
   577 // Plays the data in the buffer at the current volume.
   636 // Plays the data in the buffer at the current volume.
   578 // (other items were commented in a header).
   637 // (other items were commented in a header).
   579 // -----------------------------------------------------------------------------
   638 // -----------------------------------------------------------------------------
   580 //
   639 //
   581 EXPORT_C void RMMFDevSoundProxy::PlayData()
   640 EXPORT_C void RMMFDevSoundProxy::PlayData()
   582 	{
   641 	{
       
   642 	//SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayData - Enter")); //Uncommenting this will produce a lot of logging!
   583 	__ASSERT_ALWAYS(iState == EPlaying || iState == EPlayingBufferWait,
   643 	__ASSERT_ALWAYS(iState == EPlaying || iState == EPlayingBufferWait,
   584 				Panic(EMMFDevSoundProxyPlayDataWithoutInitialize));
   644 				Panic(EMMFDevSoundProxyPlayDataWithoutInitialize));
   585 	ASSERT(iDevSoundObserver);
   645 	ASSERT(iDevSoundObserver);
   586 	SYMBIAN_CHECK( iState == EPlayingBufferWait,
   646 	SYMBIAN_CHECK( iState == EPlayingBufferWait,
   587 				Panic(EMMFDevSoundProxyPlayDataInWrongState));
   647 				Panic(EMMFDevSoundProxyPlayDataInWrongState));
   590 	set.iBufferSize = iBuffer->Data().Size();
   650 	set.iBufferSize = iBuffer->Data().Size();
   591 	TMMFDevSoundProxyHwBufPckg pckg(set);
   651 	TMMFDevSoundProxyHwBufPckg pckg(set);
   592 
   652 
   593 	SendReceive(EMMFDevSoundProxyPlayData, iDestinationPckg, pckg);
   653 	SendReceive(EMMFDevSoundProxyPlayData, iDestinationPckg, pckg);
   594 	iState = EPlaying;
   654 	iState = EPlaying;
       
   655 	//SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayData - Exit")); //Uncommenting this will produce a lot of logging!
   595 	}
   656 	}
   596 
   657 
   597 // -----------------------------------------------------------------------------
   658 // -----------------------------------------------------------------------------
   598 // RMMFDevSoundProxy::RecordData
   659 // RMMFDevSoundProxy::RecordData
   599 // Signals the device to continue recording.
   660 // Signals the device to continue recording.
   600 // (other items were commented in a header).
   661 // (other items were commented in a header).
   601 // -----------------------------------------------------------------------------
   662 // -----------------------------------------------------------------------------
   602 //
   663 //
   603 EXPORT_C void RMMFDevSoundProxy::RecordData()
   664 EXPORT_C void RMMFDevSoundProxy::RecordData()
   604 	{
   665 	{
       
   666 	//SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordData - Enter")); //Uncommenting this will produce a lot of logging!
   605 	__ASSERT_ALWAYS(iState == ERecording || iState == ERecordingBufferWait ||
   667 	__ASSERT_ALWAYS(iState == ERecording || iState == ERecordingBufferWait ||
   606                     iState == ERecordingInLastBufferCycle || iState == ERecordingResumingInLastBufferCycle,
   668                     iState == ERecordingInLastBufferCycle || iState == ERecordingResumingInLastBufferCycle,
   607 					Panic(EMMFDevSoundProxyRecordDataWithoutInitialize));
   669 					Panic(EMMFDevSoundProxyRecordDataWithoutInitialize));
   608 	ASSERT(iDevSoundObserver);
   670 	ASSERT(iDevSoundObserver);
   609 	SYMBIAN_CHECK(iState == ERecordingBufferWait || iState == ERecordingInLastBufferCycle ||
   671 	SYMBIAN_CHECK(iState == ERecordingBufferWait || iState == ERecordingInLastBufferCycle ||
   624 	        // this is a RecordData() following a Resume() in the last cycle. This is where we do the resume!
   686 	        // this is a RecordData() following a Resume() in the last cycle. This is where we do the resume!
   625 	        SendReceive(EMMFDevSoundProxyResume, iDestinationPckg); // note ignore any error
   687 	        SendReceive(EMMFDevSoundProxyResume, iDestinationPckg); // note ignore any error
   626 	        iState = ERecording;
   688 	        iState = ERecording;
   627 	        break;
   689 	        break;
   628 	    }
   690 	    }
       
   691 	//SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordData - Exit")); //Uncommenting this will produce a lot of logging!
   629 	}
   692 	}
   630 
   693 
   631 // -----------------------------------------------------------------------------
   694 // -----------------------------------------------------------------------------
   632 // RMMFDevSoundProxy::Stop
   695 // RMMFDevSoundProxy::Stop
   633 // Stops the ongoing opeartion.
   696 // Stops the ongoing opeartion.
   634 // (other items were commented in a header).
   697 // (other items were commented in a header).
   635 // -----------------------------------------------------------------------------
   698 // -----------------------------------------------------------------------------
   636 //
   699 //
   637 EXPORT_C void RMMFDevSoundProxy::Stop()
   700 EXPORT_C void RMMFDevSoundProxy::Stop()
   638 	{	
   701 	{
       
   702 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Stop - Enter"));
   639 	if (iState > EInitialized)
   703 	if (iState > EInitialized)
   640 		{
   704 		{
   641 		SendReceive(EMMFDevSoundProxyStop, iDestinationPckg);
   705 		SendReceive(EMMFDevSoundProxyStop, iDestinationPckg);
   642 		iState = EInitialized;	
   706 		iState = EInitialized;	
   643 		iMsgQueueHandler->Finish(); // will delete the buffer
   707 		iMsgQueueHandler->Finish(); // will delete the buffer
   644 		}
   708 		}
       
   709 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Stop - Exit"));
   645 	}
   710 	}
   646 
   711 
   647 // -----------------------------------------------------------------------------
   712 // -----------------------------------------------------------------------------
   648 // RMMFDevSoundProxy::Pause
   713 // RMMFDevSoundProxy::Pause
   649 // Temporarily stops the ongoing operation.
   714 // Temporarily stops the ongoing operation.
   650 // (other items were commented in a header).
   715 // (other items were commented in a header).
   651 // -----------------------------------------------------------------------------
   716 // -----------------------------------------------------------------------------
   652 //
   717 //
   653 EXPORT_C void RMMFDevSoundProxy::Pause()
   718 EXPORT_C void RMMFDevSoundProxy::Pause()
   654 	{
   719 	{
       
   720 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Pause - Enter"));
   655 	if(iState > EInitialized)
   721 	if(iState > EInitialized)
   656 	    {
   722 	    {
   657 	    SendReceive(EMMFDevSoundProxyPause, iDestinationPckg);
   723 	    SendReceive(EMMFDevSoundProxyPause, iDestinationPckg);
   658 	    }
   724 	    }
       
   725 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Pause - Exit"));
   659 	}
   726 	}
   660 
   727 
   661 // -----------------------------------------------------------------------------
   728 // -----------------------------------------------------------------------------
   662 // RMMFDevSoundProxy::PlayToneL
   729 // RMMFDevSoundProxy::PlayToneL
   663 // Plays the simple tone.
   730 // Plays the simple tone.
   666 //
   733 //
   667 EXPORT_C void RMMFDevSoundProxy::PlayToneL(
   734 EXPORT_C void RMMFDevSoundProxy::PlayToneL(
   668 								TInt aFrequency,
   735 								TInt aFrequency,
   669 								const TTimeIntervalMicroSeconds& aDuration)
   736 								const TTimeIntervalMicroSeconds& aDuration)
   670 	{
   737 	{
       
   738 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneL - Enter"));
   671 	if(iState==ETonePlaying)
   739 	if(iState==ETonePlaying)
   672 		{
   740 		{
       
   741 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneL - Exit"));
   673 		return;
   742 		return;
   674 		}
   743 		}
   675 	
   744 	
   676 	if (!iDevSoundObserver || iState!=EInitialized)
   745 	if (!iDevSoundObserver || iState!=EInitialized)
   677 		{
   746 		{
   685 	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayTone,
   754 	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayTone,
   686 								iDestinationPckg,
   755 								iDestinationPckg,
   687 								pckg));
   756 								pckg));
   688 	iState = ETonePlaying;
   757 	iState = ETonePlaying;
   689 	iToneMode = ESimple;
   758 	iToneMode = ESimple;
       
   759 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneL - Exit"));
   690 	}
   760 	}
   691 
   761 
   692 // -----------------------------------------------------------------------------
   762 // -----------------------------------------------------------------------------
   693 // RMMFDevSoundProxy::PlayDualToneL
   763 // RMMFDevSoundProxy::PlayDualToneL
   694 // Plays the dual tone.
   764 // Plays the dual tone.
   698 EXPORT_C void RMMFDevSoundProxy::PlayDualToneL(
   768 EXPORT_C void RMMFDevSoundProxy::PlayDualToneL(
   699 									TInt aFrequencyOne,
   769 									TInt aFrequencyOne,
   700 									TInt aFrequencyTwo,
   770 									TInt aFrequencyTwo,
   701 									const TTimeIntervalMicroSeconds& aDuration)
   771 									const TTimeIntervalMicroSeconds& aDuration)
   702 	{
   772 	{
       
   773 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDualToneL - Enter"));
   703 	if(iState==ETonePlaying)
   774 	if(iState==ETonePlaying)
   704 		{
   775 		{
       
   776 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDualToneL - Exit"));
   705 		return;
   777 		return;
   706 		}
   778 		}
   707 			
   779 			
   708 	if (!iDevSoundObserver || iState!=EInitialized)
   780 	if (!iDevSoundObserver || iState!=EInitialized)
   709 		{
   781 		{
   716 	set.iDuration = aDuration;
   788 	set.iDuration = aDuration;
   717 	TMMFDevSoundProxySettingsPckg pckg(set);
   789 	TMMFDevSoundProxySettingsPckg pckg(set);
   718 	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayDualTone, iDestinationPckg, pckg));
   790 	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayDualTone, iDestinationPckg, pckg));
   719 	iState = ETonePlaying;
   791 	iState = ETonePlaying;
   720 	iToneMode = EDual;
   792 	iToneMode = EDual;
       
   793 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDualToneL - Exit"));
   721 	}
   794 	}
   722 
   795 
   723 // -----------------------------------------------------------------------------
   796 // -----------------------------------------------------------------------------
   724 // RMMFDevSoundProxy::PlayDTMFStringL
   797 // RMMFDevSoundProxy::PlayDTMFStringL
   725 // Plays the DTMF string.
   798 // Plays the DTMF string.
   726 // (other items were commented in a header).
   799 // (other items were commented in a header).
   727 // -----------------------------------------------------------------------------
   800 // -----------------------------------------------------------------------------
   728 //
   801 //
   729 EXPORT_C void RMMFDevSoundProxy::PlayDTMFStringL(const TDesC& aDTMFString)
   802 EXPORT_C void RMMFDevSoundProxy::PlayDTMFStringL(const TDesC& aDTMFString)
   730 	{
   803 	{
       
   804 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDTMFStringL - Enter"));
   731 	if(iState==ETonePlaying)
   805 	if(iState==ETonePlaying)
   732 		{
   806 		{
       
   807 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDTMFStringL - Exit"));
   733 		return;
   808 		return;
   734 		}
   809 		}
   735 			
   810 			
   736 	if (!iDevSoundObserver || iState!=EInitialized)
   811 	if (!iDevSoundObserver || iState!=EInitialized)
   737 		{
   812 		{
   747 						iDestinationPckg,
   822 						iDestinationPckg,
   748 						KNullDesC8,
   823 						KNullDesC8,
   749 						tempPtr));
   824 						tempPtr));
   750 	iState = ETonePlaying;
   825 	iState = ETonePlaying;
   751 	iToneMode = EDTMFString;
   826 	iToneMode = EDTMFString;
       
   827 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDTMFStringL - Exit"));
   752 	}
   828 	}
   753 
   829 
   754 // -----------------------------------------------------------------------------
   830 // -----------------------------------------------------------------------------
   755 // RMMFDevSoundProxy::PlayToneSequenceL
   831 // RMMFDevSoundProxy::PlayToneSequenceL
   756 // Plays the tone sequence. (NRT/RNG)
   832 // Plays the tone sequence. (NRT/RNG)
   757 // (other items were commented in a header).
   833 // (other items were commented in a header).
   758 // -----------------------------------------------------------------------------
   834 // -----------------------------------------------------------------------------
   759 //
   835 //
   760 EXPORT_C void RMMFDevSoundProxy::PlayToneSequenceL(const TDesC8& aData )
   836 EXPORT_C void RMMFDevSoundProxy::PlayToneSequenceL(const TDesC8& aData )
   761 	{
   837 	{
       
   838 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneSequenceL - Enter"));
   762 	if(iState==ETonePlaying)
   839 	if(iState==ETonePlaying)
   763 		{
   840 		{
       
   841 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneSequenceL - Exit"));
   764 		return;
   842 		return;
   765 		}
   843 		}
   766 			
   844 			
   767 	if (!iDevSoundObserver || iState!=EInitialized)
   845 	if (!iDevSoundObserver || iState!=EInitialized)
   768 		{
   846 		{
   772 	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayToneSequence,
   850 	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayToneSequence,
   773 								iDestinationPckg,
   851 								iDestinationPckg,
   774 								aData));
   852 								aData));
   775 	iState = ETonePlaying;
   853 	iState = ETonePlaying;
   776 	iToneMode = ESequence;
   854 	iToneMode = ESequence;
       
   855 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneSequenceL - Exit"));
   777 	}
   856 	}
   778 
   857 
   779 // -----------------------------------------------------------------------------
   858 // -----------------------------------------------------------------------------
   780 // RMMFDevSoundProxy::PlayFixedSequenceL
   859 // RMMFDevSoundProxy::PlayFixedSequenceL
   781 // Plays the fixed sequence.
   860 // Plays the fixed sequence.
   782 // (other items were commented in a header).
   861 // (other items were commented in a header).
   783 // -----------------------------------------------------------------------------
   862 // -----------------------------------------------------------------------------
   784 //
   863 //
   785 EXPORT_C void RMMFDevSoundProxy::PlayFixedSequenceL(TInt aSequenceNumber)
   864 EXPORT_C void RMMFDevSoundProxy::PlayFixedSequenceL(TInt aSequenceNumber)
   786 	{
   865 	{
       
   866 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayFixedSequenceL - Enter"));
   787 	if(iState==ETonePlaying)
   867 	if(iState==ETonePlaying)
   788 		{
   868 		{
       
   869 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayFixedSequenceL - Exit"));
   789 		return;
   870 		return;
   790 		}
   871 		}
   791 			
   872 			
   792 	if (!iDevSoundObserver || iState!=EInitialized)
   873 	if (!iDevSoundObserver || iState!=EInitialized)
   793 		{
   874 		{
   796 
   877 
   797 	TPckgBuf<TInt> seqNum(aSequenceNumber);
   878 	TPckgBuf<TInt> seqNum(aSequenceNumber);
   798 	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayFixedSequence, iDestinationPckg, seqNum));
   879 	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayFixedSequence, iDestinationPckg, seqNum));
   799 	iState = ETonePlaying;
   880 	iState = ETonePlaying;
   800 	iToneMode = EFixedSequence;
   881 	iToneMode = EFixedSequence;
       
   882 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayFixedSequenceL - Exit"));
   801 	}
   883 	}
   802 
   884 
   803 // -----------------------------------------------------------------------------
   885 // -----------------------------------------------------------------------------
   804 // RMMFDevSoundProxy::SetDTMFLengths
   886 // RMMFDevSoundProxy::SetDTMFLengths
   805 // Set attributes for playing DTMF String.
   887 // Set attributes for playing DTMF String.
   809 EXPORT_C void RMMFDevSoundProxy::SetDTMFLengths(
   891 EXPORT_C void RMMFDevSoundProxy::SetDTMFLengths(
   810 									TTimeIntervalMicroSeconds32& aToneOnLength,
   892 									TTimeIntervalMicroSeconds32& aToneOnLength,
   811 									TTimeIntervalMicroSeconds32& aToneOffLength,
   893 									TTimeIntervalMicroSeconds32& aToneOffLength,
   812 									TTimeIntervalMicroSeconds32& aPauseLength )
   894 									TTimeIntervalMicroSeconds32& aPauseLength )
   813 	{
   895 	{
       
   896 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetDTMFLengths - Enter"));
   814 	TMMFDevSoundProxySettings set;
   897 	TMMFDevSoundProxySettings set;
   815 	set.iToneOnLength = aToneOnLength;
   898 	set.iToneOnLength = aToneOnLength;
   816 	set.iToneOffLength = aToneOffLength;
   899 	set.iToneOffLength = aToneOffLength;
   817 	set.iPauseLength = aPauseLength;
   900 	set.iPauseLength = aPauseLength;
   818 	TMMFDevSoundProxySettingsPckg pckg(set);
   901 	TMMFDevSoundProxySettingsPckg pckg(set);
   819 	SendReceive(EMMFDevSoundProxySetDTMFLengths, iDestinationPckg, pckg);
   902 	SendReceive(EMMFDevSoundProxySetDTMFLengths, iDestinationPckg, pckg);
       
   903 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetDTMFLengths - Exit"));
   820 	}
   904 	}
   821 
   905 
   822 // -----------------------------------------------------------------------------
   906 // -----------------------------------------------------------------------------
   823 // RMMFDevSoundProxy::SetVolumeRamp
   907 // RMMFDevSoundProxy::SetVolumeRamp
   824 // Sets the volume ramp duration.
   908 // Sets the volume ramp duration.
   826 // -----------------------------------------------------------------------------
   910 // -----------------------------------------------------------------------------
   827 //
   911 //
   828 EXPORT_C void RMMFDevSoundProxy::SetVolumeRamp(
   912 EXPORT_C void RMMFDevSoundProxy::SetVolumeRamp(
   829 								const TTimeIntervalMicroSeconds& aRampDuration)
   913 								const TTimeIntervalMicroSeconds& aRampDuration)
   830 	{
   914 	{
       
   915 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetVolumeRamp - Enter"));
   831 	TMMFDevSoundProxySettings set;
   916 	TMMFDevSoundProxySettings set;
   832 	set.iDuration = aRampDuration;
   917 	set.iDuration = aRampDuration;
   833 	TMMFDevSoundProxySettingsPckg pckg(set);
   918 	TMMFDevSoundProxySettingsPckg pckg(set);
   834 	SendReceive(EMMFDevSoundProxySetVolumeRamp, iDestinationPckg, pckg);
   919 	SendReceive(EMMFDevSoundProxySetVolumeRamp, iDestinationPckg, pckg);
       
   920 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetVolumeRamp - Exit"));
   835 	}
   921 	}
   836 
   922 
   837 // -----------------------------------------------------------------------------
   923 // -----------------------------------------------------------------------------
   838 // RMMFDevSoundProxy::GetSupportedInputDataTypesL
   924 // RMMFDevSoundProxy::GetSupportedInputDataTypesL
   839 // Returns supported datatypes for playing audio.
   925 // Returns supported datatypes for playing audio.
   842 //
   928 //
   843 EXPORT_C void RMMFDevSoundProxy::GetSupportedInputDataTypesL(
   929 EXPORT_C void RMMFDevSoundProxy::GetSupportedInputDataTypesL(
   844 								RArray<TFourCC>& aSupportedDataTypes,
   930 								RArray<TFourCC>& aSupportedDataTypes,
   845 								const TMMFPrioritySettings& aPrioritySettings)
   931 								const TMMFPrioritySettings& aPrioritySettings)
   846 	{
   932 	{
       
   933 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedInputDataTypesL - Enter"));
   847 	aSupportedDataTypes.Reset();
   934 	aSupportedDataTypes.Reset();
   848 
   935 
   849 	TMMFPrioritySettings prioritySet = aPrioritySettings;
   936 	TMMFPrioritySettings prioritySet = aPrioritySettings;
   850 	TMMFPrioritySettingsPckg pckg(prioritySet);
   937 	TMMFPrioritySettingsPckg pckg(prioritySet);
   851 
   938 
   854 							EMMFDevSoundProxyGetSupportedInputDataTypes,
   941 							EMMFDevSoundProxyGetSupportedInputDataTypes,
   855 							iDestinationPckg,
   942 							iDestinationPckg,
   856 							pckg,
   943 							pckg,
   857 							numberOfElementsPckg));
   944 							numberOfElementsPckg));
   858 							
   945 							
       
   946 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedInputDataTypesL - Exit 1"));
   859 
   947 
   860 	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
   948 	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
   861 	TPtr8 ptr = buf->Des();
   949 	TPtr8 ptr = buf->Des();
   862 
   950 
   863 
   951 
   881 			User::Leave(err);
   969 			User::Leave(err);
   882 			}
   970 			}
   883 		}
   971 		}
   884 	CleanupStack::PopAndDestroy(&stream);
   972 	CleanupStack::PopAndDestroy(&stream);
   885 	CleanupStack::PopAndDestroy(buf);
   973 	CleanupStack::PopAndDestroy(buf);
       
   974 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedInputDataTypesL - Exit 2"));
   886 	}
   975 	}
   887 
   976 
   888 // -----------------------------------------------------------------------------
   977 // -----------------------------------------------------------------------------
   889 // RMMFDevSoundProxy::GetSupportedOutputDataTypesL
   978 // RMMFDevSoundProxy::GetSupportedOutputDataTypesL
   890 // Returns supported datatypes for recording audio.
   979 // Returns supported datatypes for recording audio.
   893 //
   982 //
   894 EXPORT_C void RMMFDevSoundProxy::GetSupportedOutputDataTypesL(
   983 EXPORT_C void RMMFDevSoundProxy::GetSupportedOutputDataTypesL(
   895 								RArray<TFourCC>& aSupportedDataTypes,
   984 								RArray<TFourCC>& aSupportedDataTypes,
   896 								const TMMFPrioritySettings& aPrioritySettings)
   985 								const TMMFPrioritySettings& aPrioritySettings)
   897 	{
   986 	{
       
   987 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedOutputDataTypesL - Enter"));
   898 	aSupportedDataTypes.Reset();
   988 	aSupportedDataTypes.Reset();
   899 
   989 
   900 	TMMFPrioritySettings prioritySet = aPrioritySettings;
   990 	TMMFPrioritySettings prioritySet = aPrioritySettings;
   901 	TMMFPrioritySettingsPckg pckg(prioritySet);
   991 	TMMFPrioritySettingsPckg pckg(prioritySet);
   902 
   992 
   905 								EMMFDevSoundProxyGetSupportedOutputDataTypes,
   995 								EMMFDevSoundProxyGetSupportedOutputDataTypes,
   906 								iDestinationPckg,
   996 								iDestinationPckg,
   907 								pckg,
   997 								pckg,
   908 								numberOfElementsPckg));
   998 								numberOfElementsPckg));
   909 								
   999 								
       
  1000 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedOutputDataTypesL - Exit 1"));
   910 
  1001 
   911 	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
  1002 	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
   912 	TPtr8 ptr = buf->Des();
  1003 	TPtr8 ptr = buf->Des();
   913 
  1004 
   914 
  1005 
   931 			User::Leave(err);
  1022 			User::Leave(err);
   932 			}
  1023 			}
   933 		}
  1024 		}
   934 	CleanupStack::PopAndDestroy(&stream);
  1025 	CleanupStack::PopAndDestroy(&stream);
   935 	CleanupStack::PopAndDestroy(buf);
  1026 	CleanupStack::PopAndDestroy(buf);
       
  1027 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedOutputDataTypesL - Exit 2"));
   936 	}
  1028 	}
   937 
  1029 
   938 // -----------------------------------------------------------------------------
  1030 // -----------------------------------------------------------------------------
   939 // RMMFDevSoundProxy::SamplesRecorded
  1031 // RMMFDevSoundProxy::SamplesRecorded
   940 // Returns samples recorded so far.
  1032 // Returns samples recorded so far.
   941 // (other items were commented in a header).
  1033 // (other items were commented in a header).
   942 // -----------------------------------------------------------------------------
  1034 // -----------------------------------------------------------------------------
   943 //
  1035 //
   944 EXPORT_C TInt RMMFDevSoundProxy::SamplesRecorded()
  1036 EXPORT_C TInt RMMFDevSoundProxy::SamplesRecorded()
   945 	{
  1037 	{
       
  1038 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SamplesRecorded - Enter"));
   946 	TPckgBuf<TInt> numSamples;
  1039 	TPckgBuf<TInt> numSamples;
   947 	SendReceiveResult(EMMFDevSoundProxySamplesRecorded,
  1040 	SendReceiveResult(EMMFDevSoundProxySamplesRecorded,
   948 					iDestinationPckg,
  1041 					iDestinationPckg,
   949 					KNullDesC8,
  1042 					KNullDesC8,
   950 					numSamples);
  1043 					numSamples);
   951 					
  1044 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SamplesRecorded - Exit"));
   952 	return numSamples();
  1045 	return numSamples();
   953 	}
  1046 	}
   954 
  1047 
   955 // -----------------------------------------------------------------------------
  1048 // -----------------------------------------------------------------------------
   956 // RMMFDevSoundProxy::SamplesPlayed
  1049 // RMMFDevSoundProxy::SamplesPlayed
   958 // (other items were commented in a header).
  1051 // (other items were commented in a header).
   959 // -----------------------------------------------------------------------------
  1052 // -----------------------------------------------------------------------------
   960 //
  1053 //
   961 EXPORT_C TInt RMMFDevSoundProxy::SamplesPlayed()
  1054 EXPORT_C TInt RMMFDevSoundProxy::SamplesPlayed()
   962 	{
  1055 	{
       
  1056 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SamplesPlayed - Enter"));
   963 	TPckgBuf<TInt> numSamples;
  1057 	TPckgBuf<TInt> numSamples;
   964 	SendReceiveResult(EMMFDevSoundProxySamplesPlayed,
  1058 	SendReceiveResult(EMMFDevSoundProxySamplesPlayed,
   965 					iDestinationPckg,
  1059 					iDestinationPckg,
   966 					KNullDesC8,
  1060 					KNullDesC8,
   967 					numSamples);
  1061 					numSamples);
       
  1062 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SamplesPlayed - Exit"));
   968 	return numSamples();
  1063 	return numSamples();
   969 	}
  1064 	}
   970 
  1065 
   971 // -----------------------------------------------------------------------------
  1066 // -----------------------------------------------------------------------------
   972 // RMMFDevSoundProxy::SetToneRepeats
  1067 // RMMFDevSoundProxy::SetToneRepeats
   977 EXPORT_C void RMMFDevSoundProxy::SetToneRepeats(
  1072 EXPORT_C void RMMFDevSoundProxy::SetToneRepeats(
   978 								TInt aRepeatCount,
  1073 								TInt aRepeatCount,
   979 								const TTimeIntervalMicroSeconds&
  1074 								const TTimeIntervalMicroSeconds&
   980 									aRepeatTrailingSilence)
  1075 									aRepeatTrailingSilence)
   981 	{
  1076 	{
       
  1077 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetToneRepeats - Enter"));
   982 	TPckgBuf<TInt> countRepeat(aRepeatCount);
  1078 	TPckgBuf<TInt> countRepeat(aRepeatCount);
   983 	TPckgBuf<TTimeIntervalMicroSeconds> repeatTS(aRepeatTrailingSilence);
  1079 	TPckgBuf<TTimeIntervalMicroSeconds> repeatTS(aRepeatTrailingSilence);
   984 	SendReceive(EMMFDevSoundProxySetToneRepeats,
  1080 	SendReceive(EMMFDevSoundProxySetToneRepeats,
   985 				iDestinationPckg,
  1081 				iDestinationPckg,
   986 				countRepeat,
  1082 				countRepeat,
   987 				repeatTS);
  1083 				repeatTS);
       
  1084 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetToneRepeats - Exit"));
   988 	}
  1085 	}
   989 
  1086 
   990 // -----------------------------------------------------------------------------
  1087 // -----------------------------------------------------------------------------
   991 // RMMFDevSoundProxy::SetPrioritySettings
  1088 // RMMFDevSoundProxy::SetPrioritySettings
   992 // Sets priority settings
  1089 // Sets priority settings
   994 // -----------------------------------------------------------------------------
  1091 // -----------------------------------------------------------------------------
   995 //
  1092 //
   996 EXPORT_C void RMMFDevSoundProxy::SetPrioritySettings(
  1093 EXPORT_C void RMMFDevSoundProxy::SetPrioritySettings(
   997 								const TMMFPrioritySettings& aPrioritySettings)
  1094 								const TMMFPrioritySettings& aPrioritySettings)
   998 	{
  1095 	{
       
  1096 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetPrioritySettings - Enter"));
   999 	TPckgBuf<TMMFPrioritySettings> prioritySet(aPrioritySettings);
  1097 	TPckgBuf<TMMFPrioritySettings> prioritySet(aPrioritySettings);
  1000 	SendReceive(EMMFDevSoundProxySetPrioritySettings,
  1098 	SendReceive(EMMFDevSoundProxySetPrioritySettings,
  1001 				iDestinationPckg,
  1099 				iDestinationPckg,
  1002 				prioritySet);
  1100 				prioritySet);
       
  1101 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetPrioritySettings - Exit"));
  1003 	}
  1102 	}
  1004 
  1103 
  1005 // -----------------------------------------------------------------------------
  1104 // -----------------------------------------------------------------------------
  1006 // RMMFDevSoundProxy::FixedSequenceName
  1105 // RMMFDevSoundProxy::FixedSequenceName
  1007 // Returns the name of fixed sequence for a given sequence number.
  1106 // Returns the name of fixed sequence for a given sequence number.
  1008 // (other items were commented in a header).
  1107 // (other items were commented in a header).
  1009 // -----------------------------------------------------------------------------
  1108 // -----------------------------------------------------------------------------
  1010 //
  1109 //
  1011 EXPORT_C const TDesC& RMMFDevSoundProxy::FixedSequenceName(TInt /*aSequenceNumber*/)
  1110 EXPORT_C const TDesC& RMMFDevSoundProxy::FixedSequenceName(TInt /*aSequenceNumber*/)
  1012 	{
  1111 	{
       
  1112 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::FixedSequenceName - Enter"));
  1013 	_LIT(KNullDesC, "");
  1113 	_LIT(KNullDesC, "");
       
  1114 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::FixedSequenceName - Exit"));
  1014 	return KNullDesC;
  1115 	return KNullDesC;
  1015 	}
  1116 	}
  1016 
  1117 
  1017 // -----------------------------------------------------------------------------
  1118 // -----------------------------------------------------------------------------
  1018 // RMMFDevSoundProxy::CustomInterface
  1119 // RMMFDevSoundProxy::CustomInterface
  1020 // (other items were commented in a header).
  1121 // (other items were commented in a header).
  1021 // -----------------------------------------------------------------------------
  1122 // -----------------------------------------------------------------------------
  1022 //
  1123 //
  1023 EXPORT_C TAny* RMMFDevSoundProxy::CustomInterface(TUid aInterfaceId)
  1124 EXPORT_C TAny* RMMFDevSoundProxy::CustomInterface(TUid aInterfaceId)
  1024 	{
  1125 	{
       
  1126 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomInterface - Enter"));
  1025 	TMMFDevSoundProxySettings set;
  1127 	TMMFDevSoundProxySettings set;
  1026 	set.iInterface = aInterfaceId;
  1128 	set.iInterface = aInterfaceId;
  1027 	// Added for ask for custom interface
  1129 	// Added for ask for custom interface
  1028 	TAny* customInterface = NULL;
  1130 	TAny* customInterface = NULL;
  1029 	if (aInterfaceId == KMmfUidDevSoundCancelInitializeCustomInterface)
  1131 	if (aInterfaceId == KMmfUidDevSoundCancelInitializeCustomInterface)
  1030 		{
  1132 		{
  1031 		MMMFDevSoundCancelInitialize* result = this; 
  1133 		MMMFDevSoundCancelInitialize* result = this;
       
  1134 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomInterface - Exit"));
  1032 		return result;
  1135 		return result;
  1033 		}
  1136 		}
  1034 	TPckgBuf<TAny*> pckg2(customInterface);
  1137 	TPckgBuf<TAny*> pckg2(customInterface);
  1035 
  1138 
  1036 	TMMFDevSoundProxySettingsPckg pckg(set);
  1139 	TMMFDevSoundProxySettingsPckg pckg(set);
  1037 	SendReceiveResult(EMMFDevSoundProxyCustomInterface, 
  1140 	SendReceiveResult(EMMFDevSoundProxyCustomInterface, 
  1038 							iDestinationPckg, 
  1141 							iDestinationPckg, 
  1039 							pckg, pckg2);
  1142 							pckg, pckg2);
       
  1143 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomInterface - Exit"));
  1040 	return reinterpret_cast<TAny*> (customInterface);
  1144 	return reinterpret_cast<TAny*> (customInterface);
  1041 	}
  1145 	}
  1042 	
  1146 	
  1043 // -----------------------------------------------------------------------------
  1147 // -----------------------------------------------------------------------------
  1044 // RMMFDevSoundProxy::FixedSequenceCount
  1148 // RMMFDevSoundProxy::FixedSequenceCount
  1046 // (other items were commented in a header).
  1150 // (other items were commented in a header).
  1047 // -----------------------------------------------------------------------------
  1151 // -----------------------------------------------------------------------------
  1048 //
  1152 //
  1049 EXPORT_C TInt RMMFDevSoundProxy::FixedSequenceCount()
  1153 EXPORT_C TInt RMMFDevSoundProxy::FixedSequenceCount()
  1050 	{
  1154 	{
       
  1155 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::FixedSequenceCount - Enter"));
  1051 	TPckgBuf<TInt> fixSeqCountPckg;
  1156 	TPckgBuf<TInt> fixSeqCountPckg;
  1052 	SendReceiveResult(EMMFDevSoundProxyFixedSequenceCount,
  1157 	SendReceiveResult(EMMFDevSoundProxyFixedSequenceCount,
  1053 					iDestinationPckg,
  1158 					iDestinationPckg,
  1054 					KNullDesC8,
  1159 					KNullDesC8,
  1055 					fixSeqCountPckg);
  1160 					fixSeqCountPckg);
  1056 					
  1161 
  1057 					
  1162 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::FixedSequenceCount - Exit"));
  1058 	return fixSeqCountPckg();
  1163 	return fixSeqCountPckg();
  1059 	}
  1164 	}
  1060 
  1165 
  1061 // -----------------------------------------------------------------------------
  1166 // -----------------------------------------------------------------------------
  1062 // RMMFDevSoundProxy::BufferToBeFilledData
  1167 // RMMFDevSoundProxy::BufferToBeFilledData
  1064 // -----------------------------------------------------------------------------
  1169 // -----------------------------------------------------------------------------
  1065 //
  1170 //
  1066 EXPORT_C TInt RMMFDevSoundProxy::BufferToBeFilledData(
  1171 EXPORT_C TInt RMMFDevSoundProxy::BufferToBeFilledData(
  1067 		TBool aRequestChunk, TMMFDevSoundProxyHwBufPckg& aSetPckg)
  1172 		TBool aRequestChunk, TMMFDevSoundProxyHwBufPckg& aSetPckg)
  1068 	{
  1173 	{
       
  1174 	//SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::BufferToBeFilledData - Enter")); //Uncommenting this will produce a lot of logging!
  1069 	// Note that there will only ever be one of these requests outstanding
  1175 	// Note that there will only ever be one of these requests outstanding
  1070 	// per session
  1176 	// per session
  1071 	TPckgBuf<TInt> requestChunkBuf (aRequestChunk);
  1177 	TPckgBuf<TInt> requestChunkBuf (aRequestChunk);
  1072 	return SendReceiveResult(EMMFDevSoundProxyBTBFData,
  1178 	TInt err = SendReceiveResult(EMMFDevSoundProxyBTBFData,
  1073 							iDestinationPckg,
  1179 							iDestinationPckg,
  1074 							requestChunkBuf,
  1180 							requestChunkBuf,
  1075 							aSetPckg);
  1181 							aSetPckg);
       
  1182 	//SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::BufferToBeFilledData - Exit [%d]"), err); //Uncommenting this will produce a lot of logging!
       
  1183 	return err;
  1076 	}
  1184 	}
  1077 
  1185 
  1078 // -----------------------------------------------------------------------------
  1186 // -----------------------------------------------------------------------------
  1079 // RMMFDevSoundProxy::BufferToBeEmptiedData
  1187 // RMMFDevSoundProxy::BufferToBeEmptiedData
  1080 // Returns data buffer for recording.
  1188 // Returns data buffer for recording.
  1081 // -----------------------------------------------------------------------------
  1189 // -----------------------------------------------------------------------------
  1082 //
  1190 //
  1083 EXPORT_C TInt RMMFDevSoundProxy::BufferToBeEmptiedData(
  1191 EXPORT_C TInt RMMFDevSoundProxy::BufferToBeEmptiedData(
  1084 							TMMFDevSoundProxyHwBufPckg& aSetPckg)
  1192 							TMMFDevSoundProxyHwBufPckg& aSetPckg)
  1085 	{
  1193 	{
       
  1194 	//SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::BufferToBeEmptiedData - Enter")); //Uncommenting this will produce a lot of logging!
  1086 	// Note that there will only ever be one of these requests outstanding
  1195 	// Note that there will only ever be one of these requests outstanding
  1087 	// per session
  1196 	// per session
  1088 	return SendReceiveResult(EMMFDevSoundProxyBTBEData,
  1197 	TInt err = SendReceiveResult(EMMFDevSoundProxyBTBEData,
  1089 								iDestinationPckg,
  1198 								iDestinationPckg,
  1090 								KNullDesC8,
  1199 								KNullDesC8,
  1091 								aSetPckg);
  1200 								aSetPckg);
       
  1201 	//SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::BufferToBeEmptiedData - Exit [%d]"), err); //Uncommenting this will produce a lot of logging!
       
  1202 	return err;
  1092 	}
  1203 	}
  1093 
  1204 
  1094 // -----------------------------------------------------------------------------
  1205 // -----------------------------------------------------------------------------
  1095 // RMMFDevSoundProxy::RegisterAsClient
  1206 // RMMFDevSoundProxy::RegisterAsClient
  1096 // Registers the client for notification of resource avalibility.
  1207 // Registers the client for notification of resource avalibility.
  1097 // -----------------------------------------------------------------------------
  1208 // -----------------------------------------------------------------------------
  1098 //
  1209 //
  1099 EXPORT_C TInt RMMFDevSoundProxy::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
  1210 EXPORT_C TInt RMMFDevSoundProxy::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
  1100 	{
  1211 	{
       
  1212 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RegisterAsClient - Enter"));
  1101 	TMMFDevSoundProxySettings set;
  1213 	TMMFDevSoundProxySettings set;
  1102 	set.iNotificationEventUid = aEventType;
  1214 	set.iNotificationEventUid = aEventType;
  1103 	TMMFDevSoundProxySettingsPckg pckg(set);
  1215 	TMMFDevSoundProxySettingsPckg pckg(set);
  1104 	return SendReceive(EMMFDevSoundProxyRequestResourceNotification, iDestinationPckg, pckg, aNotificationRegistrationData);
  1216 	TInt err = SendReceive(EMMFDevSoundProxyRequestResourceNotification, iDestinationPckg, pckg, aNotificationRegistrationData);
       
  1217 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::RegisterAsClient - Exit [%d]"), err);
       
  1218 	return err;
  1105 	}
  1219 	}
  1106 
  1220 
  1107 // -----------------------------------------------------------------------------
  1221 // -----------------------------------------------------------------------------
  1108 // RMMFDevSoundProxy::CancelRegisterAsClient
  1222 // RMMFDevSoundProxy::CancelRegisterAsClient
  1109 // Cancels the Registered Notification.
  1223 // Cancels the Registered Notification.
  1110 // -----------------------------------------------------------------------------
  1224 // -----------------------------------------------------------------------------
  1111 //
  1225 //
  1112 EXPORT_C TInt RMMFDevSoundProxy::CancelRegisterAsClient(TUid aEventType)
  1226 EXPORT_C TInt RMMFDevSoundProxy::CancelRegisterAsClient(TUid aEventType)
  1113 	{
  1227 	{
       
  1228 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CancelRegisterAsClient - Enter"));
  1114 	TMMFDevSoundProxySettings set;
  1229 	TMMFDevSoundProxySettings set;
  1115 	set.iNotificationEventUid = aEventType;
  1230 	set.iNotificationEventUid = aEventType;
  1116 	TMMFDevSoundProxySettingsPckg pckg(set);
  1231 	TMMFDevSoundProxySettingsPckg pckg(set);
  1117 	return SendReceiveResult(EMMFDevSoundProxyCancelRequestResourceNotification, iDestinationPckg, KNullDesC8, pckg);
  1232 	TInt err = SendReceiveResult(EMMFDevSoundProxyCancelRequestResourceNotification, iDestinationPckg, KNullDesC8, pckg);
       
  1233 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::CancelRegisterAsClient - Exit [%d]"), err);
       
  1234 	return err;
  1118 	}
  1235 	}
  1119 	
  1236 	
  1120 // -----------------------------------------------------------------------------
  1237 // -----------------------------------------------------------------------------
  1121 // RMMFDevSoundProxy::GetResourceNotificationData
  1238 // RMMFDevSoundProxy::GetResourceNotificationData
  1122 // Returns the Notification data which the client needs to resume playing.
  1239 // Returns the Notification data which the client needs to resume playing.
  1123 // -----------------------------------------------------------------------------
  1240 // -----------------------------------------------------------------------------
  1124 //
  1241 //
  1125 EXPORT_C TInt RMMFDevSoundProxy::GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData)
  1242 EXPORT_C TInt RMMFDevSoundProxy::GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData)
  1126 	{
  1243 	{
       
  1244 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetResourceNotificationData - Enter"));
  1127 	TMMFDevSoundProxySettings set;
  1245 	TMMFDevSoundProxySettings set;
  1128 	set.iNotificationEventUid = aEventType;
  1246 	set.iNotificationEventUid = aEventType;
  1129 	TMMFDevSoundProxySettingsPckg pckg(set);
  1247 	TMMFDevSoundProxySettingsPckg pckg(set);
  1130 	return SendReceiveResult(EMMFDevSoundProxyGetResourceNotificationData, iDestinationPckg, pckg, aNotificationData);
  1248 	TInt err = SendReceiveResult(EMMFDevSoundProxyGetResourceNotificationData, iDestinationPckg, pckg, aNotificationData);
       
  1249 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::GetResourceNotificationData - Exit [%d]"), err);
       
  1250 	return err;
  1131 	}
  1251 	}
  1132 
  1252 
  1133 // -----------------------------------------------------------------------------
  1253 // -----------------------------------------------------------------------------
  1134 // RMMFDevSoundProxy::WillResumePlay
  1254 // RMMFDevSoundProxy::WillResumePlay
  1135 // Wait for the clients to resume play back even after the default timeout 
  1255 // Wait for the clients to resume play back even after the default timeout 
  1137 // no other client gets notification.
  1257 // no other client gets notification.
  1138 // -----------------------------------------------------------------------------
  1258 // -----------------------------------------------------------------------------
  1139 //
  1259 //
  1140 EXPORT_C TInt RMMFDevSoundProxy::WillResumePlay()
  1260 EXPORT_C TInt RMMFDevSoundProxy::WillResumePlay()
  1141 	{
  1261 	{
  1142 	return SendReceive(EMMFDevSoundProxyWillResumePlay, iDestinationPckg);
  1262 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::WillResumePlay - Enter"));
       
  1263 	TInt err = SendReceive(EMMFDevSoundProxyWillResumePlay, iDestinationPckg);
       
  1264 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::WillResumePlay - Exit [%d]"), err);
       
  1265 	return err;
  1143 	}
  1266 	}
  1144 
  1267 
  1145 // -----------------------------------------------------------------------------
  1268 // -----------------------------------------------------------------------------
  1146 // RMMFDevSoundProxy::EmptyBuffers
  1269 // RMMFDevSoundProxy::EmptyBuffers
  1147 // Empties the play buffers below DevSound without causing the codec 
  1270 // Empties the play buffers below DevSound without causing the codec 
  1149 // -----------------------------------------------------------------------------
  1272 // -----------------------------------------------------------------------------
  1150 //
  1273 //
  1151 
  1274 
  1152 EXPORT_C TInt RMMFDevSoundProxy::EmptyBuffers()
  1275 EXPORT_C TInt RMMFDevSoundProxy::EmptyBuffers()
  1153 	{
  1276 	{
       
  1277 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::EmptyBuffers - Enter"));
  1154 	TInt error = SendReceive(EMMFDevSoundProxyEmptyBuffers, iDestinationPckg); 
  1278 	TInt error = SendReceive(EMMFDevSoundProxyEmptyBuffers, iDestinationPckg); 
  1155 	
  1279 	
  1156 	if(error==KErrNone)
  1280 	if(error==KErrNone)
  1157 	    {
  1281 	    {
  1158 	    if (iState==EPlayingBufferWait)
  1282 	    if (iState==EPlayingBufferWait)
  1159 	        {
  1283 	        {
  1160 	        // Empty buffers terminates the buffer cycle
  1284 	        // Empty buffers terminates the buffer cycle
  1161 	        iState = EPlaying;
  1285 	        iState = EPlaying;
  1162 	        }
  1286 	        }
  1163 	    }
  1287 	    }
       
  1288 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::EmptyBuffers - Exit [%d]"), error);
  1164 	return error;
  1289 	return error;
  1165 	}
  1290 	}
  1166 
  1291 
  1167 // -----------------------------------------------------------------------------
  1292 // -----------------------------------------------------------------------------
  1168 // RMMFDevSoundProxy::CancelInitialize
  1293 // RMMFDevSoundProxy::CancelInitialize
  1169 // Cancels the initialization process
  1294 // Cancels the initialization process
  1170 // -----------------------------------------------------------------------------
  1295 // -----------------------------------------------------------------------------
  1171 //
  1296 //
  1172 EXPORT_C TInt RMMFDevSoundProxy::CancelInitialize()
  1297 EXPORT_C TInt RMMFDevSoundProxy::CancelInitialize()
  1173 	{
  1298 	{
       
  1299 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CancelInitialize - Enter"));
  1174 	TInt err=KErrNone;
  1300 	TInt err=KErrNone;
  1175 	
  1301 	
  1176 	if (iState==EInitializing)
  1302 	if (iState==EInitializing)
  1177 		{
  1303 		{
  1178 		err = SendReceive(EMMFDevSoundProxyCancelInitialize, iDestinationPckg);
  1304 		err = SendReceive(EMMFDevSoundProxyCancelInitialize, iDestinationPckg);
  1180 		}
  1306 		}
  1181 	else
  1307 	else
  1182 		{
  1308 		{
  1183 		err = KErrNotReady;
  1309 		err = KErrNotReady;
  1184 		}
  1310 		}
  1185 	
  1311 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::CancelInitialize - Exit [%d]"), err);
  1186 	return err;
  1312 	return err;
  1187 	}
  1313 	}
  1188 
  1314 
  1189 
  1315 
  1190 // -----------------------------------------------------------------------------
  1316 // -----------------------------------------------------------------------------
  1192 // 
  1318 // 
  1193 // -----------------------------------------------------------------------------
  1319 // -----------------------------------------------------------------------------
  1194 //
  1320 //
  1195 EXPORT_C TInt RMMFDevSoundProxy::SetClientThreadInfo(TThreadId& aTid)
  1321 EXPORT_C TInt RMMFDevSoundProxy::SetClientThreadInfo(TThreadId& aTid)
  1196 	{
  1322 	{
       
  1323 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetClientThreadInfo - Enter"));
  1197 	TPckgBuf<TThreadId> threadId(aTid);
  1324 	TPckgBuf<TThreadId> threadId(aTid);
  1198 	return SendReceive(EMMFDevSoundProxySetClientThreadInfo, iDestinationPckg, threadId);
  1325 	TInt err = SendReceive(EMMFDevSoundProxySetClientThreadInfo, iDestinationPckg, threadId);
       
  1326 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetClientThreadInfo - Exit [%d]"), err);
       
  1327 	return err;
  1199 	}
  1328 	}
  1200 
  1329 
  1201 
  1330 
  1202 // -----------------------------------------------------------------------------
  1331 // -----------------------------------------------------------------------------
  1203 // RMMFDevSoundProxy::CustomCommandSync()
  1332 // RMMFDevSoundProxy::CustomCommandSync()
  1209 							TInt aFunction,
  1338 							TInt aFunction,
  1210 							const TDesC8& aDataTo1,
  1339 							const TDesC8& aDataTo1,
  1211 							const TDesC8& aDataTo2,
  1340 							const TDesC8& aDataTo2,
  1212 							TDes8& aDataFrom)
  1341 							TDes8& aDataFrom)
  1213 	{
  1342 	{
  1214 	return SendReceiveResult(aFunction,
  1343 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandSync - Enter"));
       
  1344 	TInt err = SendReceiveResult(aFunction,
  1215 							aDestination,
  1345 							aDestination,
  1216 							aDataTo1,
  1346 							aDataTo1,
  1217 							aDataTo2,
  1347 							aDataTo2,
  1218 							aDataFrom);
  1348 							aDataFrom);
       
  1349 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::CustomCommandSync - Exit [%d]"), err);
       
  1350 	return err;
  1219 	}
  1351 	}
  1220 
  1352 
  1221 // -----------------------------------------------------------------------------
  1353 // -----------------------------------------------------------------------------
  1222 // RMMFDevSoundProxy::RMMFDevSoundProxy()
  1354 // RMMFDevSoundProxy::RMMFDevSoundProxy()
  1223 // Send Message synchronously to DevSound server and return the result to client
  1355 // Send Message synchronously to DevSound server and return the result to client
  1227 							const TMMFMessageDestinationPckg&  aDestination,
  1359 							const TMMFMessageDestinationPckg&  aDestination,
  1228 							TInt aFunction,
  1360 							TInt aFunction,
  1229 							const TDesC8& aDataTo1,
  1361 							const TDesC8& aDataTo1,
  1230 							const TDesC8& aDataTo2)
  1362 							const TDesC8& aDataTo2)
  1231 	{
  1363 	{
  1232 	return SendReceive(aFunction, aDestination, aDataTo1, aDataTo2);
  1364 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandSync - Enter"));
       
  1365 	TInt err =  SendReceive(aFunction, aDestination, aDataTo1, aDataTo2);
       
  1366 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::CustomCommandSync - Exit [%d]"), err);
       
  1367 	return err;
  1233 	}
  1368 	}
  1234 
  1369 
  1235 // -----------------------------------------------------------------------------
  1370 // -----------------------------------------------------------------------------
  1236 // RMMFDevSoundProxy::RMMFDevSoundProxy()
  1371 // RMMFDevSoundProxy::RMMFDevSoundProxy()
  1237 // Send Message asynchronously to DevSound server
  1372 // Send Message asynchronously to DevSound server
  1243 								const TDesC8& aDataTo1,
  1378 								const TDesC8& aDataTo1,
  1244 								const TDesC8& aDataTo2,
  1379 								const TDesC8& aDataTo2,
  1245 								TDes8& aDataFrom,
  1380 								TDes8& aDataFrom,
  1246 								TRequestStatus& aStatus )
  1381 								TRequestStatus& aStatus )
  1247 	{
  1382 	{
       
  1383 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandAsync - Enter"));
  1248 	SendReceiveResult(aFunction,
  1384 	SendReceiveResult(aFunction,
  1249 					aDestination,
  1385 					aDestination,
  1250 					aDataTo1,
  1386 					aDataTo1,
  1251 					aDataTo2,
  1387 					aDataTo2,
  1252 					aDataFrom,
  1388 					aDataFrom,
  1253 					aStatus);
  1389 					aStatus);
       
  1390 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandAsync - Exit"));
  1254 	}
  1391 	}
  1255 
  1392 
  1256 // -----------------------------------------------------------------------------
  1393 // -----------------------------------------------------------------------------
  1257 // RMMFDevSoundProxy::RMMFDevSoundProxy()
  1394 // RMMFDevSoundProxy::RMMFDevSoundProxy()
  1258 // Send Message asynchronously to DevSound server
  1395 // Send Message asynchronously to DevSound server
  1263 								TInt aFunction,
  1400 								TInt aFunction,
  1264 								const TDesC8& aDataTo1,
  1401 								const TDesC8& aDataTo1,
  1265 								const TDesC8& aDataTo2,
  1402 								const TDesC8& aDataTo2,
  1266 								TRequestStatus& aStatus )
  1403 								TRequestStatus& aStatus )
  1267 	{
  1404 	{
       
  1405 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandAsync - Enter"));
  1268 	SendReceive(aFunction, aDestination, aDataTo1, aDataTo2, aStatus);
  1406 	SendReceive(aFunction, aDestination, aDataTo1, aDataTo2, aStatus);
       
  1407 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandAsync - Exit"));
  1269 	}
  1408 	}
  1270 
  1409 
  1271 // implementation of a simple CustomCommand() scheme
  1410 // implementation of a simple CustomCommand() scheme
  1272 EXPORT_C TInt RMMFDevSoundProxy::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
  1411 EXPORT_C TInt RMMFDevSoundProxy::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
  1273 	{
  1412 	{
       
  1413 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SyncCustomCommand - Enter"));
  1274 	TMMFMessageDestinationPckg dest(TMMFMessageDestination(aUid, KMMFObjectHandleDevSound));
  1414 	TMMFMessageDestinationPckg dest(TMMFMessageDestination(aUid, KMMFObjectHandleDevSound));
  1275 
  1415 
       
  1416 	TInt err = KErrNone;
  1276 	if (aOutParam==NULL)
  1417 	if (aOutParam==NULL)
  1277 		{
  1418 		{
  1278 		return SendReceive(EMMFDevSoundProxySyncCustomCommand, dest, aParam1, aParam2);
  1419 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SyncCustomCommand - Exit"));
       
  1420 		err = SendReceive(EMMFDevSoundProxySyncCustomCommand, dest, aParam1, aParam2);
       
  1421 		return err;
  1279 		}
  1422 		}
  1280 	else
  1423 	else
  1281 		{
  1424 		{
  1282 		return SendReceiveResult(EMMFDevSoundProxySyncCustomCommandResult, dest, aParam1, aParam2, *aOutParam);		
  1425 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SyncCustomCommand - Exit"));
       
  1426 		err = SendReceiveResult(EMMFDevSoundProxySyncCustomCommandResult, dest, aParam1, aParam2, *aOutParam);
       
  1427 		return err;
  1283 		}
  1428 		}
  1284 	}
  1429 	}
  1285 
  1430 
  1286 EXPORT_C void RMMFDevSoundProxy::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
  1431 EXPORT_C void RMMFDevSoundProxy::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
  1287 	{
  1432 	{
       
  1433 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::AsyncCustomCommand - Enter"));
  1288 	TMMFMessageDestination dest(aUid, KMMFObjectHandleDevSound);
  1434 	TMMFMessageDestination dest(aUid, KMMFObjectHandleDevSound);
  1289 	iCustIntPckg = dest;
  1435 	iCustIntPckg = dest;
  1290 	if (aOutParam==NULL)
  1436 	if (aOutParam==NULL)
  1291 		{
  1437 		{
       
  1438 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::AsyncCustomCommand - Exit"));
  1292 		SendReceive(EMMFDevSoundProxyAsyncCustomCommand, iCustIntPckg, aParam1, aParam2, aStatus);
  1439 		SendReceive(EMMFDevSoundProxyAsyncCustomCommand, iCustIntPckg, aParam1, aParam2, aStatus);
  1293 		}
  1440 		}
  1294 	else
  1441 	else
  1295 		{
  1442 		{
       
  1443 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::AsyncCustomCommand - Exit"));
  1296 		SendReceiveResult(EMMFDevSoundProxyAsyncCustomCommandResult, iCustIntPckg, aParam1, aParam2, *aOutParam, aStatus);		
  1444 		SendReceiveResult(EMMFDevSoundProxyAsyncCustomCommandResult, iCustIntPckg, aParam1, aParam2, *aOutParam, aStatus);		
  1297 		}
  1445 		}
  1298 	}
  1446 	}
  1299 
  1447 
  1300 EXPORT_C TInt RMMFDevSoundProxy::GetTimePlayed(TTimeIntervalMicroSeconds& aTime)
  1448 EXPORT_C TInt RMMFDevSoundProxy::GetTimePlayed(TTimeIntervalMicroSeconds& aTime)
  1301 	{
  1449 	{
       
  1450 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetTimePlayed - Enter"));
  1302 	TTimeIntervalMicroSeconds time(0);
  1451 	TTimeIntervalMicroSeconds time(0);
  1303 	TPckgBuf<TTimeIntervalMicroSeconds> timePckg(time);
  1452 	TPckgBuf<TTimeIntervalMicroSeconds> timePckg(time);
  1304 	TInt err = SendReceiveResult(EMMFDevSoundProxyGetTimePlayed, iDestinationPckg, KNullDesC8, timePckg);
  1453 	TInt err = SendReceiveResult(EMMFDevSoundProxyGetTimePlayed, iDestinationPckg, KNullDesC8, timePckg);
  1305 	if(err==KErrNone)
  1454 	if(err==KErrNone)
  1306 		{
  1455 		{
  1307 		aTime = timePckg();
  1456 		aTime = timePckg();
  1308 		}
  1457 		}
       
  1458 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::GetTimePlayed - Exit [%d]"), err);
  1309 	return err;
  1459 	return err;
  1310 	}
  1460 	}
  1311 
  1461 
  1312 EXPORT_C TBool RMMFDevSoundProxy::IsResumeSupported()
  1462 EXPORT_C TBool RMMFDevSoundProxy::IsResumeSupported()
  1313 	{
  1463 	{
       
  1464 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::IsResumeSupported - Enter"));
  1314 	TPckgBuf<TBool> isResumeSupported;
  1465 	TPckgBuf<TBool> isResumeSupported;
  1315 	TInt err = SendReceiveResult(EMMFDevSoundProxyIsResumeSupported, 
  1466 	TInt err = SendReceiveResult(EMMFDevSoundProxyIsResumeSupported, 
  1316 								iDestinationPckg, 
  1467 								iDestinationPckg, 
  1317 								KNullDesC8, 
  1468 								KNullDesC8, 
  1318 								isResumeSupported);
  1469 								isResumeSupported);
  1319 	if(err == KErrNone)
  1470 	if(err == KErrNone)
  1320 		{
  1471 		{
       
  1472 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::IsResumeSupported - Exit"));
  1321 		return isResumeSupported();
  1473 		return isResumeSupported();
  1322 		}
  1474 		}
  1323 	else
  1475 	else
  1324 		{
  1476 		{
       
  1477 		SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::IsResumeSupported - Exit"));
  1325 		return EFalse;
  1478 		return EFalse;
  1326 		}
  1479 		}
  1327 	}
  1480 	}
  1328 
  1481 
  1329 EXPORT_C TInt RMMFDevSoundProxy::Resume()
  1482 EXPORT_C TInt RMMFDevSoundProxy::Resume()
  1330 	{
  1483 	{
       
  1484 	SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Resume - Enter"));
  1331 	TInt err = KErrNone;
  1485 	TInt err = KErrNone;
  1332 	if (!iDevSoundObserver ||  iState <= EInitialized  )
  1486 	if (!iDevSoundObserver ||  iState <= EInitialized  )
  1333 		{
  1487 		{
  1334 		err = KErrNotReady;
  1488 		err = KErrNotReady;
  1335 		}
  1489 		}
  1336 	else if(iState == ETonePlaying && iToneMode != ESequence)
  1490 	else if(iState == ETonePlaying && iToneMode != ESequence)
  1337 		{
  1491 		{
       
  1492 		SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::Resume - Exit [%d]"), err);
  1338 		return KErrNotSupported;
  1493 		return KErrNotSupported;
  1339 		}
  1494 		}
  1340 	else
  1495 	else
  1341 		{
  1496 		{
  1342 	    if (iState==ERecordingInLastBufferCycle)
  1497 	    if (iState==ERecordingInLastBufferCycle)
  1345             // server side sent a PausedRecordCompleteEvent and did not actually request a buffer!
  1500             // server side sent a PausedRecordCompleteEvent and did not actually request a buffer!
  1346             // just record the fact we've done this and wait until RecordData() is called
  1501             // just record the fact we've done this and wait until RecordData() is called
  1347             // don't actually resume until then!
  1502             // don't actually resume until then!
  1348             iState = ERecordingResumingInLastBufferCycle;
  1503             iState = ERecordingResumingInLastBufferCycle;
  1349             }
  1504             }
       
  1505 	    else if (iState == ERecordingResumingInLastBufferCycle)
       
  1506 	        {
       
  1507             //Do Nothing as you can't resume twice on last buffer 
       
  1508 	        }
  1350 	    else
  1509 	    else
  1351 	        {
  1510 	        {
  1352 	        err = SendReceive(EMMFDevSoundProxyResume,  
  1511 	        err = SendReceive(EMMFDevSoundProxyResume,  
  1353 	                    iDestinationPckg);	        
  1512 	                    iDestinationPckg);	        
  1354 	        }
  1513 	        }
  1355 		}
  1514 		}
       
  1515 	SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::Resume - Exit [%d]"), err);
  1356 	return err;
  1516 	return err;
  1357 	}
  1517 	}
  1358 
  1518 
  1359 // -----------------------------------------------------------------------------
  1519 // -----------------------------------------------------------------------------
  1360 // RMMFDevSoundProxy::StartReceivingMsgQueueHandlerEventsL()
  1520 // RMMFDevSoundProxy::StartReceivingMsgQueueHandlerEventsL()