epoc32/include/mmf/common/mmfaudio.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 mmfaudio.h
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Mda\Common\MmfAudio.h
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __MMF_COMMON_AUDIO_H__
       
    19 #define __MMF_COMMON_AUDIO_H__
       
    20 
       
    21 // Standard EPOC32 includes
       
    22 #include <e32base.h>
       
    23 
       
    24 // Public Media Server includes
       
    25 
       
    26 #include <mmf/common/mmfbase.h>
       
    27 #include <mmf/common/mmfutilities.h>
       
    28 
       
    29 /**
       
    30 @publishedAll
       
    31 @released
       
    32 
       
    33 Audio Loading started event. Use by a controller to signal to a
       
    34 client that audio loading has begun.
       
    35 
       
    36 @since 7.0s
       
    37 */
       
    38 const TUid KMMFEventCategoryAudioLoadingStarted = {0x101F8002};
       
    39 
       
    40 /**
       
    41 @publishedAll
       
    42 @released
       
    43 
       
    44 Audio Loading completed event. Use by a controller to signal to a
       
    45 client that audio loading has completed.
       
    46 
       
    47 @since 7.0s
       
    48 */
       
    49 const TUid KMMFEventCategoryAudioLoadingComplete = {0x101F8003};
       
    50 
       
    51 /**
       
    52 @publishedAll
       
    53 @released
       
    54 
       
    55 The class defining a callback interface for receiving loading notifications.
       
    56 
       
    57 since 7.0s
       
    58 */
       
    59 class MAudioLoadingObserver
       
    60 	{
       
    61 public:
       
    62 
       
    63 	/*
       
    64 	Audio Loading/rebuffering has begun
       
    65 
       
    66 	@since 7.0s
       
    67 	*/
       
    68 	virtual void MaloLoadingStarted() = 0;
       
    69 	/*
       
    70 	Audio Loading/rebuffering has completed
       
    71 
       
    72 	@since 7.0s
       
    73 	 */
       
    74 	virtual void MaloLoadingComplete() = 0;
       
    75 	};
       
    76 
       
    77 
       
    78 /**
       
    79 @publishedAll
       
    80 @released
       
    81 
       
    82 An interface to a set of audio player callback functions.
       
    83 
       
    84 The class is a mixin and is intended to be inherited by the client
       
    85 class which is waiting for the audio resource. The functions
       
    86 encapsulated by this class are called when specific events occur in
       
    87 the process of resource availablity. A reference to this object is
       
    88 passed as a parameter when registering for notification by 
       
    89 the audio player.
       
    90 
       
    91 */
       
    92 class MMMFAudioResourceNotificationCallback
       
    93 	{
       
    94 public:
       
    95 
       
    96 	/**
       
    97 	Called when the audio resource becomes available but
       
    98 	only if the resource was previously unavailable (e.g. if
       
    99 	the audio resource is available when the client registers,
       
   100 	then this callback is not received).
       
   101 
       
   102 	@param  aNotificationEventId
       
   103 	        The UID of the event that is being handled.
       
   104 	@param  aNotificationData
       
   105 	        The data that corresponds to the notification event.
       
   106 	*/
       
   107 	virtual void MarncResourceAvailable(TUid aNotificationEventId, const TDesC8& aNotificationData) = 0;
       
   108 	
       
   109 	};
       
   110 
       
   111 /**
       
   112 @publishedAll
       
   113 @released
       
   114 
       
   115 A class used when sending custom commands from the client API
       
   116 to the audio controller to get or set the audio configuration
       
   117 */
       
   118 class TMMFAudioConfig
       
   119 	{
       
   120 public:
       
   121 	inline TMMFAudioConfig();
       
   122 
       
   123 	/**
       
   124     Not implemented.
       
   125 	*/
       
   126 	inline void SetReturnSize(TInt aReturnSize);
       
   127 public:
       
   128 	// Audio device command parameters
       
   129 
       
   130 	/**
       
   131 	 The volume setting. This can be any value from zero to iMaxVolume
       
   132 	*/
       
   133 	TInt iVolume;
       
   134 	/**
       
   135 	The maximum volume setting of the audio device.
       
   136 
       
   137 	This value is platform dependent but is always greater than or equal to one. This is the 
       
   138 	maximum value that should be passed to iVolume.
       
   139 	*/
       
   140 	TInt iMaxVolume;
       
   141 
       
   142 	/**
       
   143 	The balance between left and right stereo channels. Must be between -100 and 100
       
   144 	*/
       
   145 	TInt iBalance;
       
   146 
       
   147 	/**
       
   148 	The gain of the audio device. This can be any value from zero to iMaxGain
       
   149 	*/
       
   150 	TInt iGain;
       
   151 
       
   152 	/**
       
   153 	The maximum gain of the audio device.
       
   154 	*/
       
   155 	TInt iMaxGain;
       
   156 
       
   157 	/**
       
   158 	If true, the audio clip is cropped from the current position to the end and the remainder of the clip 
       
   159 	is discarded. If false, the audio clip is cropped from the start of the file to the current position. 
       
   160 	The audio data prior to the current position is discarded.
       
   161 	*/
       
   162 	TBool iCropToEnd ;
       
   163 
       
   164 	/**
       
   165 	The number of channels of the audio device (signifying mono/stereo).
       
   166 	*/
       
   167 	TUint iChannels;
       
   168 
       
   169 	/**
       
   170 	The sample rate of the audio device.
       
   171 	*/
       
   172 	TUint iSampleRate;
       
   173 
       
   174 	/**
       
   175 	The format UID to be used.
       
   176 	*/
       
   177 	TUid iFormatUid;
       
   178 
       
   179 	/**
       
   180 	The source data codec type.
       
   181 	*/
       
   182 	TFourCC iSourceDataTypeCode;
       
   183 
       
   184 	/**
       
   185 	The sink data codec type.
       
   186 	*/
       
   187 	TFourCC iSinkDataTypeCode;
       
   188 
       
   189 	/**
       
   190 	The start position for audio playback in micro seconds.
       
   191 	*/
       
   192 	TTimeIntervalMicroSeconds iStartPosition ;
       
   193 
       
   194 	/**
       
   195 	The end position for audio playback in micro seconds.
       
   196 	*/
       
   197 	TTimeIntervalMicroSeconds iEndPosition ;
       
   198 
       
   199 	/**
       
   200 	The period over which the volume is to rise. 
       
   201 
       
   202 	A zero value causes the tone sample to be played at the normal level for the full
       
   203 	duration of the playback. A value which is longer than the duration
       
   204 	of the audio sample means that the sample never reaches its normal volume level.
       
   205 
       
   206 	Supported only during tone playing.
       
   207 	*/
       
   208 	TTimeIntervalMicroSeconds iRampDuration ;
       
   209 
       
   210 	/**
       
   211 	The recordable time available to the audio device.
       
   212 
       
   213 	This value may be the estimated time available.
       
   214 	*/
       
   215 	TTimeIntervalMicroSeconds iRecordTimeAvailable ;
       
   216 
       
   217 	/**
       
   218 	The maximum duration of the recorded clip, in microseconds
       
   219 	*/
       
   220 	TTimeIntervalMicroSeconds iMaxDuration ;
       
   221 
       
   222 	/**
       
   223 	The maximum size of the recorded clip, in bytes.
       
   224 	*/
       
   225 	TInt iMaxFileSize ;
       
   226 
       
   227 	/**
       
   228 	The current state of the audio device.
       
   229 	*/
       
   230 	TInt iState ;
       
   231 
       
   232 	/**
       
   233 	The current completion status of loading/rebuffering.
       
   234 	*/
       
   235 	TInt iLoadingCompletePercentage;
       
   236 
       
   237 	enum
       
   238 		{
       
   239 		/**
       
   240 		Specifies the maximum buffer length that can be passed with notification request
       
   241 		*/
       
   242 		KNotificationDataBufferSize=256
       
   243 		};
       
   244 	/**
       
   245 	The notification event to register for the client.
       
   246 	*/
       
   247 	TUid iEventType;
       
   248 	/**
       
   249 	The notification data from the client.
       
   250 	*/
       
   251 	TBufC8<KNotificationDataBufferSize> iNotificationRegistrationData;
       
   252 	/**
       
   253 	The notification data for the client.
       
   254 	*/
       
   255 	TBuf8<KNotificationDataBufferSize> iNotificationData;
       
   256 private:
       
   257 	/**
       
   258 	This member is internal and not intended for use.
       
   259 	*/
       
   260 	TInt iReserved1;
       
   261 	TInt iReserved2;
       
   262 	TInt iReserved3;
       
   263 	};
       
   264 
       
   265 /**
       
   266 Initialises the object with arbitrary values.
       
   267 */
       
   268 inline TMMFAudioConfig::TMMFAudioConfig() {};
       
   269 
       
   270 
       
   271 /*
       
   272 @publishedPartner
       
   273 @released
       
   274 
       
   275 A class used when sending custom commands from the client API
       
   276 to the audio controller to set repeats
       
   277 */
       
   278 class TMMFAudioSetRepeatsConfig
       
   279 	{
       
   280 public:
       
   281 	IMPORT_C TMMFAudioSetRepeatsConfig();
       
   282 
       
   283 public:
       
   284 	
       
   285 	/**
       
   286     The number of times the audio sample, together with the trailing silence, is to be repeated. 
       
   287     If this is set to KMdaRepeatForever, then the audio sample, together with the trailing silence, is
       
   288     repeated indefinitely or until Stop() is called. If this is set to zero, then the audio sample
       
   289     is not repeated. The behaviour is undefined for negative values (other than KMdaRepeatForever).
       
   290 	*/
       
   291 	TInt iRepeatNumberOfTimes;
       
   292 	
       
   293 	/**
       
   294 	The time interval of the training silence.
       
   295 	*/	
       
   296 	TTimeIntervalMicroSeconds iTrailingSilence;
       
   297 	
       
   298 private:
       
   299 	/**
       
   300 	This member is internal and not intended for use.
       
   301 	*/
       
   302 	TInt iReserved1;
       
   303 	};
       
   304 
       
   305 #endif