Symbian
 Developer Library

SYMBIAN OS V9.1

FEEDBACK 

[Index] [Spacer] [Previous] [Next]



Location: MdaAudioSamplePlayer.h
Link against: mediaclientaudio.lib

Class CMdaAudioPlayerUtility

class CMdaAudioPlayerUtility : public CBase, public MMMFClientUtility;

Description

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. This concrete class is part of the Media Server implementation and is private.

Derivation

Members

Defined in CMdaAudioPlayerUtility:
CancelRegisterAudioResourceNotification(), ClearPlayWindow(), Close(), ControllerImplementationInformationL(), CustomCommandAsync(), CustomCommandAsync(), CustomCommandSync(), CustomCommandSync(), Duration(), GetAudioLoadingProgressL(), GetBalance(), GetBitRate(), GetDRMCustomCommand(), GetMetaDataEntryL(), GetNumberOfMetaDataEntries(), GetPosition(), GetVolume(), MaxVolume(), NewDesPlayerL(), NewDesPlayerReadOnlyL(), NewFilePlayerL(), NewL(), OpenDesL(), OpenFileL(), OpenFileL(), OpenFileL(), OpenUrlL(), Pause(), Play(), RegisterAudioResourceNotification(), RegisterForAudioLoadingNotification(), SetBalance(), SetPlayWindow(), SetPosition(), SetPriority(), SetRepeats(), SetVolume(), SetVolumeRamp(), Stop(), WillResumePlay(), iProperties

Inherited from CBase:
Delete(), Extension_(), operator new()


Construction and destruction


NewL()

Capability: MultimediaDD

static IMPORT_C CMdaAudioPlayerUtility *NewL(MMdaAudioPlayerCallback &aCallback, TInt aPriority=EMdaPriorityNormal, TMdaPriorityPreference aPref=EMdaPriorityPreferenceTimeAndQuality);

Description

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().

Parameters

MMdaAudioPlayerCallback &aCallback

The audio player observer interface.

TInt aPriority

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.

TMdaPriorityPreference aPref

The required behaviour if a higher priority client takes over the sound output device.

Return value

CMdaAudioPlayerUtility *

A pointer to the new audio player utility object.

[Top]


Member functions


NewFilePlayerL()

Capability: MultimediaDD

static IMPORT_C CMdaAudioPlayerUtility *NewFilePlayerL(const TDesC &aFileName, MMdaAudioPlayerCallback &aCallback, TInt aPriority=EMdaPriorityNormal, TMdaPriorityPreference aPref=EMdaPriorityPreferenceTimeAndQuality, CMdaServer *aServer=0);

Description

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.

Parameters

const TDesC &aFileName

The full path name of the file containing the audio data.

MMdaAudioPlayerCallback &aCallback

The audio player observer interface.

TInt aPriority

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.

TMdaPriorityPreference aPref

The required behaviour if a higher priority client takes over the sound output device.

CMdaServer *aServer

Not used in 7.0s. This parameter is provided for binary compatibility with previous versions.

Return value

CMdaAudioPlayerUtility *

A pointer to the new audio player utility object.


NewDesPlayerL()

Capability: MultimediaDD

static IMPORT_C CMdaAudioPlayerUtility *NewDesPlayerL(const TDesC8 &aData, MMdaAudioPlayerCallback &aCallback, TInt aPriority=EMdaPriorityNormal, TMdaPriorityPreference aPref=EMdaPriorityPreferenceTimeAndQuality, CMdaServer *aServer=0);

Description

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.

Parameters

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

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.

TMdaPriorityPreference aPref

The required behaviour if a higher priority client takes over the sound output device.

CMdaServer *aServer

Not used in 7.0s. This parameter is provided for binary compatibility with previous versions.

Return value

CMdaAudioPlayerUtility *

A pointer to the new audio player utility object.


NewDesPlayerReadOnlyL()

static IMPORT_C CMdaAudioPlayerUtility *NewDesPlayerReadOnlyL(const TDesC8 &aData, MMdaAudioPlayerCallback &aCallback, TInt aPriority=EMdaPriorityNormal, TMdaPriorityPreference aPref=EMdaPriorityPreferenceTimeAndQuality, CMdaServer *aServer=0);

Description

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.

Parameters

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

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.

TMdaPriorityPreference aPref

The required behaviour if a higher priority client takes over the sound output device.

CMdaServer *aServer

Not used in 7.0s. This parameter is provided for binary compatibility with previous versions.

Return value

CMdaAudioPlayerUtility *

A pointer to a new audio player utility.


Play()

virtual void Play();

Description

Begins playback of the initialised audio sample at the current volume and priority levels.

When playing of the audio sample is complete, successfully or otherwise, the callback function MMdaAudioPlayerCallback::MapcPlayComplete() is called. This function raises a CMdaAudioPlayerUtility 1 panic if the audio player utility is not initialised.


Stop()

virtual void Stop();

Description

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.The function raises a CMdaAudioPlayerUtility 1 panic if the audio player utility is not initialised.


SetVolume()

virtual void SetVolume(TInt aVolume);

Description

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()).

The function raises a CMdaAudioPlayerUtility 1 panic if the audio player utility is not initialised.

Parameters

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.


SetRepeats()

virtual void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds &aTrailingSilence);

Description

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.

Parameters

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.


SetVolumeRamp()

virtual void SetVolumeRamp(const TTimeIntervalMicroSeconds &aRampDuration);

Description

Defines the period over which the volume level is to rise smoothly from nothing to the normal volume level.

Parameters

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.


Duration()

virtual const TTimeIntervalMicroSeconds &Duration();

Description

Returns the duration of the audio sample in microseconds.

The function raises a CMdaAudioPlayerUtility 1 panic if the audio player utility is not initialised.

Return value

const TTimeIntervalMicroSeconds &

The duration of the sample in microseconds.


MaxVolume()

virtual TInt MaxVolume();

Description

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.

The function raises a CMdaAudioPlayerUtility 1 panic if the audio player utility is not initialised.

Return value

TInt

The maximum volume setting.


OpenFileL()

IMPORT_C void OpenFileL(const TDesC &aFileName);

Description

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 KErrInUse if there is a previous open statement awaiting notification of completion.

Parameters

const TDesC &aFileName

The file to open.

Leave codes

KErrInUse

If a previous open statement is awaiting notification of completion. opening the file


OpenFileL()

IMPORT_C void OpenFileL(const RFile &aFile);

Description

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 KErrInUse if there is a previous open statement awaiting notification of completion.

Parameters

const RFile &aFile

The open file handle to use

Leave codes

KErrInUse

If a previous open statement is awaiting notification of completion. opening the file


OpenFileL()

IMPORT_C void OpenFileL(const TMMSource &aSource);

Description

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 KErrInUse if there is a previous open statement awaiting notification of completion.

Parameters

const TMMSource &aSource

Leave codes

KErrInUse

If a previous open statement is awaiting notification of completion. opening the file


OpenDesL()

IMPORT_C void OpenDesL(const TDesC8 &aDescriptor);

Description

Opens an audio clip from a descriptor.

The audio data must be in a supported format (for example, WAV or AU).

Parameters

const TDesC8 &aDescriptor

A descriptor containing the audio clip.

Leave codes

KErrInUse

If a previous open statement is awaiting notification of completion.


OpenUrlL()

IMPORT_C void OpenUrlL(const TDesC &aUrl, TInt aIapId=KUseDefaultIap, const TDesC8 &aMimeType=KNullDesC8);

Description

Opens an audio clip from a URL.

The audio data must be in a supported format (for example, WAV or AU).

Parameters

const TDesC &aUrl

The URL to open.

TInt aIapId

Internet access point(IAP) ID to use. KUseDefaultIap selects the default IAP.

const TDesC8 &aMimeType

MIME type of the URL source.

Leave codes

KErrInUse

If a previous open statement is awaiting notification of completion.


Pause()

IMPORT_C TInt Pause();

Description

Pauses the playback of the audio clip.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


Close()

IMPORT_C void Close();

Description

Closes the current audio clip (allowing another clip to be opened).


GetPosition()

IMPORT_C TInt GetPosition(TTimeIntervalMicroSeconds &aPosition);

Description

Returns the current playback position in microseconds from the start of the clip.

Parameters

TTimeIntervalMicroSeconds &aPosition

The current time position in microseconds from the start of the clip to the current play position.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


SetPosition()

IMPORT_C void SetPosition(const TTimeIntervalMicroSeconds &aPosition);

Description

Sets the current playback position in microseconds from the start of the clip.

Parameters

const TTimeIntervalMicroSeconds &aPosition

The position to move to in microseconds from the start of the clip.


SetPriority()

Capability: MultimediaDD

IMPORT_C TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref);

Description

Sets the priority for playback. This is used to arbitrate between multiple objects trying to access a single sound device.

Parameters

TInt aPriority

The priority level to apply, EMdaPriorityMin client can be interrupted by any other client, EMdaPriorityNormal client can only be interrupted by a client with a higher priority or EMdaPriorityMax client cannot be interrupted by other clients.

TMdaPriorityPreference aPref

The quality/time preferences to apply.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


GetVolume()

IMPORT_C TInt GetVolume(TInt &aVolume);

Description

Returns the current playback volume.

Parameters

TInt &aVolume

A value between 0 and the maximum volume settings returned by MaxVolume().

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


GetNumberOfMetaDataEntries()

IMPORT_C TInt GetNumberOfMetaDataEntries(TInt &aNumEntries);

Description

Returns the number of meta data entries in the current audio clip.

Parameters

TInt &aNumEntries

The number of meta data entries in the header of the current clip.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


GetMetaDataEntryL()

IMPORT_C CMMFMetaDataEntry *GetMetaDataEntryL(TInt aMetaDataIndex);

Description

Returns the requested meta data entry.

Parameters

TInt aMetaDataIndex

The index number of the meta data to retrieve.

Return value

CMMFMetaDataEntry *

The requested meta data entry.

Leave codes

KErrNotFound

The meta data entry does not exist.

KErrNotImplemented

The controller does not support meta data information for this format.


SetPlayWindow()

IMPORT_C TInt SetPlayWindow(const TTimeIntervalMicroSeconds &aStart, const TTimeIntervalMicroSeconds &aEnd);

Description

Sets the current playback window.

Parameters

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.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


ClearPlayWindow()

IMPORT_C TInt ClearPlayWindow();

Description

Clears the current playback window.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


SetBalance()

IMPORT_C TInt SetBalance(TInt aBalance=KMMFBalanceCenter);

Description

Sets the current playback balance.

Parameters

TInt aBalance

A value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight. The default value is KMMFBalanceCenter.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


GetBalance()

IMPORT_C TInt GetBalance(TInt &aBalance);

Description

Returns the current playback balance.

Parameters

TInt &aBalance

A value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


RegisterForAudioLoadingNotification()

IMPORT_C void RegisterForAudioLoadingNotification(MAudioLoadingObserver &aCallback);

Description

Registers callback object to receive notifications of audio loading/rebuffering.

Parameters

MAudioLoadingObserver &aCallback

The object to receive audio loading notifications.


GetAudioLoadingProgressL()

IMPORT_C void GetAudioLoadingProgressL(TInt &aPercentageComplete);

Description

Returns the current progress of audio loading.

Parameters

TInt &aPercentageComplete

The percentage of the audio clip loaded.


ControllerImplementationInformationL()

IMPORT_C const CMMFControllerImplementationInformation &ControllerImplementationInformationL();

Description

Returns the controller implementation information associated with the current controller.

Return value

const CMMFControllerImplementationInformation &

The controller implementation structure


CustomCommandSync()

IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg &aDestination, TInt aFunction, const TDesC8 &aDataTo1, const TDesC8 &aDataTo2, TDes8 &aDataFrom);

Description

Sends a synchronous custom command to the controller.

Parameters

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.

Return value

TInt

The result of the request. Exact range of values is dependent on the interface.


CustomCommandSync()

IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg &aDestination, TInt aFunction, const TDesC8 &aDataTo1, const TDesC8 &aDataTo2);

Description

Sends a synchronous custom command to the controller.

Parameters

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.

Return value

TInt

The result of the request. Exact range of values is dependent on the interface.


CustomCommandAsync()

IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg &aDestination, TInt aFunction, const TDesC8 &aDataTo1, const TDesC8 &aDataTo2, TDes8 &aDataFrom, TRequestStatus &aStatus);

Description

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.

Parameters

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.


CustomCommandAsync()

IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg &aDestination, TInt aFunction, const TDesC8 &aDataTo1, const TDesC8 &aDataTo2, TRequestStatus &aStatus);

Description

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.

Parameters

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.


GetBitRate()

IMPORT_C TInt GetBitRate(TUint &aBitRate);

Description

Returns the bit rate of the audio clip.

Parameters

TUint &aBitRate

The bit rate of the audio clip

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


GetDRMCustomCommand()

IMPORT_C MMMFDRMCustomCommand *GetDRMCustomCommand();

Description

Gets a controller's DRM custom command implementation.

Return value

MMMFDRMCustomCommand *

A pointer to a controller's DRM custom command implementation, or NULL if the controller does not support it.


RegisterAudioResourceNotification()

IMPORT_C TInt RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback &aCallback, TUid aNotificationEventUid, const TDesC8 &aNotificationRegistrationData=KNullDesC8);

Description

Registers the Event for Notification when resource is avaliable.

Parameters

MMMFAudioResourceNotificationCallback &aCallback

The audio outputstream observer interface..

TUid aNotificationEventUid

The Event for which the client is registered.

const TDesC8 &aNotificationRegistrationData

Notification registration specific data.

Return value

TInt

An error code indicating if the registration was successful. KErrNone on success, otherwise another of the system-wide error codes.


CancelRegisterAudioResourceNotification()

IMPORT_C TInt CancelRegisterAudioResourceNotification(TUid aNotificationEventId);

Description

Cancels the registered notification event.

Parameters

TUid aNotificationEventId

The Event to notify the client.

Return value

TInt

An error code indicating if the registration was successful. KErrNone on success, otherwise another of the system-wide error codes.


WillResumePlay()

IMPORT_C TInt WillResumePlay();

Description

Waits for the client to resume the play even after the default timer expires.

Return value

TInt

An error code indicating if the registration was successful. KErrNone on success, otherwise another of the system-wide error codes.

[Top]


Member data


iProperties

protected: CMMFMdaAudioPlayerUtility * iProperties;

Description

This member is internal and not intended for use.