os/mm/mmlibs/mmfw/inc/MdaAudioTonePlayer.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#ifndef __MDAAUDIOTONEPLAYER_H__
sl@0
    17
#define __MDAAUDIOTONEPLAYER_H__
sl@0
    18
sl@0
    19
sl@0
    20
#include <e32std.h>
sl@0
    21
#include <mmf/common/mmfbase.h>
sl@0
    22
#include <mmf/common/mmfstandardcustomcommands.h>
sl@0
    23
#include <mmfclntutility.h>
sl@0
    24
sl@0
    25
class CMdaServer;
sl@0
    26
sl@0
    27
sl@0
    28
/**
sl@0
    29
@publishedAll
sl@0
    30
@released
sl@0
    31
sl@0
    32
The state of the audio tone utility.
sl@0
    33
*/
sl@0
    34
enum TMdaAudioToneUtilityState
sl@0
    35
	{
sl@0
    36
	/** The audio tone utility has not been prepared to play a tone.
sl@0
    37
	*/
sl@0
    38
	EMdaAudioToneUtilityNotReady=0,
sl@0
    39
	/** The audio tone utility has been prepared to play a tone and is ready.
sl@0
    40
	*/
sl@0
    41
	EMdaAudioToneUtilityPrepared,
sl@0
    42
	/** The audio tone utility is currently playing a tone.
sl@0
    43
	*/
sl@0
    44
	EMdaAudioToneUtilityPlaying,
sl@0
    45
	/** The audio tone utility is currently paused.
sl@0
    46
	This state is only reached if underlying DevSound implementations supports resume.
sl@0
    47
	*/
sl@0
    48
	EMdaAudioToneUtilityPaused
sl@0
    49
	};
sl@0
    50
sl@0
    51
const TInt KMdaInfiniteDurationDTMFToneOnLength = -1; 
sl@0
    52
const TInt KMdaAudioToneRepeatForever = -2;
sl@0
    53
sl@0
    54
/**
sl@0
    55
@publishedAll
sl@0
    56
@released
sl@0
    57
sl@0
    58
An interface to a set of audio tone player callback functions.
sl@0
    59
sl@0
    60
The class is a mixin and is intended to be inherited by the client
sl@0
    61
class which is observing the audio tone playing operation. The
sl@0
    62
functions encapsulated by this class are called when specific events
sl@0
    63
occur in the process of preparing to play a tone and during the
sl@0
    64
playing of a tone. A reference to this object is passed as a
sl@0
    65
parameter when constructing an audio tone player utility, using the
sl@0
    66
CMdaAudioToneUtility interface.
sl@0
    67
sl@0
    68
@since 5.0
sl@0
    69
*/
sl@0
    70
class MMdaAudioToneObserver
sl@0
    71
	{
sl@0
    72
public:
sl@0
    73
sl@0
    74
	/**
sl@0
    75
	Defines required client behaviour when an attempt to configure the
sl@0
    76
	audio tone player utility has completed, successfully or otherwise.
sl@0
    77
sl@0
    78
	@param     aError
sl@0
    79
	           KErrNone if successful. One of the system
sl@0
    80
	           wide error codes if the attempt failed. The possible
sl@0
    81
	           values depend on the EPOC platform.
sl@0
    82
	*/
sl@0
    83
	virtual void MatoPrepareComplete(TInt aError) = 0;
sl@0
    84
sl@0
    85
	/**
sl@0
    86
	Defines required client behaviour when the tone playing operation has
sl@0
    87
	completed, successfully or otherwise.
sl@0
    88
sl@0
    89
	@param     aError
sl@0
    90
	           KErrNone if successful. One of the system
sl@0
    91
	           wide error codes if the attempt failed. The possible
sl@0
    92
	           values depend on the EPOC platform.
sl@0
    93
	*/
sl@0
    94
	virtual void MatoPlayComplete(TInt aError) = 0;
sl@0
    95
	};
sl@0
    96
sl@0
    97
sl@0
    98
class MMdaAudioTonePlayStartObserver
sl@0
    99
	{
sl@0
   100
public:
sl@0
   101
	/**
sl@0
   102
	Defines required client behaviour when the tone playing operation has
sl@0
   103
	started, successfully or otherwise.
sl@0
   104
sl@0
   105
	@param     aError
sl@0
   106
	           KErrNone if successful. One of the system
sl@0
   107
	           wide error codes if the attempt failed. The possible
sl@0
   108
	           values depend on the EPOC platform.
sl@0
   109
	*/
sl@0
   110
	virtual void MatoPlayStarted(TInt aError) = 0;
sl@0
   111
	};
sl@0
   112
sl@0
   113
sl@0
   114
class CMMFMdaAudioToneUtility;
sl@0
   115
sl@0
   116
/**
sl@0
   117
@publishedAll
sl@0
   118
@released
sl@0
   119
sl@0
   120
Generates tones on an audio capable EPOC device.
sl@0
   121
sl@0
   122
The class offers an interface for generating tones on all audio
sl@0
   123
capable EPOC devices.
sl@0
   124
sl@0
   125
To use the tone utility:
sl@0
   126
sl@0
   127
1. Create an instance by calling NewL().
sl@0
   128
sl@0
   129
2. Call the appropriate PrepareToPlay variant for the required tone type
sl@0
   130
and wait for the callback indicating success.
sl@0
   131
sl@0
   132
3. Call Play and either wait for the callback to indicate completion,
sl@0
   133
or call CancelPlay to end playback early.
sl@0
   134
sl@0
   135
4. Delete the instance.
sl@0
   136
sl@0
   137
It is possible to call Play before calling any PrepareToPlay variant. This
sl@0
   138
will result in a default fixed sequence tone being played.
sl@0
   139
sl@0
   140
@since 5.0
sl@0
   141
*/
sl@0
   142
class CMdaAudioToneUtility : public CBase,
sl@0
   143
							 public MMMFClientUtility
sl@0
   144
	{
sl@0
   145
public:
sl@0
   146
sl@0
   147
	IMPORT_C static CMdaAudioToneUtility* NewL(MMdaAudioToneObserver& aObserver, CMdaServer* aServer = NULL);
sl@0
   148
sl@0
   149
	IMPORT_C static CMdaAudioToneUtility* NewL(MMdaAudioToneObserver& aObserver, CMdaServer* aServer,
sl@0
   150
											   TInt aPriority, 
sl@0
   151
											   TInt aPref = EMdaPriorityPreferenceTimeAndQuality);
sl@0
   152
sl@0
   153
	~CMdaAudioToneUtility();
sl@0
   154
sl@0
   155
	virtual TMdaAudioToneUtilityState State();
sl@0
   156
sl@0
   157
	virtual TInt MaxVolume();
sl@0
   158
sl@0
   159
	virtual TInt Volume();
sl@0
   160
sl@0
   161
	virtual void SetVolume(TInt aVolume);
sl@0
   162
sl@0
   163
	virtual void SetPriority(TInt aPriority, TInt aPref);
sl@0
   164
sl@0
   165
	virtual void SetDTMFLengths(TTimeIntervalMicroSeconds32 aToneLength,
sl@0
   166
								TTimeIntervalMicroSeconds32 aToneOffLength,
sl@0
   167
								TTimeIntervalMicroSeconds32 aPauseLength);
sl@0
   168
sl@0
   169
	virtual void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
sl@0
   170
sl@0
   171
	virtual void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
sl@0
   172
sl@0
   173
	virtual TInt FixedSequenceCount();
sl@0
   174
sl@0
   175
	virtual const TDesC& FixedSequenceName(TInt aSequenceNumber);
sl@0
   176
sl@0
   177
	virtual void PrepareToPlayTone(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration);
sl@0
   178
sl@0
   179
	virtual void PrepareToPlayDTMFString(const TDesC& aDTMF);
sl@0
   180
sl@0
   181
	virtual void PrepareToPlayDesSequence(const TDesC8& aSequence);
sl@0
   182
sl@0
   183
	virtual void PrepareToPlayFileSequence(const TDesC& aFileName);
sl@0
   184
sl@0
   185
	virtual void PrepareToPlayFixedSequence(TInt aSequenceNumber);
sl@0
   186
sl@0
   187
	virtual void CancelPrepare();
sl@0
   188
sl@0
   189
	virtual void Play();
sl@0
   190
sl@0
   191
	virtual void CancelPlay();
sl@0
   192
sl@0
   193
	IMPORT_C TInt Pause();
sl@0
   194
sl@0
   195
	IMPORT_C TInt Resume();
sl@0
   196
	
sl@0
   197
	IMPORT_C void SetBalanceL(TInt aBalance=KMMFBalanceCenter);
sl@0
   198
sl@0
   199
	IMPORT_C TInt GetBalanceL();
sl@0
   200
sl@0
   201
	IMPORT_C void PrepareToPlayDualTone(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration);
sl@0
   202
	
sl@0
   203
	IMPORT_C void PrepareToPlayFileSequence(RFile& aFile);
sl@0
   204
	
sl@0
   205
	IMPORT_C TAny* CustomInterface(TUid aInterfaceId);
sl@0
   206
sl@0
   207
	IMPORT_C void RegisterPlayStartCallback(MMdaAudioTonePlayStartObserver& aObserver);
sl@0
   208
sl@0
   209
protected:
sl@0
   210
	/**
sl@0
   211
	This member is internal and not intended for use.
sl@0
   212
	*/
sl@0
   213
	CMMFMdaAudioToneUtility* iProperties;
sl@0
   214
	};
sl@0
   215
sl@0
   216
sl@0
   217
#endif