os/mm/devsound/devsoundrefplugin/src/platsec/SoundDevice/SoundDeviceBody.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsound/devsoundrefplugin/src/platsec/SoundDevice/SoundDeviceBody.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,185 @@
     1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __SOUNDDEVICEBODY__H__
    1.20 +#define __SOUNDDEVICEBODY__H__
    1.21 +
    1.22 +#include "MmfDevSoundCallbackHandler.h" 
    1.23 +#include <mmf/plugin/devsoundplugin.h>
    1.24 +#include <mmf/server/mmfdevsoundcustominterfacesupport.h>
    1.25 +#include <mmf/server/mmfdevsoundcustominterface.h>
    1.26 +#include "MmfDevSoundCIMuxUtility.h"
    1.27 +
    1.28 + 
    1.29 +/*
    1.30 + *
    1.31 + *	Class Name:	CMMFDevSoundClientImp
    1.32 + *
    1.33 + *	Reference internals for CMMFDevSound
    1.34 + *  @internalComponent
    1.35 + *
    1.36 + */
    1.37 +class CMMFDevSoundClientImp : public CBase, 
    1.38 +							  public MMMFDevSoundPlugin,
    1.39 +							  public MAudioClientThreadInfo,
    1.40 +  							  public MAutoPauseResumeSupport,
    1.41 +							  public MMMFDevSoundCustomInterfaceChannel,
    1.42 +							  public MMMFDevSoundEmptyBuffers,
    1.43 +							  public MMMFDevSoundCustomInterfaceObserver,
    1.44 +							  public MMMFDevSoundTimePlayed
    1.45 +
    1.46 +	{
    1.47 +public:
    1.48 +	static CMMFDevSoundClientImp* NewL();
    1.49 +	~CMMFDevSoundClientImp();
    1.50 +
    1.51 +	// Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz. 
    1.52 +	void InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode);
    1.53 +	// Initializes with hardware device and mode (play, record, convert)
    1.54 +	void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode);
    1.55 +	// Initializes with hardware device associated with specific FourCC code 
    1.56 +	// and desired mode (play, record, convert)
    1.57 +	void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode); 
    1.58 +
    1.59 +	// Returns device capabilities
    1.60 +	TMMFCapabilities Capabilities();
    1.61 +	// Returns device configuration
    1.62 +	TMMFCapabilities Config() const;
    1.63 +	// Sets device configuration
    1.64 +	void SetConfigL(const TMMFCapabilities& aCaps);
    1.65 +
    1.66 +	// Returns maximum play volume device supports
    1.67 +	TInt MaxVolume();
    1.68 +	// Returns play volume device is configured to
    1.69 +	TInt Volume();
    1.70 +	// Sets device play volume
    1.71 +	void SetVolume(TInt aVolume);
    1.72 +
    1.73 +	// Returns maximum record gain device supports
    1.74 +	TInt MaxGain();
    1.75 +	// Returns record gain device is configured to
    1.76 +	TInt Gain();
    1.77 +	// Sets device record gain
    1.78 +	void SetGain(TInt aGain);
    1.79 +
    1.80 +	// Returns play balance
    1.81 +	void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
    1.82 +	// Sets play balance
    1.83 +	void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
    1.84 +
    1.85 +	// Returns record balance
    1.86 +	void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
    1.87 +	// Sets record balance
    1.88 +	void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
    1.89 +
    1.90 +	// Initializes audio device and start play process
    1.91 +	void PlayInitL();
    1.92 +	// Initializes audio device and start record process
    1.93 +	void RecordInitL();
    1.94 +	// Plays the data in the buffer
    1.95 +	void PlayData();
    1.96 +	// Records data into buffer
    1.97 +	void RecordData();
    1.98 +	// Stops the ongoing operation
    1.99 +	void Stop();
   1.100 +	// Tempororily Stops the ongoing operation
   1.101 +	void Pause();
   1.102 +
   1.103 +	// Returns the Sample recorded so far
   1.104 +	TInt SamplesRecorded();
   1.105 +	// Returns the Sample played so far
   1.106 +	TInt SamplesPlayed();
   1.107 +
   1.108 +	// Initializes device and start playing tone
   1.109 +	void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration);
   1.110 +	// Initializes device and start playing dual tone
   1.111 +	void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration);
   1.112 +	// Initializes device and start playing DTMF String
   1.113 +	void PlayDTMFStringL(const TDesC& aDTMFString);
   1.114 +	// Initializes device and start playing tone sequence
   1.115 +	void PlayToneSequenceL(const TDesC8& aData);
   1.116 +	// Initializes device and start playing fixed sequence
   1.117 +	void PlayFixedSequenceL(TInt aSequenceNumber);
   1.118 +
   1.119 +	// Sets tone repeat attributes
   1.120 +	void SetToneRepeats(TInt aRepeatCount,
   1.121 +					const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
   1.122 +	// Sets DTMF tone attributes
   1.123 +	void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
   1.124 +									TTimeIntervalMicroSeconds32& aToneOffLength,
   1.125 +									TTimeIntervalMicroSeconds32& aPauseLength);
   1.126 +	// Sets volume ramp for playing
   1.127 +	void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
   1.128 +	// Sets priority settings
   1.129 +	void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
   1.130 +
   1.131 +	// Provides interface for sending custom commands for the audio device
   1.132 +	TAny* CustomInterface(TUid aInterfaceId);
   1.133 +
   1.134 +	// Provides interface for querying fixed sequence count
   1.135 +	TInt FixedSequenceCount();
   1.136 +	// Provides interface for querying fixed sequence name
   1.137 +	const TDesC& FixedSequenceName(TInt aSequenceNumber);
   1.138 +	// Gets the supported input datatypes
   1.139 +	void GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypesconst, const TMMFPrioritySettings& aPrioritySettings) const;
   1.140 +	// Gets the supported output datatypes
   1.141 +	void GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const;
   1.142 +	// Set the real client thread with thread Id
   1.143 +	TInt SetClientThreadInfo(TThreadId aTid);
   1.144 +
   1.145 +	// Registers the client for notification
   1.146 +	TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8);
   1.147 +	//cancels the registered notification
   1.148 +	TInt CancelRegisterAsClient(TUid aEventType);
   1.149 +	//get the notification data to resume 
   1.150 +	TInt GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData);
   1.151 +	//if client need more than the default timeout period
   1.152 +	TInt WillResumePlay();
   1.153 +	
   1.154 +	// from MMMFDevSoundEmptyBuffers
   1.155 +	//Empties the buffers below DevSound without causing the codec to be deleted.
   1.156 +	TInt EmptyBuffers();
   1.157 +
   1.158 +	// added to support custom command passing through DevSound
   1.159 +	TInt SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam);
   1.160 +	void AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam);
   1.161 +
   1.162 +	//from MMMFDevSoundCustomInterfaceObserver
   1.163 +	void CloseCustomInterface(TInt aIndex);
   1.164 +	
   1.165 +	//from MMMFDevSoundTimePlayed
   1.166 +	TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime);
   1.167 +private:
   1.168 +	// So that nobody can extend 
   1.169 +	CMMFDevSoundClientImp();
   1.170 +	// Second phase constructor
   1.171 +	void ConstructL();
   1.172 +
   1.173 +	TInt FindCustomInterface(TUid aInterfaceId);
   1.174 +private:
   1.175 +	// custom interface storage
   1.176 +	RArray<TMMFDevSoundCustomInterfaceData> iCustomInterfaceArray;
   1.177 +	CMMFDevSoundCIMuxUtility* iMuxUtility;
   1.178 +	
   1.179 +	RMMFDevSoundProxy* iDevSoundProxy;
   1.180 +	MDevSoundObserver* iDevSoundObserver;
   1.181 +	
   1.182 +	RMsgQueue<TMMFDevSoundQueueItem> iMsgQueue;
   1.183 +	CMsgQueueHandler* iMsgQueueHandler;
   1.184 +	};
   1.185 +
   1.186 +#include "SoundDeviceBody.inl"
   1.187 +
   1.188 +#endif // __SOUNDDEVICEBODY__H__