devsound/a3fdevsound/src/mmfdevsound/sounddevicebody.h
author hgs
Thu, 07 Oct 2010 22:34:12 +0100
changeset 0 b8ed18f6c07b
permissions -rw-r--r--
2010wk40
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
     1
/*
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
     2
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
     3
* All rights reserved.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
     8
*
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
     9
* Initial Contributors:
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    11
*
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    12
* Contributors:
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    13
*
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    14
* Description:
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    15
*
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    16
*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    17
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    18
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    19
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    20
#ifndef SOUNDDEVICEBODY_H
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    21
#define SOUNDDEVICEBODY_H
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    22
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    23
//  INCLUDES
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    24
#include <mmf/server/sounddevice.h>
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    25
#include "mmfdevsoundproxy.h"
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    26
#include <mmf/server/mmfdevsoundcustominterfacesupport.h>
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    27
#include <mmf/server/mmfdevsoundcustominterface.h>
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    28
#include <a3f/mmfdevsoundcustominterfaceextensions.h>
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    29
#include "MmfDevSoundCIMuxUtility.h"
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    30
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    31
/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    32
*  This is the Body for CMMFDevSound.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    33
*
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    34
*  @lib MMFDevSound.lib
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    35
*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    36
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    37
NONSHARABLE_CLASS( CMMFDevSound::CBody ) : public CBase,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    38
										   public MMMFDevSoundCancelInitialize,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    39
										   public MMMFDevSoundCustomInterfaceChannel,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    40
										   public MMMFDevSoundCustomInterfaceObserver,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    41
										   public MMMFDevSoundEmptyBuffers,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    42
										   public MAutoPauseResumeSupport,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    43
										   public MMMFDevSoundTimePlayed,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    44
										   public MMMFDevSoundQueryIgnoresUnderflow,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    45
										   public MAudioClientThreadInfo, 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    46
										   public MMMFDevSoundTruePause
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    47
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    48
	{
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    49
public:  // Constructors and destructor
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    50
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    51
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    52
	* Factory function - returning instance of the class.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    53
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    54
	static CBody* NewL();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    55
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    56
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    57
	* Destructor.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    58
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    59
	* Deletes all objects and releases all resources owned by this
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    60
	* instance.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    61
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    62
	~CBody();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    63
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    64
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    65
	* Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    66
	* On completion of Initialization, calls InitializeComplete() on
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    67
	* aDevSoundObserver.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    68
	* @param aDevSoundObserver. A reference to DevSound observer instance.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    69
	* @param aMode. Mode for which this object will be used.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    70
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    71
	void InitializeL(MDevSoundObserver& aDevSoundObserver,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    72
	                 TMMFState aMode);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    73
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    74
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    75
	* Initializes DevSound object for the mode aMode for processing audio
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    76
	* data with hardware device supporting FourCC aDesiredFourCC.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    77
	* @param  aDevSoundObserver. A reference to DevSound observer instance.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    78
	* @param  aDesiredFourCC. The CMMFHwDevice implementation FourCC code.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    79
	* @param  aMode. The mode for which this object will be used
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    80
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    81
	void InitializeL(MDevSoundObserver& aDevSoundObserver,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    82
	                 TFourCC aDesiredFourCC,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    83
	                 TMMFState aMode);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    84
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    85
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    86
	* Returns the supported Audio settings ie. encoding, sample rates,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    87
	* mono/stereo operation, buffer size etc..
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    88
	* @return TMMFCapabilities. The device settings.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    89
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    90
	inline TMMFCapabilities Capabilities();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    91
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    92
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    93
	* Returns the current device configuration.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    94
	* @return TMMFCapabilities. The device settings.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    95
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    96
	inline TMMFCapabilities Config() const;
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    97
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    98
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
    99
	* Configure CMMFDevSound object with the settings in aConfig. Use this
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   100
	* to set sampling rate, encoding and mono/stereo.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   101
	* @param aConfig. The attribute values to which CMMFDevSound object will be configured to.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   102
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   103
	inline void SetConfigL(const TMMFCapabilities& aCaps);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   104
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   105
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   106
	* Returns an integer representing the maximum volume device supports.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   107
	* This is the maximum value which can be passed to
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   108
	* CMMFDevSound::SetVolume.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   109
	* @return TInt The maximum volume. This value is platform dependent but is always greater than or equal to one.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   110
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   111
	inline TInt MaxVolume();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   112
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   113
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   114
	* Returns an integer representing the current volume.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   115
	* @return TInt The current volume level.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   116
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   117
	inline TInt Volume();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   118
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   119
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   120
	* Changes the current playback volume to a specified value. The volume
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   121
	* can be changed before or during playback and is effective immediately.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   122
	* @param aVolume. The volume setting. This can be any value from 0
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   123
	*        to the value returned by a call to
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   124
	*        CMMFDevSound::MaxVolume(). If the volume is not
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   125
	*        within this range, the volume is automatically set
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   126
	*        to minimum or maximum value based on the value
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   127
	*        that is being passed. Setting a zero value mutes
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   128
	*        the sound. Setting the maximum value results in
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   129
	*        the loudest possible sound.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   130
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   131
	inline void SetVolume(TInt aVolume);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   132
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   133
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   134
	* Returns an integer representing the maximum gain the device supports.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   135
	* This is the maximum value which can be passed to CMMFDevSound::SetGain
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   136
	* @return TInt The maximum gain. This value is platform dependent but is
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   137
	*        always greater than or equal to one.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   138
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   139
	inline TInt MaxGain();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   140
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   141
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   142
	* Returns an integer representing the current gain.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   143
	* @return TInt The current gain level.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   144
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   145
	inline TInt Gain();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   146
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   147
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   148
	* Changes the current recording gain to a specified value. The gain can
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   149
	* be changed before or during recording and is effective immediately.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   150
	* @param aGain. The gain setting. This can be any value from zero to
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   151
	*        the value returned by a call to
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   152
	*        CMMFDevSound::MaxGain(). If the volume
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   153
	*        is not within this range, the gain is automatically
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   154
	*        set to minimum or maximum value based on the value
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   155
	*        that is being passed. Setting a zero value mutes the
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   156
	*        sound. Setting the maximum value results in the
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   157
	*        loudest possible sound.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   158
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   159
	inline void SetGain(TInt aGain);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   160
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   161
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   162
	* Returns the speaker balance set for playing.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   163
	* @param aLeftPercentage. On return contains the left speaker volume percentage.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   164
	* @param aRightPercentage. On return contains the right speaker volume percentage.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   165
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   166
	inline void GetPlayBalanceL(TInt& aLeftPercentage,TInt& aRightPercentage);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   167
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   168
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   169
	* Sets the speaker balance for playing. The speaker balance can be
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   170
	* changed before or during playback and is effective immediately.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   171
	* @param aLeftPercentage. The left speaker volume percentage. This
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   172
	*        can be any value from zero to 100. Setting
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   173
	*        a zero value mutes the sound on left
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   174
	*        speaker.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   175
	* @param aRightPercentage. The right speaker volume percentage.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   176
	*        This can be any value from zero to 100.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   177
	*        Setting a zero value mutes the sound on
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   178
	*        right speaker.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   179
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   180
	inline void SetPlayBalanceL(TInt aLeftPercentage,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   181
	                            TInt aRightPercentage);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   182
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   183
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   184
	* Returns the microphone gain balance set for recording.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   185
	* @param aLeftPercentage On return contains the left microphone
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   186
	*        gain percentage.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   187
	* @param aRightPercentage On return contains the right microphone
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   188
	*        gain percentage.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   189
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   190
	inline void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   191
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   192
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   193
	* Sets the microphone balance for recording. The microphone balance can
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   194
	* be changed before or during recording and is effective immediately.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   195
	* @param aLeftPercentage. The left microphone gain percentage. This
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   196
	*        can be any value from zero to 100. Setting
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   197
	*        a zero value mutes the sound from left
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   198
	*        microphone.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   199
	* @param aRightPercentage. The right microphone gain percentage.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   200
	*        This can be any value from zero to 100.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   201
	*        Setting a zero value mutes the sound from
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   202
	*        right microphone.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   203
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   204
	inline void SetRecordBalanceL(TInt aLeftPercentage,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   205
	                              TInt aRightPercentage);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   206
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   207
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   208
	* Initializes the audio device and starts the play process. This
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   209
	* function queries and acquires the audio policy before initializing
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   210
	* audio device. If there was an error during policy initialization,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   211
	* PlayError() function will be called on the observer with error code
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   212
	* KErrAccessDenied, otherwise BufferToBeFilled() function will be called
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   213
	* with a buffer reference. After reading data into the buffer reference
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   214
	* passed, the client should call PlayData() to play data.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   215
	* The amount of data that can be played is specified in
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   216
	* CMMFBuffer::RequestSize(). Any data that is read into buffer beyond
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   217
	* this size will be ignored.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   218
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   219
	inline void PlayInitL();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   220
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   221
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   222
	* Initializes the audio device and starts the record process. This
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   223
	* function queries and acquires the audio policy before initializing
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   224
	* audio device. If there was an error during policy initialization,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   225
	* RecordError() function will be called on the observer with error code
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   226
	* KErrAccessDenied, otherwise BufferToBeEmptied() function will be
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   227
	* called with a buffer reference. This buffer contains recorded or
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   228
	* encoded data. After processing data in the buffer reference passed,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   229
	* the client should call RecordData() to continue recording process.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   230
	* The amount of data that is available is specified in
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   231
	* CMMFBuffer::RequestSize().
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   232
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   233
	inline void RecordInitL();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   234
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   235
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   236
	* Plays data in the buffer at the current volume.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   237
	* The client should fill the buffer with audio data before calling this
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   238
	* function. The observer gets a reference to the buffer along with the
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   239
	* callback function BufferToBeFilled(). When playing of the audio sample
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   240
	* is complete, successfully or otherwise, the function PlayError() on
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   241
	* the observer is called.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   242
	* The last buffer of the audio stream being played should have the last
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   243
	* buffer flag set using CMMFBuffer::SetLastBuffer(TBool). If a
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   244
	* subsequent attempt to play the clip is made, this flag will need
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   245
	* resetting by the client.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   246
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   247
	inline void PlayData();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   248
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   249
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   250
	* Contine the process of recording.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   251
	* Once the buffer is filled with recorded data, the Observer gets a
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   252
	* reference to the buffer along with the callback function
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   253
	* BufferToBeEmptied(). After processing the buffer (copying over to a
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   254
	* different buffer or writing to file) the client should call this
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   255
	* function to continue the recording process.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   256
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   257
	inline void RecordData();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   258
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   259
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   260
	* Stops the ongoing operation (Play, Record, TonePlay).
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   261
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   262
	inline void Stop();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   263
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   264
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   265
	* Temporarily Stops the ongoing operation (Play, Record, TonePlay).
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   266
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   267
	inline void Pause();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   268
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   269
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   270
	* Returns the Sample recorded so far
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   271
	* @return TInt Returns the samples recorded.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   272
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   273
	inline TInt SamplesRecorded();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   274
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   275
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   276
	* Returns the Sample played so far
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   277
	* @return TInt Returns the samples played.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   278
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   279
	inline TInt SamplesPlayed();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   280
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   281
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   282
	* Initializes the audio device and starts playing a tone. The tone is
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   283
	* played with the frequency and duration specified.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   284
	* Leaves on failure.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   285
	* @param aFrequency. The frequency at which the tone will be played.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   286
	* @param const TTimeIntervalMicroSeconds &aDuration The period over
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   287
	*        which the tone will be played. A zero value causes the no tone
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   288
	*        to be played.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   289
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   290
	inline void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   291
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   292
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   293
	* Initializes audio device and starts playing a dual tone. Dual Tone is
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   294
	* played with the specified frequencies and for the specified duration.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   295
	* @param aFrequencyOne The first frequency of dual tone.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   296
	* @param aFrequencyTwo The second frequency of dual tone.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   297
	* @param aDuration The period over which the tone will be played. 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   298
	* A zero value causes the no tone to be played.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   299
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   300
	inline void PlayDualToneL(
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   301
	            TInt aFrequencyOne,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   302
	            TInt aFrequencyTwo,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   303
	            const TTimeIntervalMicroSeconds& aDuration);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   304
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   305
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   306
	* Initializes the audio device and starts playing the DTMF string
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   307
	* aDTMFString.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   308
	* @param aDTMFString The DTMF sequence in a descriptor.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   309
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   310
	inline void PlayDTMFStringL(const TDesC& aDTMFString);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   311
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   312
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   313
	* Initializes the audio device and starts playing a tone sequence.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   314
	* @param aData The tone sequence in a descriptor.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   315
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   316
	inline void PlayToneSequenceL(const TDesC8& aData);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   317
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   318
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   319
	* Defines the number of times the audio is to be repeated during the
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   320
	* tone playback operation. A period of silence can follow each playing
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   321
	* of a tone. The tone playing can be repeated indefinitely
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   322
	* @param aRepeatCount. The number of times the tone, together with
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   323
	*        the trailing silence, is to be repeated. If this is set to
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   324
	*        KMdaRepeatForever, then the tone, together with the trailing
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   325
	*        silence, is repeated indefinitely or until Stop() is called.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   326
	*        If this is set to zero, then the tone is not repeated.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   327
	* @param aRepeatTrailingSilence An interval of silence which will be played after each tone.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   328
	*        Supported only during tone playing.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   329
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   330
	inline void SetToneRepeats(
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   331
	            TInt aRepeatCount,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   332
	            const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   333
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   334
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   335
	* Defines the duration of tone on, tone off and tone pause to be used
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   336
	* during the DTMF tone playback operation.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   337
	* Supported only during tone playing.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   338
	* @param aToneOnLength The period over which the tone will be played.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   339
	* If this is set to zero, then the tone is not played.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   340
	* @param aToneOffLength The period over which the no tone will be played.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   341
	* @param aPauseLength The period over which the tone playing will be paused.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   342
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   343
	inline void SetDTMFLengths(
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   344
	            TTimeIntervalMicroSeconds32& aToneOnLength,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   345
	            TTimeIntervalMicroSeconds32& aToneOffLength,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   346
	            TTimeIntervalMicroSeconds32& aPauseLength);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   347
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   348
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   349
	* Defines the period over which the volume level is to rise smoothly
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   350
	* from nothing to the normal volume level.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   351
	* The function is only available before playing.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   352
	* @param aRampDuration The period over which the volume is to rise. 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   353
	* 	 A zero value causes the tone sample to be played at the 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   354
	* 	 normal level for the full duration of the playback. 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   355
	* 	 A value, which is longer than the duration of
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   356
	*        the tone sample means that the sample never reaches its normal
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   357
	*        volume level.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   358
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   359
	inline void SetVolumeRamp(
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   360
	            const TTimeIntervalMicroSeconds& aRampDuration);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   361
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   362
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   363
	* Defines the priority settings that should be used for this instance.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   364
	* @param aPrioritySettings. A class type representing the client's priority, 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   365
	* priority preference and state
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   366
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   367
	inline void SetPrioritySettings(
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   368
	            const TMMFPrioritySettings& aPrioritySettings);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   369
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   370
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   371
	* Retrieves a custom interface to the device.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   372
	* @param aInterfaceId. The interface UID, defined with the custom
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   373
	*        interface.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   374
	* @return TAny* A pointer to the interface implementation, or NULL if
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   375
	*        the device does not implement the interface requested. The
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   376
	*        return value must be cast to the correct type by the user.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   377
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   378
	TAny* CustomInterface(TUid aInterfaceId);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   379
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   380
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   381
	* Returns a list of the supported input datatypes that can be sent to
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   382
	* DevSound for playing audio. The datatypes returned are those that the
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   383
	* DevSound supports given the priority settings passed in
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   384
	* aPrioritySettings. Note that if no supported data types are found this
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   385
	* does not constitute failure, the function will return normally with no
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   386
	* entries in aSupportedDataTypes.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   387
	* @param aSupportedDataTypes The array of supported
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   388
	*        data types that will be filled in by this function. The
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   389
	*        supported data types of the DevSound are in the form of an
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   390
	*        array of TFourCC codes. Any existing entries in the array will
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   391
	*        be overwritten on calling this function. If no supported data
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   392
	*        types are found given the priority settings, then the
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   393
	*        aSupportedDatatypes array will have zero entries.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   394
	* @param aPrioritySettings The priority settings used to determine the 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   395
	* 	 supported datatypes. Note this does not set the priority settings. 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   396
	* 	 For input datatypes the iState member of the priority settings would 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   397
	* 	 be expected to be either EMMFStatePlaying or EMMFStatePlayingRecording.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   398
	* 	 The priority settings may effect the supported datatypes depending
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   399
	*        on the audio routing.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   400
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   401
	inline void GetSupportedInputDataTypesL(
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   402
	            RArray<TFourCC>& aSupportedDataTypesconst,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   403
	            const TMMFPrioritySettings& aPrioritySettings) const;
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   404
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   405
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   406
	* Returns a list of the supported output dataypes that can be received
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   407
	* from DevSound for recording audio. The datatypes returned are those
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   408
	* that the DevSound supports given the priority settings passed in
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   409
	* aPrioritySettings. Note that if no supported data types are found this
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   410
	* does not constitute failure, the function will return normally with no
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   411
	* entries in aSupportedDataTypes.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   412
	* @param aSupportedDataTypes. The array of supported
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   413
	*        data types that will be filled in by this function. The
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   414
	*        supported datatypes of the DevSound are in the form of an array
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   415
	*        of TFourCC codes. Any existing entries in the array will be
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   416
	*        overwritten on calling this function. If no supported datatypes
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   417
	*        are found given the priority settings, then the
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   418
	*        aSupportedDatatypes array will have zero entries.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   419
	* @param aPrioritySettings. The priority settings used to determine the supported 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   420
	*        data types. Note this does not set the priority settings. For output data types the
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   421
	*        iState member of the priority settings would expected to be
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   422
	*        either EMMFStateRecording or EMMFStatePlayingRecording. The
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   423
	*        priority settings may effect the supported datatypes depending
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   424
	*        on the audio routing.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   425
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   426
	inline void GetSupportedOutputDataTypesL(
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   427
	            RArray<TFourCC>& aSupportedDataTypes,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   428
	            const TMMFPrioritySettings& aPrioritySettings) const;
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   429
	            
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   430
	/** 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   431
	Registers the client for notification of resource avalibility.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   432
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   433
	@param  aEventType
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   434
	        The Notification event type for which the client needs notification.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   435
	@param  aNotificationRegistrationData
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   436
	        The Notification Registration data has been reserved for future use and its value should be always NULL
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   437
	@return An error code indicating if the function call was successful. KErrNone on success, 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   438
			KErrNotSupported if the event type is not supported, KErrArgument if the notification data
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   439
			is not null otherwise another of the system-wide error codes.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   440
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   441
	inline TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   442
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   443
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   444
	Cancels the Registered Notification.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   445
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   446
	@param  aEventType. The Event type need to cancel
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   447
	@return An error code indicating if the function call was successful. KErrNone on success, KErrNotSupported
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   448
			if the event type is not supported otherwise another of the system-wide error codes.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   449
	*/	
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   450
	inline TInt CancelRegisterAsClient(TUid aEventType);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   451
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   452
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   453
	Returns the Notification data which the client needs to resume playing.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   454
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   455
	@param aEventType. The Event type for which to get notification data  
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   456
	@param aNotificationData
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   457
			The reference data for which the client needs to resume the play. The actual data depends on the event type.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   458
			Note that for the event type 'KMMFEventCategoryAudioResourceAvailable' the package buffer returned
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   459
			is TMMFTimeIntervalMicroSecondsPckg,but the contents should be converted to an integer and
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   460
			interpreted as the data returned is samples played ,but not as a microsecond value.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   461
	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   462
	        another of the system-wide error codes.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   463
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   464
	inline TInt GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   465
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   466
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   467
	Wait for the clients to resume play back even after the default timeout expires.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   468
	Unless the client cancels the notification request or completes no other client gets
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   469
	notification.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   470
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   471
	@return An error code indicating if the function call was successful. KErrNone on success, 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   472
	        otherwise another of the system-wide error codes.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   473
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   474
	inline TInt WillResumePlay();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   475
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   476
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   477
	Empties the play buffers below DevSound without causing the codec to be deleted.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   478
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   479
	@return An error code indicating if the function call was successful. KErrNone on success,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   480
			KErrNotSupported if called in a mode other than EMMFStatePlaying or if the function is otherwise not supported,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   481
			KErrNotReady if this is called before playing,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   482
			otherwise another of the system-wide error codes.
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   483
			If this function is not supported, it is advised to use Stop().
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   484
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   485
	inline TInt EmptyBuffers();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   486
	
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   487
	//from MMMFDevSoundCancelInitialize
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   488
	/** 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   489
		
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   490
	Cancels the initialization process of a CMMFDevSound object
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   491
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   492
	@return An error code indicating if the function call was successful. 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   493
			KErrNone on success,
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   494
			KerrNotReady if this is called before InitializeL() call or after      
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   495
			the object has been initialized 
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   496
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   497
	inline TInt CancelInitialize();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   498
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   499
	// from MMMFDevSoundCustomInterfaceChannel
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   500
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   501
	Implements a synchronous custom command
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   502
	@param aUid
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   503
		   The UID of the custom command
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   504
	@param aParam1
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   505
		   A buffer of data to be supplied to the receiver
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   506
	@param aParam2
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   507
		   A buffer of data to be supplied to the receiver
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   508
	@param aOutParam
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   509
		   A buffer that will be written into by the receiver
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   510
		   and returned to the client
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   511
	@return the result of the custom command
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   512
	 */
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   513
	TInt SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   514
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   515
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   516
	Implements an asynchronous custom command
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   517
	@param aUid
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   518
		   The UID of the custom command
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   519
	@param aStatus
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   520
		   The request status of the active object that
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   521
		   will be called upon the completion of the request
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   522
	@param aParam1
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   523
		   A buffer of data to be supplied to the receiver
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   524
	@param aParam2
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   525
		   A buffer of data to be supplied to the receiver
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   526
	@param aOutParam
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   527
		   A buffer that will be written into by the receiver
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   528
		   and returned to the client
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   529
	 */
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   530
	void AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   531
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   532
	//from MMMFDevSoundCustomInterfaceObserver
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   533
	void CloseCustomInterface(TInt aInterfaceId);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   534
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   535
	//from MMMFDevSoundTimePlayed
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   536
	TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   537
	
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   538
	//MMMFDevSoundQueryIgnoresUnderflow
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   539
	TBool QueryIgnoresUnderflow();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   540
	
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   541
	// Set the real client thread with thread Id
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   542
	TInt SetClientThreadInfo(TThreadId aTid);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   543
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   544
	// from MMMFDevSoundTruePause
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   545
	TBool IsResumeSupported();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   546
	TInt Resume();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   547
protected:
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   548
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   549
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   550
	* Constructor
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   551
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   552
	CBody();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   553
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   554
	/**
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   555
	* Symbian constructor
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   556
	*/
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   557
	void ConstructL();
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   558
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   559
	TInt FindCustomInterface(TUid aInterfaceId);
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   560
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   561
	// custom interface storage
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   562
	RArray<TMMFDevSoundCustomInterfaceData> iCustomInterfaceArray;
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   563
	CMMFDevSoundCIMuxUtility* iMuxUtility;
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   564
	// Reference to DevSound proxy
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   565
	RMMFDevSoundProxy* iDevSoundProxy;
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   566
	// CI Extension
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   567
	MDevSoundCIClientExtension* iCIExtension;
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   568
	};
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   569
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   570
#include "sounddevicebody.inl"
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   571
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   572
#endif // SOUNDDEVICEBODY_H
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   573
b8ed18f6c07b 2010wk40
hgs
parents:
diff changeset
   574
// End of File