#include <mdaaudiosampleplayer.h>
class CMdaAudioPlayerUtility : public CBase |
Protected Attributes | |
---|---|
CMMFMdaAudioPlayerUtility * | iProperties |
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.
CMMFMdaAudioPlayerUtility * | iProperties | [protected] |
This member is internal and not intended for use.
~CMdaAudioPlayerUtility | ( | ) |
Destructor.
Frees all resources owned by the object prior to its destruction.
Cancels the registered notification event.
Parameter | Description |
---|---|
aNotificationEventId | The Event to notify the client. |
Returns: An error code indicating if the registration was successful. KErrNone on success, otherwise another of the system-wide error codes.
IMPORT_C TInt | ClearPlayWindow | ( | ) |
Clears the current playback window.
Returns: An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.
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.
Returns: The controller implementation structure
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.
Parameter | Description |
---|---|
aDestination | The destination of the message, consisting of the uid of the interface of this message. |
aFunction | The function number to indicate which function is to be called on the interface defined in the aDestination parameter. |
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. |
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. |
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." |
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.
Parameter | Description |
---|---|
aDestination | The destination of the message, consisting of the uid of the interface of this message. |
aFunction | The function number to indicate which function is to be called on the interface defined in the aDestination parameter. |
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. |
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. |
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.
Parameter | Description |
---|---|
aDestination | The destination of the message, consisting of the UID of the interface of this message. |
aFunction | The function number to indicate which function is to be called on the interface defined in the aDestination parameter. |
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. |
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. |
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. |
Returns: The result of the request. Exact range of values is dependent on the interface.
IMPORT_C TInt | CustomCommandSync | ( | const TMMFMessageDestinationPckg & | aDestination, |
TInt | aFunction, | |||
const TDesC8 & | aDataTo1, | |||
const TDesC8 & | aDataTo2 | |||
) |
Sends a synchronous custom command to the controller.
Parameter | Description |
---|---|
aDestination | The destination of the message, consisting of the UID of the interface of this message. |
aFunction | The function number to indicate which function is to be called on the interface defined in the aDestination parameter. |
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. |
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. |
Returns: The result of the request. Exact range of values is dependent on the interface.
const TTimeIntervalMicroSeconds & | Duration | ( | ) | [virtual] |
Returns the duration of the audio sample in microseconds.
Returns: The duration of the sample in microseconds.
IMPORT_C TMMFDurationInfo | Duration | ( | TTimeIntervalMicroSeconds & | aDuration | ) |
Returns the duration of the audio sample in microseconds, and the duration state.
Parameter | Description |
---|---|
aDuration | The duration of the sample in microseconds. |
Returns: The duration state
IMPORT_C void | GetAudioLoadingProgressL | ( | TInt & | aPercentageComplete | ) |
Returns the current progress of audio loading.
Parameter | Description |
---|---|
aPercentageComplete | The percentage of the audio clip loaded. |
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.
Parameter | Description |
---|---|
aBalance | A value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight. |
Returns: An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.
IMPORT_C MMMFDRMCustomCommand * | GetDRMCustomCommand | ( | ) |
Gets a controller's DRM custom command implementation.
Returns: A pointer to a controller's DRM custom command implementation, or NULL if the controller does not support it.
IMPORT_C CMMFMetaDataEntry * | GetMetaDataEntryL | ( | TInt | aMetaDataIndex | ) |
Returns the requested meta data entry.
Parameter | Description |
---|---|
aMetaDataIndex | The index number of the meta data to retrieve. |
Returns: The requested meta data entry.
Returns the number of meta data entries in the current audio clip.
Parameter | Description |
---|---|
aNumEntries | The number of meta data entries in the header of the current clip. |
Returns: An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.
IMPORT_C TInt | GetPosition | ( | TTimeIntervalMicroSeconds & | aPosition | ) |
Returns the current playback position in microseconds from the start of the clip.
Parameter | Description |
---|---|
aPosition | The current time position in microseconds from the start of the clip to the current play position. |
Returns: An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.
Returns the current playback volume.
Parameter | Description |
---|---|
aVolume | A value between 0 and the maximum volume settings returned by MaxVolume(). |
Returns: An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.
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.
Returns: The maximum volume setting.
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.
Parameter | Description |
---|---|
aData | A descriptor containing the audio data. This descriptor must remain in existence for the lifetime of this audio player utility object. |
aCallback | The audio player observer interface. |
aPriority | 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. |
aPref | 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. |
aServer | Not used in 7.0s. This parameter is provided for binary compatibility with previous versions. |
Returns: A pointer to the new audio player utility object.
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.
Parameter | Description |
---|---|
aData | A read only descriptor containing the audio data. This descriptor must remain in existence for the lifetime of this audio player utility object. |
aCallback | The audio player observer interface. |
aPriority | 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. |
aPref | 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. |
aServer | Not used in 7.0s. This parameter is provided for binary compatibility with previous versions. |
Returns: A pointer to a new audio player utility.
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.
Parameter | Description |
---|---|
aFileName | The full path name of the file containing the audio data. |
aCallback | The audio player observer interface. |
aPriority | 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. |
aPref | 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. |
aServer | Not used in 7.0s. This parameter is provided for binary compatibility with previous versions. |
Returns: A pointer to the new audio player utility object.
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.
Parameter | Description |
---|---|
aCallback | The audio player observer interface. |
aPriority | 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. |
aPref | 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. |
Returns: A pointer to the new audio player utility object.
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).
Parameter | Description |
---|---|
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.
Parameter | Description |
---|---|
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.
Parameter | Description |
---|---|
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.
Parameter | Description |
---|---|
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).
Parameter | Description |
---|---|
aUrl | The URL to open. |
aIapId | Internet access point(IAP) ID to use. KUseDefaultIap selects the default IAP. |
aMimeType | MIME type of the URL source. |
IMPORT_C TInt | Pause | ( | ) |
Pauses the playback of the audio clip.
Returns: An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.
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.
Parameter | Description |
---|---|
aCallback | The audio outputstream observer interface.. |
aNotificationEventUid | The Event for which the client is registered. |
aNotificationRegistrationData | Notification registration specific data. |
Returns: An error code indicating if the registration was successful. KErrNone on success, otherwise another of the system-wide error codes.
IMPORT_C void | RegisterForAudioLoadingNotification | ( | MAudioLoadingObserver & | aCallback | ) |
Registers callback object to receive notifications of audio loading/rebuffering.
Parameter | Description |
---|---|
aCallback | The object to receive audio loading notifications. |
IMPORT_C TInt | SetBalance | ( | TInt | aBalance = KMMFBalanceCenter | ) |
Sets the current playback balance.
Parameter | Description |
---|---|
aBalance | A value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight. The default value is KMMFBalanceCenter. |
Returns: An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.
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.
Parameter | Description |
---|---|
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. |
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. |
Returns: An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.
IMPORT_C void | SetPosition | ( | const TTimeIntervalMicroSeconds & | aPosition | ) |
Sets the current playback position in microseconds from the start of the clip.
Parameter | Description |
---|---|
aPosition | The position to move to in microseconds from the start of the clip. |
Sets the priority for playback. This is used to arbitrate between multiple objects trying to access a single sound device.
See also: CMdaAudioPlayerUtility::NewL()
Parameter | Description |
---|---|
aPriority | The Priority Value. |
aPref | The Priority Preference. |
Returns: An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.
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.
Parameter | Description |
---|---|
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. |
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.
Parameter | Description |
---|---|
aThreadPriority | The TThreadPriority that the thread should run under. The default is EPriorityNormal. |
Returns: TInt A standard error code: KErrNone if successful, KErrNotReady if the thread does not have a valid handle.
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()).
Parameter | Description |
---|---|
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. |
Returns: An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.
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.
Parameter | Description |
---|---|
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.
Returns: An error code indicating if the registration was successful. KErrNone on success, otherwise another of the system-wide error codes.