class CMdaAudioPlayerUtility : public CBase |
Plays sampled audio data.
The class offers a simple interface to open, play and obtain information from, sampled audio data. The audio data can be supplied either in a file (file-based), as a descriptor (descriptor-based) or as a URL reference (since version 7.0s).
While this class is abstract, the three static functions construct, initialise and return pointers to instances of concrete classes derived from this abstract class.
Private Member Functions | |
---|---|
CMdaAudioPlayerUtility () |
Protected Attributes | |
---|---|
CMMFMdaAudioPlayerUtility * | iProperties |
~CMdaAudioPlayerUtility | ( | ) |
Destructor.
Frees all resources owned by the object prior to its destruction.
IMPORT_C TInt | CancelRegisterAudioResourceNotification | ( | TUid | aNotificationEventId | ) |
Cancels the registered notification event.
TUid aNotificationEventId | The Event to notify the client. |
IMPORT_C void | Close | ( | ) |
Closes the current audio clip (allowing another clip to be opened).
IMPORT_C const CMMFControllerImplementationInformation & | ControllerImplementationInformationL | ( | ) |
Returns the controller implementation information associated with the current controller.
IMPORT_C void | CustomCommandAsync | ( | const TMMFMessageDestinationPckg & | aDestination, |
TInt | aFunction, | |||
const TDesC8 & | aDataTo1, | |||
const TDesC8 & | aDataTo2, | |||
TDes8 & | aDataFrom, | |||
TRequestStatus & | aStatus | |||
) |
Sends an asynchronous custom command to the controller.
Note: This method will return immediately. The RunL of the active object owning the aStatus parameter will be called when the command is completed by the controller framework.
const TMMFMessageDestinationPckg & aDestination | The destination of the message, consisting of the uid of the interface of this message. |
TInt aFunction | The function number to indicate which function is to be called on the interface defined in the aDestination parameter. |
const TDesC8 & aDataTo1 | A reference to the first chunk of data to be copied to the controller framework. The exact contents of the data are dependent on the interface being called. Can be KNullDesC8. |
const TDesC8 & aDataTo2 | A reference to the second chunk of data to be copied to the controller framework. The exact contents of the data are dependent on the interface being called. Can be KNullDesC8. |
TDes8 & aDataFrom | A reference to an area of memory to which the controller framework will write any data to be passed back to the client. Can't be KNullDesC8." |
TRequestStatus & aStatus | The TRequestStatus of an active object. This will contain the result of the request on completion. The exact range of result values is dependent on the interface. |
IMPORT_C void | CustomCommandAsync | ( | const TMMFMessageDestinationPckg & | aDestination, |
TInt | aFunction, | |||
const TDesC8 & | aDataTo1, | |||
const TDesC8 & | aDataTo2, | |||
TRequestStatus & | aStatus | |||
) |
Sends an asynchronous custom command to the controller.
Note: This method will return immediately. The RunL of the active object owning the aStatus parameter will be called when the command is completed by the controller framework.
const TMMFMessageDestinationPckg & aDestination | The destination of the message, consisting of the uid of the interface of this message. |
TInt aFunction | The function number to indicate which function is to be called on the interface defined in the aDestination parameter. |
const TDesC8 & aDataTo1 | A reference to the first chunk of data to be copied to the controller framework. The exact contents of the data are dependent on the interface being called. Can be KNullDesC8. |
const TDesC8 & aDataTo2 | A reference to the second chunk of data to be copied to the controller framework. The exact contents of the data are dependent on the interface being called. Can be KNullDesC8. |
TRequestStatus & aStatus | The TRequestStatus of an active object. This will contain the result of the request on completion. The exact range of result values is dependent on the interface. |
IMPORT_C TInt | CustomCommandSync | ( | const TMMFMessageDestinationPckg & | aDestination, |
TInt | aFunction, | |||
const TDesC8 & | aDataTo1, | |||
const TDesC8 & | aDataTo2, | |||
TDes8 & | aDataFrom | |||
) |
Sends a synchronous custom command to the controller.
const TMMFMessageDestinationPckg & aDestination | The destination of the message, consisting of the UID of the interface of this message. |
TInt aFunction | The function number to indicate which function is to be called on the interface defined in the aDestination parameter. |
const TDesC8 & aDataTo1 | A reference to the first chunk of data to be copied to the controller framework. The exact contents of the data are dependent on the interface being called. Can be KNullDesC8. |
const TDesC8 & aDataTo2 | A reference to the second chunk of data to be copied to the controller framework. The exact contents of the data are dependent on the interface being called. Can be KNullDesC8. |
TDes8 & aDataFrom | A reference to an area of memory to which the controller framework will write any data to be passed back to the client. Can't be KNullDesC8. |
IMPORT_C TInt | CustomCommandSync | ( | const TMMFMessageDestinationPckg & | aDestination, |
TInt | aFunction, | |||
const TDesC8 & | aDataTo1, | |||
const TDesC8 & | aDataTo2 | |||
) |
Sends a synchronous custom command to the controller.
const TMMFMessageDestinationPckg & aDestination | The destination of the message, consisting of the UID of the interface of this message. |
TInt aFunction | The function number to indicate which function is to be called on the interface defined in the aDestination parameter. |
const TDesC8 & aDataTo1 | A reference to the first chunk of data to be copied to the controller framework. The exact contents of the data are dependent on the interface being called. Can be KNullDesC8. |
const TDesC8 & aDataTo2 | A reference to the second chunk of data to be copied to the controller framework. The exact contents of the data are dependent on the interface being called. Can be KNullDesC8. |
const TTimeIntervalMicroSeconds & | Duration | ( | ) | [virtual] |
Returns the duration of the audio sample in microseconds.
IMPORT_C TMMFDurationInfo | Duration | ( | TTimeIntervalMicroSeconds & | aDuration | ) |
Returns the duration of the audio sample in microseconds, and the duration state.
TTimeIntervalMicroSeconds & aDuration | The duration of the sample in microseconds. |
IMPORT_C void | GetAudioLoadingProgressL | ( | TInt & | aPercentageComplete | ) |
Returns the current progress of audio loading.
TInt & aPercentageComplete | The percentage of the audio clip loaded. |
IMPORT_C TInt | GetBalance | ( | TInt & | aBalance | ) |
Returns The current playback balance. This function may not return the same value as passed to SetBalance depending on the internal implementation in the underlying components.
TInt & aBalance | A value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight. |
IMPORT_C TInt | GetBitRate | ( | TUint & | aBitRate | ) |
Returns the bit rate of the audio clip.
TUint & aBitRate | The bit rate of the audio clip |
IMPORT_C MMMFDRMCustomCommand * | GetDRMCustomCommand | ( | ) |
Gets a controller's DRM custom command implementation.
IMPORT_C CMMFMetaDataEntry * | GetMetaDataEntryL | ( | TInt | aMetaDataIndex | ) |
Returns the requested meta data entry.
TInt aMetaDataIndex | The index number of the meta data to retrieve. |
IMPORT_C TInt | GetNumberOfMetaDataEntries | ( | TInt & | aNumEntries | ) |
Returns the number of meta data entries in the current audio clip.
TInt & aNumEntries | The number of meta data entries in the header of the current clip. |
IMPORT_C TInt | GetPosition | ( | TTimeIntervalMicroSeconds & | aPosition | ) |
Returns the current playback position in microseconds from the start of the clip.
TTimeIntervalMicroSeconds & aPosition | The current time position in microseconds from the start of the clip to the current play position. |
IMPORT_C TInt | GetVolume | ( | TInt & | aVolume | ) |
Returns the current playback volume.
TInt & aVolume | A value between 0 and the maximum volume settings returned by MaxVolume(). |
TInt | MaxVolume | ( | ) | [virtual] |
Returns an integer representing the maximum volume.
This is the maximum value which can be passed to CMdaAudioPlayerUtility::SetVolume() . This value is platform independent, but is always greater than or equal to one.
IMPORT_C CMdaAudioPlayerUtility * | NewDesPlayerL | ( | const TDesC8 & | aData, |
MMdaAudioPlayerCallback & | aCallback, | |||
TInt | aPriority = EMdaPriorityNormal, | |||
TInt | aPref = EMdaPriorityPreferenceTimeAndQuality, | |||
CMdaServer * | aServer = NULL | |||
) | [static] |
Constructs and initialises a new instance of the audio player utility for playing sampled audio data from a descriptor.
The audio data must be in a supported format (e.g. WAV and AU).
The function leaves if the audio player utility object cannot be created. When initialisation of the audio player utility is complete, successfully or otherwise, the callback function MMdaAudioPlayerCallback::MapcInitComplete() is called.
Note: The Priority Value and Priority Preference are used primarily when deciding what to do when several audio clients attempt to play or record simultaneously. In addition to the Priority Value and Preference, the adaptation may consider other parameters such as the SecureId and Capabilities of the client process. Whatever, the decision as to what to do in such situations is up to the audio adaptation, and may vary between different phones. Portable applications are advised not to assume any specific behaviour.
const TDesC8 & aData | A descriptor containing the audio data. This descriptor must remain in existence for the lifetime of this audio player utility object. |
MMdaAudioPlayerCallback & aCallback | The audio player observer interface. |
TInt aPriority = EMdaPriorityNormal | The Priority Value - this client's relative priority. This is a value between EMdaPriorityMin and EMdaPriorityMax and represents a relative priority. A higher value indicates a more important request. |
TInt aPref = EMdaPriorityPreferenceTimeAndQuality | The Priority Preference - an additional audio policy parameter. The suggested default is EMdaPriorityPreferenceNone. Further values are given by TMdaPriorityPreference, and additional values may be supported by given phones and/or platforms, but should not be depended upon by portable code. |
CMdaServer * aServer = NULL | Not used in 7.0s. This parameter is provided for binary compatibility with previous versions. |
IMPORT_C CMdaAudioPlayerUtility * | NewDesPlayerReadOnlyL | ( | const TDesC8 & | aData, |
MMdaAudioPlayerCallback & | aCallback, | |||
TInt | aPriority = EMdaPriorityNormal, | |||
TInt | aPref = EMdaPriorityPreferenceTimeAndQuality, | |||
CMdaServer * | aServer = NULL | |||
) | [static] |
Constructs and initialises a new instance of the audio player utility for playing sampled audio data from a read only descriptor.
The audio data must be in a supported format (e.g. WAV and AU).
The function leaves if the audio player utility object cannot be created. When initialisation of the audio player utility is complete, successfully or otherwise, the callback function MMdaAudioPlayerCallback::MapcInitComplete() is called.
Note: The Priority Value and Priority Preference are used primarily when deciding what to do when several audio clients attempt to play or record simultaneously. In addition to the Priority Value and Preference, the adaptation may consider other parameters such as the SecureId and Capabilities of the client process. Whatever, the decision as to what to do in such situations is up to the audio adaptation, and may vary between different phones. Portable applications are advised not to assume any specific behaviour.
const TDesC8 & aData | A read only descriptor containing the audio data. This descriptor must remain in existence for the lifetime of this audio player utility object. |
MMdaAudioPlayerCallback & aCallback | The audio player observer interface. |
TInt aPriority = EMdaPriorityNormal | The Priority Value - this client's relative priority. This is a value between EMdaPriorityMin and EMdaPriorityMax and represents a relative priority. A higher value indicates a more important request. |
TInt aPref = EMdaPriorityPreferenceTimeAndQuality | The Priority Preference - an additional audio policy parameter. The suggested default is EMdaPriorityPreferenceNone. Further values are given by TMdaPriorityPreference, and additional values may be supported by given phones and/or platforms, but should not be depended upon by portable code. |
CMdaServer * aServer = NULL | Not used in 7.0s. This parameter is provided for binary compatibility with previous versions. |
IMPORT_C CMdaAudioPlayerUtility * | NewFilePlayerL | ( | const TDesC & | aFileName, |
MMdaAudioPlayerCallback & | aCallback, | |||
TInt | aPriority = EMdaPriorityNormal, | |||
TInt | aPref = EMdaPriorityPreferenceTimeAndQuality, | |||
CMdaServer * | aServer = NULL | |||
) | [static] |
Constructs and initialises a new instance of the audio player utility for playing sampled audio data from a file. The audio data must be in a supported format (e.g. WAV and AU).
The function leaves if the audio player utility object cannot be created.
When initialisation of the audio player utility is complete, successfully or otherwise, the callback function MMdaAudioPlayerCallback::MapcInitComplete() is called.
Note: The Priority Value and Priority Preference are used primarily when deciding what to do when several audio clients attempt to play or record simultaneously. In addition to the Priority Value and Preference, the adaptation may consider other parameters such as the SecureId and Capabilities of the client process. Whatever, the decision as to what to do in such situations is up to the audio adaptation, and may vary between different phones. Portable applications are advised not to assume any specific behaviour.
const TDesC & aFileName | The full path name of the file containing the audio data. |
MMdaAudioPlayerCallback & aCallback | The audio player observer interface. |
TInt aPriority = EMdaPriorityNormal | The Priority Value - this client's relative priority. This is a value between EMdaPriorityMin and EMdaPriorityMax and represents a relative priority. A higher value indicates a more important request. |
TInt aPref = EMdaPriorityPreferenceTimeAndQuality | The Priority Preference - an additional audio policy parameter. The suggested default is EMdaPriorityPreferenceNone. Further values are given by TMdaPriorityPreference, and additional values may be supported by given phones and/or platforms, but should not be depended upon by portable code. |
CMdaServer * aServer = NULL | Not used in 7.0s. This parameter is provided for binary compatibility with previous versions. |
IMPORT_C CMdaAudioPlayerUtility * | NewL | ( | MMdaAudioPlayerCallback & | aCallback, |
TInt | aPriority = EMdaPriorityNormal, | |||
TInt | aPref = EMdaPriorityPreferenceTimeAndQuality | |||
) | [static] |
Constructs and initialises a new instance of the audio player utility.
The function leaves if the audio player utility object cannot be created.
No callback notification is made upon completion of NewL() .
Note: The Priority Value and Priority Preference are used primarily when deciding what to do when several audio clients attempt to play or record simultaneously. In addition to the Priority Value and Preference, the adaptation may consider other parameters such as the SecureId and Capabilities of the client process. Whatever, the decision as to what to do in such situations is up to the audio adaptation, and may vary between different phones. Portable applications are advised not to assume any specific behaviour.
MMdaAudioPlayerCallback & aCallback | The audio player observer interface. |
TInt aPriority = EMdaPriorityNormal | The Priority Value - this client's relative priority. This is a value between EMdaPriorityMin and EMdaPriorityMax and represents a relative priority. A higher value indicates a more important request. |
TInt aPref = EMdaPriorityPreferenceTimeAndQuality | The Priority Preference - an additional audio policy parameter. The suggested default is EMdaPriorityPreferenceNone. Further values are given by TMdaPriorityPreference, and additional values may be supported by given phones and/or platforms, but should not be depended upon by portable code. |
IMPORT_C void | OpenDesL | ( | const TDesC8 & | aDescriptor | ) |
Opens an audio clip from a descriptor.
The audio data must be in a supported format (for example, WAV or AU).
const TDesC8 & aDescriptor | A descriptor containing the audio clip. |
IMPORT_C void | OpenFileL | ( | const TDesC & | aFileName | ) |
Opens an audio clip from a file.
The audio data must be in a supported format (for example, WAV or AU).
This function leaves with KErrNotReady if there is a previous open statement awaiting notification of completion.
const TDesC & aFileName | The file to open. |
IMPORT_C void | OpenFileL | ( | const RFile & | aFile | ) |
Opens an audio clip from a file.
The audio data must be in a supported format (for example, WAV or AU).
This function leaves with KErrNotReady if there is a previous open statement awaiting notification of completion.
Note: it is generally advisable that the RFile is shared through the call RFs::ShareProtected() . This allows the adaptation to pass it to another process, if that is required. This is particularly true of playing DRM encrypted files.
const RFile & aFile | The open shared session file handle to use |
IMPORT_C void | OpenFileL | ( | const TMMSource & | aSource | ) |
Opens an audio clip from a file.
The audio data must be in a supported format (for example, WAV or AU).
This function leaves with KErrNotReady if there is a previous open statement awaiting notification of completion.
const TMMSource & aSource | The file to open or an open file handle to use |
IMPORT_C void | OpenUrlL | ( | const TDesC & | aUrl, |
TInt | aIapId = KUseDefaultIap , | |||
const TDesC8 & | aMimeType = KNullDesC8 | |||
) |
Opens an audio clip from a URL.
The audio data must be in a supported format (for example, WAV or AU).
const TDesC & aUrl | The URL to open. |
TInt aIapId = KUseDefaultIap | Internet access point(IAP) ID to use. KUseDefaultIap selects the default IAP. |
const TDesC8 & aMimeType = KNullDesC8 | MIME type of the URL source. |
void | Play | ( | ) | [virtual] |
Begins playback of audio sample data at the current playback position using the current volume, gain and priority settings.
When playing of the audio sample is complete, successfully or otherwise, the callback function MMdaAudioPlayerCallback::MapcPlayComplete() is called.
If this function is called whilst already playing then MMdaAudioPlayerCallback::MapcPlayComplete will return with the error code KErrNotReady.
IMPORT_C TInt | RegisterAudioResourceNotification | ( | MMMFAudioResourceNotificationCallback & | aCallback, |
TUid | aNotificationEventUid, | |||
const TDesC8 & | aNotificationRegistrationData = KNullDesC8 | |||
) |
Registers the Event for Notification when resource is avaliable.
MMMFAudioResourceNotificationCallback & aCallback | The audio outputstream observer interface.. |
TUid aNotificationEventUid | The Event for which the client is registered. |
const TDesC8 & aNotificationRegistrationData = KNullDesC8 | Notification registration specific data. |
IMPORT_C void | RegisterForAudioLoadingNotification | ( | MAudioLoadingObserver & | aCallback | ) |
Registers callback object to receive notifications of audio loading/rebuffering.
MAudioLoadingObserver & aCallback | The object to receive audio loading notifications. |
IMPORT_C TInt | SetBalance | ( | TInt | aBalance = KMMFBalanceCenter | ) |
Sets the current playback balance.
TInt aBalance = KMMFBalanceCenter | A value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight. The default value is KMMFBalanceCenter. |
IMPORT_C TInt | SetPlayWindow | ( | const TTimeIntervalMicroSeconds & | aStart, |
const TTimeIntervalMicroSeconds & | aEnd | |||
) |
Defines a window on the audio sample data.
The window is defined in terms of a start and end position. When the current playback position reaches the window end position, or Stop() is called, the current playback position is set to the window start position and playback stops.
The current playback position is not affected by a call to SetPlayWindow() unless it is outside the new playback window, in which case it is set to the window start or end position depending on which one is closer.
The window persists until ClearPlayWindow() is called. Loading new audio sample data without adjusting or clearing the window will result in playback errors if the window is outside the new data.
const TTimeIntervalMicroSeconds & aStart | The position defining the start of the window, measured in microseconds. If this value is less than zero, it is set to zero. If this value is greater than aEnd, then it is swapped with aEnd. |
const TTimeIntervalMicroSeconds & aEnd | The position defining the end of the window, measured in microseconds. If this value is greater than the value returned by Duration(), it is set to the value of Duration(). If this value is less than aStart, then it is swapped with aStart. |
IMPORT_C void | SetPosition | ( | const TTimeIntervalMicroSeconds & | aPosition | ) |
Sets the current playback position in microseconds from the start of the clip.
const TTimeIntervalMicroSeconds & aPosition | The position to move to in microseconds from the start of the clip. |
IMPORT_C TInt | SetPriority | ( | TInt | aPriority, |
TInt | aPref | |||
) |
Sets the priority for playback. This is used to arbitrate between multiple objects trying to access a single sound device.
void | SetRepeats | ( | TInt | aRepeatNumberOfTimes, |
const TTimeIntervalMicroSeconds & | aTrailingSilence | |||
) | [virtual] |
Sets the number of times the audio sample is to be repeated during the playback operation.
A period of silence can follow each playing of the sample. The audio sample can be repeated indefinitely.
TInt aRepeatNumberOfTimes | The number of times the audio sample, together with the trailing silence, is to be repeated. If this is set to KMdaRepeatForever, then the audio sample, together with the trailing silence, is repeated indefinitely or until Stop() is called. If this is set to zero, then the audio sample is not repeated. |
const TTimeIntervalMicroSeconds & aTrailingSilence | The time interval of the trailing silence in microseconds. |
IMPORT_C TInt | SetThreadPriority | ( | const TThreadPriority & | aThreadPriority | ) | const |
Set the priority of the controller's sub thread.
This can be used to increase the responsiveness of the audio plugin to minimise any lag in processing. This function should be used with care as it may have knock-on effects elsewhere in the system.
const TThreadPriority & aThreadPriority | The TThreadPriority that the thread should run under. The default is EPriorityNormal. |
TInt | SetVolume | ( | TInt | aVolume | ) | [virtual] |
Changes the current playback volume to a specified value.
The volume can be changed before or during playback and is effective immediately. The volume can be set to any value between zero (mute) and the maximum permissible volume (determined using MaxVolume() ).
TInt aVolume | The volume setting. This can be any value from zero to the value returned by a call to CMdaAudioPlayerUtility::MaxVolume(). Setting a zero value mutes the sound. Setting the maximum value results in the loudest possible sound. Values less than zero would be set to zero and the values greater than the maximum permitted volume would be set to the maximum volume. |
void | SetVolumeRamp | ( | const TTimeIntervalMicroSeconds & | aRampDuration | ) | [virtual] |
Defines the period over which the volume level is to rise smoothly from nothing to the normal volume level.
const TTimeIntervalMicroSeconds & aRampDuration | The period over which the volume is to rise. A zero value causes the audio sample to be played at the normal level for the full duration of the playback. A value which is longer than the duration of the audio sample means that the sample never reaches its normal volume level. |
void | Stop | ( | ) | [virtual] |
Stops playback of the audio sample as soon as possible.
If the audio sample is playing, playback is stopped as soon as possible. If playback is already complete, nothing further happens as a result of calling this function. The callback function MMdaAudioPlayerCallback::MapcPlayComplete() is not called.
IMPORT_C void | UseSharedHeap | ( | ) |
Ensures that any subsequent calls to OpenXYZ() will create controllers that share a heap.
The default behaviour is that for each player utility a controller with its own heap is created. Each heap uses a chunk, so using this function avoids situations where the number of chunks per process is limited. The default behaviour is generally to be preferred, and should give lower overall memory usage. However, if many controllers are to be created for a particular thread, then this function should be used to prevent running out of heaps or chunks.
IMPORT_C TInt | WillResumePlay | ( | ) |
Waits for the client to resume the play even after the default timer expires.
CMMFMdaAudioPlayerUtility * | iProperties | [protected] |
This member is internal and not intended for use.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.