sl@0: /* sl@0: * Copyright (c) 2006 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: This is the definition of the Audio Equalizer effect class. sl@0: * sl@0: */ sl@0: sl@0: sl@0: #ifndef CAUDIOEQUALIZER_H sl@0: #define CAUDIOEQUALIZER_H sl@0: sl@0: // INCLUDES sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: const TUid KUidAudioEqualizerEffect = {0x1020382A}; sl@0: sl@0: // FORWARD DELCARATION sl@0: class CMdaAudioConvertUtility; sl@0: class CMdaAudioPlayerUtility; sl@0: class CMdaAudioRecorderUtility; sl@0: class CMdaAudioInputStream; sl@0: class CMdaAudioOutputStream; sl@0: class CMdaAudioToneUtility; sl@0: class CCustomCommandUtility; sl@0: class CCustomInterfaceUtility; sl@0: class CMMFDevSound; sl@0: class CMidiClientUtility; sl@0: class CDrmPlayerUtility; sl@0: class CVideoPlayerUtility; sl@0: sl@0: // CLASS DECLARATION sl@0: sl@0: /** sl@0: * This is the Equalizer effect class for managing audio equalizer settings. sl@0: * sl@0: * @lib AudioEqualizerEffect.lib sl@0: * @since 3.0 sl@0: */ sl@0: sl@0: class CAudioEqualizer : public CAudioEffect sl@0: { sl@0: sl@0: public: //New Functions sl@0: sl@0: /** sl@0: * Factory function for creating the audio equalizer object. sl@0: * @since 3.0 sl@0: * @return pointer to CAudioEqualizer object sl@0: */ sl@0: IMPORT_C static CAudioEqualizer* NewL(); sl@0: sl@0: /** sl@0: * Factory function for creating the audio equalizer object. sl@0: * @since 3.0 sl@0: * @param aUtility A reference to a convert utility sl@0: * @return pointer to CAudioEqualizer object sl@0: */ sl@0: IMPORT_C static CAudioEqualizer* NewL( CMdaAudioConvertUtility& aUtility ); sl@0: sl@0: /** sl@0: * Factory function for creating the audio equalizer object. sl@0: * @since 3.0 sl@0: * @param aUtility A reference to an audio input stream utility sl@0: * @return pointer to CAudioEqualizer object sl@0: */ sl@0: IMPORT_C static CAudioEqualizer* NewL( CMdaAudioInputStream& aUtility ); sl@0: sl@0: /** sl@0: * Factory function for creating the audio equalizer object. sl@0: * @since 3.0 sl@0: * @param aUtility A reference to an audio output stream utility sl@0: * @return pointer to CAudioEqualizer object sl@0: */ sl@0: IMPORT_C static CAudioEqualizer* NewL( CMdaAudioOutputStream& aUtility ); sl@0: sl@0: /** sl@0: * Factory function for creating the audio equalizer object. sl@0: * @since 3.0 sl@0: * @param aUtility A reference to an audio player utility sl@0: * @return pointer to CAudioEqualizer object sl@0: */ sl@0: IMPORT_C static CAudioEqualizer* NewL( CMdaAudioPlayerUtility& aUtility ); sl@0: sl@0: /** sl@0: * Factory function for creating the audio equalizer object. sl@0: * @since 3.0 sl@0: * @param aUtility A reference to an audio record utility sl@0: * @param aRecordStream ETrue if the effect is to be applied to the recording, sl@0: * EFalse if the effect is to be applied only to the playback sl@0: * @return pointer to CAudioEqualizer object sl@0: */ sl@0: IMPORT_C static CAudioEqualizer* NewL( CMdaAudioRecorderUtility& aUtility, TBool aRecordStream ); sl@0: sl@0: /** sl@0: * Factory function for creating the audio equalizer object. sl@0: * @since 3.0 sl@0: * @param aUtility A reference to an audio tone utility sl@0: * @return pointer to CAudioEqualizer object sl@0: */ sl@0: IMPORT_C static CAudioEqualizer* NewL( CMdaAudioToneUtility& aUtility ); sl@0: sl@0: /** sl@0: * Factory function for creating the audio equalizer object. sl@0: * @since 3.0 sl@0: * @param aDevSound A reference to a DevSound instance sl@0: * @return pointer to CAudioEqualizer object sl@0: */ sl@0: IMPORT_C static CAudioEqualizer* NewL( CMMFDevSound& aDevSound ); sl@0: sl@0: /** sl@0: * Factory function for creating the audio equalizer object. sl@0: * @since 3.0 sl@0: * @param aUtility A reference to a custom command utility sl@0: * @return pointer to CAudioEqualizer object sl@0: */ sl@0: IMPORT_C static CAudioEqualizer* NewL( CCustomCommandUtility* aUtility ); sl@0: sl@0: /** sl@0: * Factory function for creating the audio equalizer object. sl@0: * @since 3.0 sl@0: * @param aCustomInterface A reference to a custom interface sl@0: * @return pointer to CAudioEqualizer object sl@0: */ sl@0: IMPORT_C static CAudioEqualizer* NewL( MCustomInterface& aCustomInterface ); sl@0: sl@0: sl@0: /** sl@0: * Factory function for creating the audio equalizer object. sl@0: * @since 3.0 sl@0: * @param CMidiClientUtility A reference to a CMidiClientUtility object sl@0: * @return pointer to CAudioEqualizer object sl@0: */ sl@0: IMPORT_C static CAudioEqualizer* NewL( CMidiClientUtility& aUtility ); sl@0: sl@0: /** sl@0: * Factory function for creating the audio equalizer object. sl@0: * @since 3.0 sl@0: * @param CDrmPlayerUtility A reference to a CDrmPlayerUtility object sl@0: * @return pointer to CAudioEqualizer object sl@0: */ sl@0: IMPORT_C static CAudioEqualizer* NewL( CDrmPlayerUtility& aUtility ); sl@0: sl@0: /** sl@0: * Factory function for creating the audio equalizer object. sl@0: * @since 3.2 sl@0: * @param CVideoPlayerUtility A reference to a CVideoPlayerUtility object sl@0: * @return pointer to CAudioEqualizer object sl@0: */ sl@0: IMPORT_C static CAudioEqualizer* NewL( CVideoPlayerUtility& aUtility ); sl@0: sl@0: /** sl@0: * sl@0: * Destructor sl@0: */ sl@0: IMPORT_C virtual ~CAudioEqualizer(); sl@0: sl@0: /** sl@0: * Get the band level in mB for the specified band sl@0: * @since 3.0 sl@0: * @param aBand Frequency Band sl@0: * @return Returns the band level in mB for the specified band sl@0: */ sl@0: IMPORT_C TInt32 BandLevel( TUint8 aBand ) const; sl@0: sl@0: /** sl@0: * Get the band width in Hz for the specified band. sl@0: * @since 3.0 sl@0: * @param aBand Frequency Band sl@0: * @return The band width in Hz for the specified band sl@0: */ sl@0: IMPORT_C TInt32 BandWidth( TUint8 aBand ) const; sl@0: sl@0: /** sl@0: * Get the center frequency in Hz for a given band sl@0: * @since 3.0 sl@0: * @param aBand Frequency Band sl@0: * @return The center frequency in Hz for a given band. sl@0: */ sl@0: IMPORT_C TInt32 CenterFrequency( TUint8 aBand ) const; sl@0: sl@0: /** sl@0: * Get the cross-over frequency between the given frequency band (aBand) and the next band sl@0: * @since 3.0 sl@0: * @param aBand Frequency Band sl@0: * @return Crossover frequency. sl@0: */ sl@0: IMPORT_C TInt32 CrossoverFrequency( TUint8 aBand ) const; sl@0: sl@0: /** sl@0: * Get the dB range in mB for the equalizer sl@0: * @since 3.0 sl@0: * @param aMin Minimum level in dB sl@0: * @param aMin Maximum level in dB sl@0: */ sl@0: IMPORT_C void DbLevelLimits( TInt32& aMin, TInt32& aMax ); sl@0: sl@0: /** sl@0: * Get number of equalizer bands. sl@0: * @since 3.0 sl@0: * @param - sl@0: * @return The number of equalizer bands. sl@0: */ sl@0: IMPORT_C TUint8 NumberOfBands() const; sl@0: sl@0: /** sl@0: * Sets the equalizer band level value in mB, ranging from Min to Max sl@0: * @since 3.0 sl@0: * @param aBand Frequency Band sl@0: * @param aLevel band level in dB, ranges from DbLevelLimits() sl@0: * @return - sl@0: */ sl@0: IMPORT_C void SetBandLevelL( TInt8 aBand, TInt32 aLevel ); sl@0: sl@0: public: // functions from base class sl@0: sl@0: /* sl@0: * From CAudioEffect sl@0: * Get the unique identifier of the audio effect sl@0: * @since 3.0 sl@0: * @return Unique identifier sl@0: */ sl@0: IMPORT_C TUid Uid() const; sl@0: sl@0: sl@0: protected: // Functions from base classes sl@0: sl@0: /** sl@0: * From CAudioEffect sl@0: * Create a package of the effect data sl@0: * @since 3.0 sl@0: * @return A descriptor containing the effect data. sl@0: */ sl@0: IMPORT_C const TDesC8& DoEffectData(); sl@0: sl@0: /** sl@0: * From CAudioEffect sl@0: * Internal function to unpack effect data sl@0: * @since 3.0 sl@0: * @param aEffectDataBuffer Descriptor containing packed effect data sl@0: * @return - sl@0: */ sl@0: IMPORT_C void SetEffectData( const TDesC8& aEffectDataBuffer ); sl@0: sl@0: protected: sl@0: sl@0: /** sl@0: * Private C++ constructor for this class. sl@0: * @since 3.0 sl@0: * @return - sl@0: */ sl@0: IMPORT_C CAudioEqualizer(); sl@0: sl@0: /** sl@0: * Create a descriptor containing data for the specified band(s). sl@0: * @since 3.0 sl@0: * @param aBand The frequency band data to package. Valid if aAllBands = EFalse. sl@0: * @param aAllBands Indicate if data for all bands is requested. sl@0: * @return A descriptor containing data for specified band. sl@0: */ sl@0: IMPORT_C const TDesC8& DoBandDataL( TUint8 aBand, TBool aAllBands ); sl@0: sl@0: /** sl@0: * Unpack band data from the specified descriptor. sl@0: * @since 3.0 sl@0: * @param aNumberOfBands Number of bands contained in the descriptor. sl@0: * @param aBandDataBuffer Descriptor containing band data sl@0: */ sl@0: IMPORT_C void SetBandDataL( TInt aNumberOfBands, const TDesC8& aBandDataBuffer ); sl@0: sl@0: protected: sl@0: sl@0: // Equalizer data structure sl@0: TEfAudioEqualizer iAudioEqualizerData; sl@0: // Equalizer Band data structure sl@0: RArray iBandsData; sl@0: // Data package sent to server sl@0: TEfAudioEqualizerDataPckg iDataPckgTo; sl@0: // Band Data package sent to server sl@0: TEfAudioEqualizerBandDataPckg iBandDataPckgTo; sl@0: // Bitmask used to indicate change in band data sl@0: TUint32 iBandChange; sl@0: sl@0: HBufC8* iBandDataBuf; sl@0: sl@0: protected: // Friend classes sl@0: sl@0: friend class CAudioEqualizerMessageHandler; sl@0: friend class CAudioEqualizerUtility; sl@0: sl@0: }; sl@0: sl@0: #endif // of CAUDIOEQUALIZER_H sl@0: sl@0: // End of File