os/mm/devsound/devsoundapi/inc/SoundDevice.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsound/devsoundapi/inc/SoundDevice.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,196 @@
     1.4 +
     1.5 +// SoundDevice.inl
     1.6 +
     1.7 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.8 +// All rights reserved.
     1.9 +// This component and the accompanying materials are made available
    1.10 +// under the terms of "Eclipse Public License v1.0"
    1.11 +// which accompanies this distribution, and is available
    1.12 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.13 +//
    1.14 +// Initial Contributors:
    1.15 +// Nokia Corporation - initial contribution.
    1.16 +//
    1.17 +// Contributors:
    1.18 +//
    1.19 +// Description:
    1.20 +//
    1.21 +
    1.22 +#ifndef SOUNDDEVICE_INL
    1.23 +#define SOUNDDEVICE_INL
    1.24 +
    1.25 +#include <mmf/server/mmfdevsoundcustominterfacesupport.h>
    1.26 +
    1.27 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    1.28 +#include <mmf/server/mmfdevsoundcustominterfaceobserver.h>
    1.29 +#include <mmf/server/mmfdevsoundcustominterfacesupportclasses.h>
    1.30 +#endif
    1.31 +
    1.32 +#include <mmf/common/mmfstandardcustomcommands.h>
    1.33 +
    1.34 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    1.35 +#include <mmf/common/mmfstandardcustomcommandsenums.h>
    1.36 +#include <mmf/common/mmfstandardcustomcommandsimpl.h>
    1.37 +#endif
    1.38 +
    1.39 +
    1.40 +inline TInt CMMFDevSound::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
    1.41 +	{
    1.42 +	MAutoPauseResumeSupport* support = 
    1.43 +				static_cast<MAutoPauseResumeSupport*>(CustomInterface(KMmfUidDevSoundAudioResourceCustomInterface));
    1.44 +	if (support==NULL)
    1.45 +		{
    1.46 +		return KErrNotSupported;
    1.47 +		}
    1.48 +	if(aEventType != KMMFEventCategoryAudioResourceAvailable)
    1.49 +		{
    1.50 +		return KErrNotSupported;
    1.51 +		}
    1.52 +	else
    1.53 +		{ 
    1.54 +		return support->RegisterAsClient(aEventType, aNotificationRegistrationData);	
    1.55 +		}
    1.56 +	}
    1.57 +
    1.58 +inline TInt CMMFDevSound::CancelRegisterAsClient(TUid aEventType)
    1.59 +	{
    1.60 +	MAutoPauseResumeSupport* support = 
    1.61 +			static_cast<MAutoPauseResumeSupport*>(CustomInterface(KMmfUidDevSoundAudioResourceCustomInterface));
    1.62 +	if (support==NULL)
    1.63 +		{
    1.64 +		return KErrNotSupported;
    1.65 +		}
    1.66 +	if(aEventType != KMMFEventCategoryAudioResourceAvailable)
    1.67 +		{
    1.68 +		return KErrNotSupported;
    1.69 +		}
    1.70 +	else
    1.71 +		{
    1.72 +		return support->CancelRegisterAsClient(aEventType);
    1.73 +		}
    1.74 +	}
    1.75 +
    1.76 +inline TInt CMMFDevSound::GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData)
    1.77 +	{
    1.78 +	MAutoPauseResumeSupport* support = 
    1.79 +			static_cast<MAutoPauseResumeSupport*>(CustomInterface(KMmfUidDevSoundAudioResourceCustomInterface));
    1.80 +	if (support==NULL)
    1.81 +		{
    1.82 +		return KErrNotSupported;
    1.83 +		}
    1.84 +	if(aEventType != KMMFEventCategoryAudioResourceAvailable)
    1.85 +		{
    1.86 +		return KErrNotSupported;
    1.87 +		}
    1.88 +	else
    1.89 +		{
    1.90 +		return support->GetResourceNotificationData(aEventType, aNotificationData);
    1.91 +		}
    1.92 +	}
    1.93 +
    1.94 +inline TInt CMMFDevSound::WillResumePlay()
    1.95 +	{
    1.96 +	MAutoPauseResumeSupport* support = 
    1.97 +			static_cast<MAutoPauseResumeSupport*>(CustomInterface(KMmfUidDevSoundAudioResourceCustomInterface));
    1.98 +	if (support==NULL)
    1.99 +		{
   1.100 +		return KErrNotSupported;
   1.101 +		}
   1.102 +	return support->WillResumePlay();
   1.103 +	}
   1.104 +
   1.105 +inline TInt CMMFDevSound::EmptyBuffers()
   1.106 +	{
   1.107 +	MMMFDevSoundEmptyBuffers* emptybuffers = 
   1.108 +			static_cast<MMMFDevSoundEmptyBuffers*>(CustomInterface(KMmfUidDevSoundEmptyBuffersCustomInterface));
   1.109 +	if (emptybuffers == NULL)
   1.110 +		{
   1.111 +		return KErrNotSupported;
   1.112 +		}
   1.113 +	return emptybuffers->EmptyBuffers();
   1.114 +	}
   1.115 +
   1.116 +inline TInt CMMFDevSound::CancelInitialize()
   1.117 +	{
   1.118 +	MMMFDevSoundCancelInitialize* cancelInitialize = 
   1.119 +			static_cast<MMMFDevSoundCancelInitialize*>(CustomInterface(KMmfUidDevSoundCancelInitializeCustomInterface));
   1.120 +	if (cancelInitialize == NULL)
   1.121 +		{
   1.122 +		return KErrNotSupported;
   1.123 +		}
   1.124 +	return cancelInitialize->CancelInitialize();
   1.125 +	}
   1.126 +
   1.127 +/*
   1.128 + *  -doxygen comments in header-
   1.129 + */
   1.130 +inline TInt CMMFDevSound::SetClientThreadInfo(TThreadId aTid)
   1.131 +	{
   1.132 +	MAudioClientThreadInfo* threadInfo = 
   1.133 +			static_cast<MAudioClientThreadInfo*>(CustomInterface(KMmfUidDevSoundAudioClientThreadInfoCustomInterface));
   1.134 +	if (threadInfo)
   1.135 +		{
   1.136 +		return threadInfo->SetClientThreadInfo(aTid);
   1.137 +		}
   1.138 +	else
   1.139 +		{
   1.140 +		return KErrNotSupported;
   1.141 +		}
   1.142 +	}
   1.143 +
   1.144 +inline TInt CMMFDevSound::GetTimePlayed(TTimeIntervalMicroSeconds& aTime)
   1.145 +	{
   1.146 +	MMMFDevSoundTimePlayed* timePlayed = 
   1.147 +			static_cast<MMMFDevSoundTimePlayed*>(CustomInterface(KMmfUidDevSoundTimePlayedCustomInterface));
   1.148 +	if (timePlayed == NULL)
   1.149 +		{
   1.150 +		return KErrNotSupported;
   1.151 +		}
   1.152 +	return timePlayed->GetTimePlayed(aTime);
   1.153 +	}
   1.154 +
   1.155 +inline TBool CMMFDevSound::IsGetTimePlayedSupported()
   1.156 +	{
   1.157 +	MMMFDevSoundTimePlayed* timePlayed = 
   1.158 +			static_cast<MMMFDevSoundTimePlayed*>(CustomInterface(KMmfUidDevSoundTimePlayedCustomInterface));
   1.159 +	if (timePlayed == NULL)
   1.160 +		{
   1.161 +		return EFalse;
   1.162 +		}
   1.163 +	return ETrue;
   1.164 +	}
   1.165 +
   1.166 +inline TBool CMMFDevSound::QueryIgnoresUnderflow()
   1.167 +	{
   1.168 +	MMMFDevSoundQueryIgnoresUnderflow* ignoresUnderflow = 
   1.169 +			static_cast<MMMFDevSoundQueryIgnoresUnderflow*>(CustomInterface(KMmfUidDevSoundQueryIgnoresUnderflowCustomInterface));
   1.170 +	if (ignoresUnderflow == NULL)
   1.171 +		{
   1.172 +		return EFalse;
   1.173 +		}
   1.174 +	return ignoresUnderflow->QueryIgnoresUnderflow();
   1.175 +	}
   1.176 +
   1.177 +inline TBool CMMFDevSound::IsResumeSupported()
   1.178 +	{
   1.179 +	MMMFDevSoundTruePause* truePause = 
   1.180 +			static_cast<MMMFDevSoundTruePause*>(CustomInterface(KMmfUidDevSoundTruePauseCustomInterface));
   1.181 +	if (truePause == NULL)
   1.182 +		{
   1.183 +		return EFalse;
   1.184 +		}
   1.185 +	return truePause->IsResumeSupported();
   1.186 +	}
   1.187 +
   1.188 +inline TInt CMMFDevSound::Resume()
   1.189 +	{
   1.190 +	MMMFDevSoundTruePause* truePause = 
   1.191 +			static_cast<MMMFDevSoundTruePause*>(CustomInterface(KMmfUidDevSoundTruePauseCustomInterface));
   1.192 +	if (truePause == NULL || EFalse == truePause->IsResumeSupported() )
   1.193 +		{
   1.194 +		return KErrNotSupported;
   1.195 +		}
   1.196 +	return truePause->Resume();
   1.197 +	}
   1.198 +
   1.199 +#endif // SOUNDDEVICE_INL