Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <MdaAudioSampleEditor.h>
Link against: mediaclientaudio.lib

Class CMdaAudioConvertUtility

class CMdaAudioConvertUtility : public CMdaAudioClipUtility;

Description

Converts the type, sample rate and format of audio data.

The audio sample data can be supplied either in a file or as a descriptor.

Derivation

Members

Defined in CMdaAudioConvertUtility:

Inherited from CBase:

Inherited from CMdaAudioClipUtility:


Construction and destruction


NewL(MMdaObjectStateChangeObserver &,CMdaServer *,TInt,TMdaPriorityPreference)

Capability: MultimediaDD A process requesting or using this method that has MultimediaDD capability will always have precedence over a process that does not have MultimediaDD.

IMPORT_C static CMdaAudioConvertUtility* NewL(MMdaObjectStateChangeObserver &aObserver, CMdaServer *aServer=0, TInt aPriority=EMdaPriorityNormal, TMdaPriorityPreference aPref=EMdaPriorityPreferenceTimeAndQuality);

Description

Constructs and initialises a new instance of the audio converter for converting audio sample data from one format to another.

The function leaves if the audio converter object cannot be created.

Parameters

MMdaObjectStateChangeObserver &aObserver

The class to receive state change events from converter.

CMdaServer *aServer

No longer used, should be NULL.

TInt aPriority

A priority between EMdaPriorityMin and EMdaPriorityMax. A higher value indicates a more important request. The absolute priority at which a client application runs is device-specific.

TMdaPriorityPreference aPref

Time vs Quality priority preferences, enumerated in TMdaPriorityPreference. This parameter dictates the behaviour if a higher priority client takes over the sound output device.

Return value

CMdaAudioConvertUtility *

A pointer to a new instance of CMdaAudioConvertUtility.


~CMdaAudioConvertUtility()

virtual ~CMdaAudioConvertUtility();

Description

Destructor.

Closes the audio clip and frees resources.

[Top]


Member functions


OpenL(const TDesC &,const TDesC &)

virtual void OpenL(const TDesC &aPrimaryFile, const TDesC &aSecondaryFile);

Description

Opens source and target files (both of which must already exist) so that audio sample data can be extracted from the source file, converted and appended to the target file.

When opening is complete, successfully or otherwise, the client is notified by MMdaObjectStateChangeObserver::MoscoStateChangeEvent(CBase *,TInt,TInt,TInt). The callback is initiated by this function providing it with state change information and error codes.

Parameters

const TDesC16 &aPrimaryFile

The full path and filename of a file containing audio sample data to be converted.

const TDesC16 &aSecondaryFile

The full path and filename of a file to which converted data is appended.


OpenL(const TDesC &,TMdaClipLocation *,TMdaClipFormat *,TMdaPackage *,TMdaPackage *)

virtual void OpenL(const TDesC &aPrimaryFile, TMdaClipLocation *aLocation, TMdaClipFormat *aFormat, TMdaPackage *aArg1=0, TMdaPackage *aArg2=0);

Description

Opens an existing audio file so that audio sample data can be extracted from it, converted and placed into the target audio object.

When opening is complete, successfully or otherwise, the client is notified by MMdaObjectStateChangeObserver::MoscoStateChangeEvent(CBase *,TInt,TInt,TInt). The callback is initiated by this function providing it with state change information and error codes.

Parameters

const TDesC16 &aPrimaryFile

The full path and filename of a file containing audio sample data to be converted.

TMdaClipLocation *aLocation

The target location for the audio data. This is normally a file (TMdaFileClipLocation) or a descriptor (TMdaDesClipLocation).

TMdaClipFormat *aFormat

The audio format for the target audio object.

TMdaPackage *aArg1

The codec to use for the target audio object.

TMdaPackage *aArg2

The audio settings for the target audio object.


OpenL(TMdaClipLocation *,TMdaClipLocation *,TMdaClipFormat *,TMdaClipFormat *,TMdaPackage *,TMdaPackage *,TMdaPackage *,TMdaPackage *)

virtual void OpenL(TMdaClipLocation *aPriLocation, TMdaClipLocation *aSecLocation, TMdaClipFormat *aPriFormat, TMdaClipFormat *aSecFormat, TMdaPackage *aPriArg1=0, TMdaPackage *aPriArg2=0, TMdaPackage *aSecArg1=0, TMdaPackage *aSecArg2=0);

Description

Opens an audio clip for conversion.

Parameters

TMdaClipLocation *aPriLocation

The source location for audio data. This is normally a file (TMdaFileClipLocation) or a descriptor (TMdaDesClipLocation).

TMdaClipLocation *aSecLocation

The target location for audio data. This is normally a file (TMdaFileClipLocation) or a descriptor (TMdaDesClipLocation).

TMdaClipFormat *aPriFormat

The audio format of the source audio object.

TMdaClipFormat *aSecFormat

The audio format for the target audio object.

TMdaPackage *aPriArg1

The codec used by the source audio object.

TMdaPackage *aPriArg2

The audio settings of the source audio object.

TMdaPackage *aSecArg1

The codec to be used for the target audio object.

TMdaPackage *aSecArg2

The audio settings for the target audio object.


OpenL(TMdaClipLocation *,TMdaClipLocation *,TUid,TUid,TFourCC)

IMPORT_C void OpenL(TMdaClipLocation *aPriLocation, TMdaClipLocation *aSecLocation, TUid aControllerUid, TUid aDestFormatUid, TFourCC aDestDataType);

Description

Opens source and target audio objects and specifies controller and audio format and codec information.

When opening is complete, successfully or otherwise, the client is notified by MMdaObjectStateChangeObserver::MoscoStateChangeEvent(CBase *,TInt,TInt,TInt). The callback is initiated by this function providing it with state change information and error codes.

Parameters

TMdaClipLocation *aPriLocation

The source location for audio data. This is normally a file (TMdaFileClipLocation) or a descriptor (TMdaDesClipLocation).

TMdaClipLocation *aSecLocation

The destination location for the converted audio data. This is normally a file (TMdaFileClipLocation) or a descriptor (TMdaDesClipLocation).

TUid aControllerUid

The UID of the controller to used for conversion.

TUid aDestFormatUid

The UID of the destination format.

TFourCC aDestDataType

The audio codec to use for the destination data sink.


GetSupportedDestinationDataTypesL(RArray< TFourCC > &)

IMPORT_C void GetSupportedDestinationDataTypesL(RArray< TFourCC > &aSupportedDestinationDataTypes);

Description

Returns a list of the supported data types for the conversion destination.

Parameters

RArray< TFourCC > &aSupportedDestinationDataTypes

A list of four character codes, representing the supported data encodings for the conversion destination.


SetDestinationDataTypeL(TFourCC)

IMPORT_C void SetDestinationDataTypeL(TFourCC aDataType);

Description

Sets the data type of the destination audio clip.

Parameters

TFourCC aDataType

The four character code, representing the encoding of the destination audio clip


DestinationDataTypeL()

IMPORT_C TFourCC DestinationDataTypeL();

Description

Returns the data type of the destination audio clip.

Return value

TFourCC

The four character code, representing the encoding of the destination audio clip.


SourceDataTypeL()

IMPORT_C TFourCC SourceDataTypeL();

Description

Returns the data type of the source audio clip.

Return value

TFourCC

The four character code, representing the encoding of the source audio clip.


SetDestinationBitRateL(TUint)

IMPORT_C void SetDestinationBitRateL(TUint aBitRate);

Description

Sets the bit rate of the destination audio clip.

The bit rate must be one of the supported bit rates of the audio target. Use CMdaAudioConvertUtility::GetSupportedConversionBitRatesL(RArray< TUint > &) to retrieve a list of supported bit rates.

Parameters

TUint aBitRate

The destination bit rate in bits/second.


DestinationBitRateL()

IMPORT_C TUint DestinationBitRateL();

Description

Returns the bit rate of the destination audio clip.

Return value

TUint

The destination bit rate in bits/second.


GetSupportedConversionBitRatesL(RArray< TUint > &)

IMPORT_C void GetSupportedConversionBitRatesL(RArray< TUint > &aSupportedBitRates);

Description

Gets a list of the supported bit rates for the conversion destination.

Parameters

RArray< TUint > &aSupportedBitRates

The list of bit rates supported for the conversion destination.


SourceBitRateL()

IMPORT_C TInt SourceBitRateL();

Description

Returns the bit rate of the source audio clip.

Return value

TInt

The source bit rate in bits/second.


SetDestinationSampleRateL(TUint)

IMPORT_C void SetDestinationSampleRateL(TUint aSampleRate);

Description

Sets the sample rate for the conversion destination.

The sample rate must be one of the supported sample rates of the audio target. Use CMdaAudioConvertUtility::GetSupportedConversionSampleRatesL(RArray< TUint > &) to retrieve a list of supported sample rates. This function should not be used if the audio clip already exists; that is, in the "Open and Append" scenario, when the function's behaviour is undefined.

Parameters

TUint aSampleRate

The sample rate of the conversion destination in samples per second.


DestinationSampleRateL()

IMPORT_C TUint DestinationSampleRateL();

Description

Returns the sample rate of the conversion destination.

Return value

TUint

The sample rate of the conversion destination in samples per second.


GetSupportedConversionSampleRatesL(RArray< TUint > &)

IMPORT_C void GetSupportedConversionSampleRatesL(RArray< TUint > &aSupportedSampleRates);

Description

Gets a list of supported conversion sample rates. This is a list of the sample rates that the conversion destination can take.

Parameters

RArray< TUint > &aSupportedSampleRates

A list of the sample rates that are supported for the conversion.


SourceSampleRateL()

IMPORT_C TUint SourceSampleRateL();

Description

Returns the sample rate of the source audio clip.

Return value

TUint

The source sample rate in samples/second.


SetDestinationFormatL(TUid)

IMPORT_C void SetDestinationFormatL(TUid aFormatUid);

Description

Sets the format of the destination audio clip.

The UID (aFormatUid) corresponds to the UID of the destination format to use.

Parameters

TUid aFormatUid

The UID of the destination format.


DestinationFormatL()

IMPORT_C TUid DestinationFormatL();

Description

Returns the format of the destination audio clip.

Return value

TUid

The UID of the destination format.


SourceFormatL()

IMPORT_C TUid SourceFormatL();

Description

Returns the format of the source audio clip.

Return value

TUid

The UID of the source format.


SetDestinationNumberOfChannelsL(TUint)

IMPORT_C void SetDestinationNumberOfChannelsL(TUint aNumberOfChannels);

Description

Sets the number of channels the destination audio clip contains.

The number of channels must be one of the values returned by CMdaAudioConvertUtility::GetSupportedConversionNumberOfChannelsL(RArray< TUint > &).

Parameters

TUint aNumberOfChannels

The number of channels.


DestinationNumberOfChannelsL()

IMPORT_C TUint DestinationNumberOfChannelsL();

Description

Returns the number of channels the destination audio clip contains.

Return value

TUint

The number of channels.


GetSupportedConversionNumberOfChannelsL(RArray< TUint > &)

IMPORT_C void GetSupportedConversionNumberOfChannelsL(RArray< TUint > &aSupportedNumChannels);

Description

Returns a list of the supported number of channels for conversion.

For example, 1 for mono, 2 for stereo and so on.

Parameters

RArray< TUint > &aSupportedNumChannels

A list of the number of channels supported for the conversion destination.


SourceNumberOfChannelsL()

IMPORT_C TUint SourceNumberOfChannelsL();

Description

Returns the number of channels used by the conversion source.

Return value

TUint

The number of channels.


ConvertL()

IMPORT_C void ConvertL();

Description

Performs the conversion from the source audio format to the destination.

When conversion is complete, successfully or otherwise, the client is notified by MMdaObjectStateChangeObserver::MoscoStateChangeEvent(CBase *,TInt,TInt,TInt). The callback is initiated by this function providing it with state change information and error codes.


State()

virtual TState State();

Description

Returns the current utility state.

Return value

CMdaAudioClipUtility::TState

The state of the audio sample data. See CMdaAudioClipUtility::TState.


Close()

virtual void Close();

Description

Closes the current audio clip.


PlayL()

virtual void PlayL();

Description

This function is mapped to CMdaAudioConvertUtility::ConvertL(). CMdaAudioConvertUtility::ConvertL() should be used instead.

See also:


RecordL()

virtual void RecordL();

Description

This function is mapped to ConvertL. CMdaAudioConvertUtility::ConvertL() should be used instead.


Stop()

virtual void Stop();

Description

Stops the current operation (playback/recording/conversion).

When conversion has been stopped, successfully or otherwise, the client is notified by MMdaObjectStateChangeObserver::MoscoStateChangeEvent(CBase *,TInt,TInt,TInt). The callback is initiated by this function providing it with state change information and error codes.


CropL()

virtual void CropL();

Description

Crops the current clip from the current position. The remainder of the clip is discarded.

The effects of the function cannot be undone. The function is synchronous and can leave if there is a problem. The leave code depends on the configuration.


SetPosition(const TTimeIntervalMicroSeconds &)

virtual void SetPosition(const TTimeIntervalMicroSeconds &aPosition);

Description

Sets the current position in the audio clip.

A subsequent call to CMdaAudioConvertUtility::ConvertL() starts conversion from this new position.

Parameters

const TTimeIntervalMicroSeconds &aPosition

The position in the audio clip, in microseconds.


Position()

virtual const TTimeIntervalMicroSeconds& Position();

Description

Returns the current position in the audio clip. The position is defined in terms of a time interval measured from the beginning of the audio sample data.

Return value

const TTimeIntervalMicroSeconds &

The current position in the audio clip, in microseconds.


RecordTimeAvailable()

virtual const TTimeIntervalMicroSeconds& RecordTimeAvailable();

Description

Returns the amount of recording time available to the current clip.

Return value

const TTimeIntervalMicroSeconds &

The recording time available measured in microseconds.


Duration()

virtual const TTimeIntervalMicroSeconds& Duration();

Description

Returns the duration of the audio clip.

Return value

const TTimeIntervalMicroSeconds &

The duration in microseconds.


SetPlayWindow(const TTimeIntervalMicroSeconds &,const TTimeIntervalMicroSeconds &)

virtual void SetPlayWindow(const TTimeIntervalMicroSeconds &aStart, const TTimeIntervalMicroSeconds &aEnd);

Description

Sets a window for playback.

The window is defined in terms of a start and end time. A subsequent call to CMdaAudioConvertUtility::ConvertL() results in just the data within the window being converted.

Parameters

const TTimeIntervalMicroSeconds &aStart

The position in the clip to start playback, in microseconds. This must be any value from zero to aEnd. If this value is less than zero or greater than aEnd, this function raises EMMFMediaClientPanicServerCommunicationProblem panic in debug version.

const TTimeIntervalMicroSeconds &aEnd

The position in the clip to end playback, in microseconds. This must be any value from aStart to the value returned by CMdaAudioConvertUtility::Duration(). If this value is greater than the value returned by CMdaAudioConvertUtility::Duration() or less than aStart, this function raises EMMFMediaClientPanicServerCommunicationProblem panic in debug version.


ClearPlayWindow()

virtual void ClearPlayWindow();

Description

Clears the playback window.

Playback returns to playing the entire clip. A subsequent call to CMdaAudioConvertUtility::ConvertL() results in the entire source audio being converted.


SetRepeats(TInt,const TTimeIntervalMicroSeconds &)

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

Description

Sets the number of repetitions for playback. This is unsupported for CMdaConvertUtility as there is no playback facility. It is provided only for binary compatibility.

Parameters

TInt aRepeatNumberOfTimes

The number of times to repeat the audio clip, after the first playback. If this is set to KMdaRepeatForever, then the audio sample, together with the trailing silence, is repeated indefinitely. If this is set to zero, then the audio sample is not repeated.

const TTimeIntervalMicroSeconds &aTrailingSilence

A delay to wait before each repetition.


SetMaxWriteLength(TInt)

virtual void SetMaxWriteLength(TInt aMaxWriteLength=KMdaClipLocationMaxWriteLengthNone);

Description

Sets the maximum size of an audio clip.

This function is provided so that applications such as recorders and converters can limit the amount of file storage/memory that should be allocated.

Parameters

TInt aMaxWriteLength

The maximum size of the audio clip, in bytes. If the default value is used, there is no maximum file size.


CropFromBeginningL()

virtual void CropFromBeginningL();

Description

Crops the audio clip from the start of the file to the current position. The audio data prior to the current position is discarded.

The effects of the function cannot be undone.

The function is synchronous and can leave if there is a problem. The leave code depends on the configuration.


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 associated with the controller


CustomCommandSync(const TMMFMessageDestinationPckg &,TInt,const TDesC8 &,const TDesC8 &,TDes8 &)

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 TPckgBuf &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(const TMMFMessageDestinationPckg &,TInt,const TDesC8 &,const TDesC8 &)

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 TPckgBuf &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 controllert 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. The exact range of values is dependent on the interface.


CustomCommandAsync(const TMMFMessageDestinationPckg &,TInt,const TDesC8 &,const TDesC8 &,TDes8 &,TRequestStatus &)

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

Description

Send a 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 TPckgBuf &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(const TMMFMessageDestinationPckg &,TInt,const TDesC8 &,const TDesC8 &,TRequestStatus &)

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

Description

Send a 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 TPckgBuf &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.


SetThreadPriority(const TThreadPriority &)const

IMPORT_C TInt SetThreadPriority(const TThreadPriority &aThreadPriority) const;

Description

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.

Parameters

const TThreadPriority &aThreadPriority

Return value

TInt

TInt A standard error code: KErrNone if successful, KErrNotReady if the thread does not have a valid handle.


UseSharedHeap()

IMPORT_C void UseSharedHeap();

Description

Ensures that any subsequent calls to OpenXYZ() will create controllers that share a heap.

The default behaviour is that for each converter 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.