sl@0: // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __MDAAUDIOSAMPLEPLAYER_H sl@0: #define __MDAAUDIOSAMPLEPLAYER_H sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: class CMdaServer; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: An interface to a set of audio player callback functions. sl@0: sl@0: The class is a mixin and is intended to be inherited by the client sl@0: class which is observing the audio playing operation. The functions sl@0: encapsulated by this class are called when specific events occur in sl@0: the process of initialising and playing an audio sample. A reference to sl@0: this object is passed as a parameter when constructing an audio player sl@0: utility object. sl@0: sl@0: @since 5.0 sl@0: */ sl@0: class MMdaAudioPlayerCallback sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Defines required client behaviour when an attempt to open and sl@0: initialise an audio sample has completed, successfully or otherwise. sl@0: sl@0: @param aError sl@0: The status of the audio sample after initialisation. sl@0: The following values have the same specific meaning sl@0: across all EPOC platforms: KErrNone the sl@0: sample is ready to play. KErrNotSupported sl@0: the audio format or particular encoding type is not sl@0: recognised or not supported. KErrNotFound sl@0: the audio sample cannot be found. sl@0: KErrNoMemory there is insufficient memory sl@0: to play this audio sample. Other values are possible sl@0: indicating a problem opening the audio sample. These sl@0: values are dependent on the EPOC platform. sl@0: @param aDuration sl@0: The duration of the audio sample. sl@0: */ sl@0: virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration) = 0; sl@0: sl@0: /** sl@0: Defines required client behaviour when an attempt to playback an audio sl@0: sample has completed, successfully or otherwise. sl@0: sl@0: @param aError sl@0: The status of playback. The following values have the sl@0: same specific meaning across all EPOC platforms: sl@0: KErrNone playing of the audio sample is sl@0: complete. KErrCorrupt the sample data is sl@0: corrupt. KErrInUse the sound device is in sl@0: use by another higher priority client. This can happen sl@0: during playback. KErrNoMemory there is sl@0: insufficient memory to play this audio sample Other sl@0: values are possible indicating a problem opening the sl@0: audio sample. These values are dependent on the EPOC sl@0: platform. sl@0: */ sl@0: virtual void MapcPlayComplete(TInt aError) = 0; sl@0: }; sl@0: sl@0: sl@0: class CMMFMdaAudioPlayerUtility; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Plays sampled audio data. sl@0: sl@0: The class offers a simple interface to open, play and obtain sl@0: information from, sampled audio data. The audio data can be supplied sl@0: either in a file (file-based), as a descriptor sl@0: (descriptor-based) or as a URL reference (since version 7.0s). sl@0: sl@0: While this class is abstract, the three static functions construct, initialise sl@0: and return pointers to instances of concrete classes derived from this sl@0: abstract class. sl@0: sl@0: @since 5.0 sl@0: */ sl@0: class CMdaAudioPlayerUtility : public CBase, sl@0: public MMMFClientUtility sl@0: { sl@0: public: sl@0: IMPORT_C static CMdaAudioPlayerUtility* NewFilePlayerL(const TDesC& aFileName, sl@0: MMdaAudioPlayerCallback& aCallback, sl@0: TInt aPriority = EMdaPriorityNormal, sl@0: TInt aPref = EMdaPriorityPreferenceTimeAndQuality, sl@0: CMdaServer* aServer = NULL); sl@0: IMPORT_C static CMdaAudioPlayerUtility* NewDesPlayerL(const TDesC8& aData, sl@0: MMdaAudioPlayerCallback& aCallback, sl@0: TInt aPriority = EMdaPriorityNormal, sl@0: TInt aPref = EMdaPriorityPreferenceTimeAndQuality, sl@0: CMdaServer* aServer = NULL); sl@0: IMPORT_C static CMdaAudioPlayerUtility* NewDesPlayerReadOnlyL(const TDesC8& aData, sl@0: MMdaAudioPlayerCallback& aCallback, sl@0: TInt aPriority = EMdaPriorityNormal, sl@0: TInt aPref = EMdaPriorityPreferenceTimeAndQuality, sl@0: CMdaServer* aServer = NULL); sl@0: sl@0: // new export from version 7.0 sl@0: IMPORT_C static CMdaAudioPlayerUtility* NewL(MMdaAudioPlayerCallback& aCallback, sl@0: TInt aPriority = EMdaPriorityNormal, sl@0: TInt aPref = EMdaPriorityPreferenceTimeAndQuality); sl@0: sl@0: IMPORT_C void UseSharedHeap(); sl@0: sl@0: ~CMdaAudioPlayerUtility(); sl@0: sl@0: virtual void Play(); sl@0: sl@0: virtual void Stop(); sl@0: sl@0: virtual TInt SetVolume(TInt aVolume); sl@0: sl@0: virtual void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence); sl@0: sl@0: virtual void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); sl@0: sl@0: virtual const TTimeIntervalMicroSeconds& Duration(); sl@0: IMPORT_C TMMFDurationInfo Duration(TTimeIntervalMicroSeconds& aDuration); sl@0: sl@0: virtual TInt MaxVolume(); sl@0: sl@0: IMPORT_C void OpenFileL(const TDesC& aFileName); sl@0: IMPORT_C void OpenFileL(const RFile& aFile); sl@0: sl@0: IMPORT_C void OpenFileL(const TMMSource& aSource); sl@0: sl@0: IMPORT_C void OpenDesL(const TDesC8& aDescriptor); sl@0: sl@0: IMPORT_C void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8); sl@0: sl@0: IMPORT_C TInt Pause(); sl@0: sl@0: IMPORT_C void Close(); sl@0: sl@0: IMPORT_C TInt GetPosition(TTimeIntervalMicroSeconds& aPosition); sl@0: sl@0: IMPORT_C void SetPosition(const TTimeIntervalMicroSeconds& aPosition); sl@0: sl@0: IMPORT_C TInt SetPriority(TInt aPriority, TInt aPref); sl@0: sl@0: IMPORT_C TInt GetVolume(TInt& aVolume); sl@0: sl@0: IMPORT_C TInt GetNumberOfMetaDataEntries(TInt& aNumEntries); sl@0: sl@0: IMPORT_C CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex); sl@0: sl@0: IMPORT_C TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, sl@0: const TTimeIntervalMicroSeconds& aEnd); sl@0: sl@0: IMPORT_C TInt ClearPlayWindow(); sl@0: sl@0: IMPORT_C TInt SetBalance(TInt aBalance = KMMFBalanceCenter); sl@0: sl@0: IMPORT_C TInt GetBalance(TInt& aBalance); sl@0: sl@0: IMPORT_C void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback); sl@0: sl@0: IMPORT_C void GetAudioLoadingProgressL(TInt& aPercentageComplete); sl@0: sl@0: IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL(); sl@0: sl@0: IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom); sl@0: sl@0: IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2); sl@0: sl@0: IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus); sl@0: sl@0: IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus); sl@0: sl@0: IMPORT_C TInt GetBitRate(TUint& aBitRate); sl@0: sl@0: IMPORT_C MMMFDRMCustomCommand* GetDRMCustomCommand(); sl@0: sl@0: IMPORT_C TInt RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback,TUid aNotificationEventUid,const TDesC8& aNotificationRegistrationData = KNullDesC8); sl@0: sl@0: IMPORT_C TInt CancelRegisterAudioResourceNotification(TUid aNotificationEventId); sl@0: sl@0: IMPORT_C TInt WillResumePlay(); sl@0: sl@0: IMPORT_C TInt SetThreadPriority(const TThreadPriority& aThreadPriority) const; sl@0: sl@0: private: sl@0: CMdaAudioPlayerUtility(); sl@0: sl@0: protected: sl@0: /** sl@0: This member is internal and not intended for use. sl@0: */ sl@0: CMMFMdaAudioPlayerUtility* iProperties; sl@0: }; sl@0: sl@0: sl@0: #endif