sl@0: // Copyright (c) 1998-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 the License "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: // e32\include\d32soundsc.h sl@0: // User side class definition for the shared chunk sound driver. sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @prototype sl@0: */ sl@0: sl@0: #ifndef __D32SOUNDSC_H__ sl@0: #define __D32SOUNDSC_H__ sl@0: sl@0: #include sl@0: #include sl@0: #ifndef __KERNEL_MODE__ sl@0: #include sl@0: #endif sl@0: sl@0: _LIT(KDevSoundScName,"SoundSc"); sl@0: sl@0: const TInt KSoundScTxUnit0=0; sl@0: const TInt KSoundScTxUnit1=1; sl@0: /** sl@0: @capability UserEnvironment sl@0: @ref RSoundSc::Open An RSoundSc may not be opened for record without UserEnvironment sl@0: */ sl@0: const TInt KSoundScRxUnit0=4; sl@0: /** sl@0: @capability UserEnvironment sl@0: @ref RSoundSc::Open An RSoundSc may not be opened for record without UserEnvironment sl@0: */ sl@0: const TInt KSoundScRxUnit1=5; sl@0: sl@0: // Note that the implementation in the sound driver LDD to calculate a default audio configuration assumes a sl@0: // monotonic ordering of all caps bitfields. If it is necessary to break this ordering then this implementation sl@0: // will need to be reviewed and possibly changed. sl@0: sl@0: /** sl@0: Sound driver capability constants - bitmasks of the audio channel configurations supported sl@0: by a unit. @see TSoundFormatsSupportedV02. sl@0: */ sl@0: /** The unit supports Mono (i.e. a single audio channel). */ sl@0: const TUint KSoundMonoChannel = 0x0001; sl@0: /** The unit supports Stereo (i.e. two audio channels). */ sl@0: const TUint KSoundStereoChannel = 0x0002; sl@0: /** The unit supports three audio channels. */ sl@0: const TUint KSoundThreeChannel = 0x0004; sl@0: /** The unit supports four audio channels. */ sl@0: const TUint KSoundFourChannel = 0x0008; sl@0: /** The unit supports five audio channels. */ sl@0: const TUint KSoundFiveChannel = 0x0010; sl@0: /** The unit supports six audio channels. */ sl@0: const TUint KSoundSixChannel = 0x0020; sl@0: sl@0: /** sl@0: Sound driver capability constants - bitmasks of supported sample rates. @see TSoundFormatsSupportedV02. sl@0: */ sl@0: /** The device supports the 7.35KHz sample rate. */ sl@0: const TUint KSoundRate7350Hz = 0x0001; sl@0: /** The device supports the 8KHz sample rate. */ sl@0: const TUint KSoundRate8000Hz = 0x0002; sl@0: /** The device supports the 8.82KHz sample rate. */ sl@0: const TUint KSoundRate8820Hz = 0x0004; sl@0: /** The device supports the 9.6KHz sample rate. */ sl@0: const TUint KSoundRate9600Hz = 0x0008; sl@0: /** The device supports the 11.025KHz sample rate. */ sl@0: const TUint KSoundRate11025Hz = 0x0010; sl@0: /** The device supports the 12KHz sample rate. */ sl@0: const TUint KSoundRate12000Hz = 0x0020; sl@0: /** The device supports the 14.7KHz sample rate. */ sl@0: const TUint KSoundRate14700Hz = 0x0040; sl@0: /** The device supports the 16KHz sample rate. */ sl@0: const TUint KSoundRate16000Hz = 0x0080; sl@0: /** The device supports the 22.05KHz sample rate. */ sl@0: const TUint KSoundRate22050Hz = 0x0100; sl@0: /** The device supports the 24KHz sample rate. */ sl@0: const TUint KSoundRate24000Hz = 0x0200; sl@0: /** The device supports the 29.4KHz sample rate. */ sl@0: const TUint KSoundRate29400Hz = 0x0400; sl@0: /** The device supports the 32KHz sample rate. */ sl@0: const TUint KSoundRate32000Hz = 0x0800; sl@0: /** The device supports the 44.1KHz sample rate. */ sl@0: const TUint KSoundRate44100Hz = 0x1000; sl@0: /** The device supports the 48KHz sample rate. */ sl@0: const TUint KSoundRate48000Hz = 0x2000; sl@0: sl@0: /** sl@0: Sound driver capability constants - bitmasks of supported encoding formats. @see TSoundFormatsSupportedV02. sl@0: */ sl@0: /** The device supports 8bit PCM encoding format. */ sl@0: const TUint KSoundEncoding8BitPCM = 0x0001; sl@0: /** The device supports 16bit PCM encoding format. */ sl@0: const TUint KSoundEncoding16BitPCM = 0x0002; sl@0: /** The device supports 24bit PCM encoding format. */ sl@0: const TUint KSoundEncoding24BitPCM = 0x0004; sl@0: sl@0: /** sl@0: Sound driver capability constants - bitmasks of the data formats supported sl@0: by the device. @see TSoundFormatsSupportedV02. sl@0: */ sl@0: /** The device supports an interleaved data format (i.e. data for each channel is interleaved throughout sl@0: each data buffer). */ sl@0: const TUint KSoundDataFormatInterleaved = 0x0001; sl@0: /** The device supports a non-interleaved data format (i.e. data for each channel is arranged in sl@0: contiguous regions within each data buffer). */ sl@0: const TUint KSoundDataFormatNonInterleaved = 0x0002; sl@0: sl@0: /** The maximum setting possible for the record level / volume. */ sl@0: const TInt KSoundMaxVolume = 255; sl@0: sl@0: /** sl@0: Enumeration of possible data transfer directions. @see TSoundFormatsSupportedV02. sl@0: */ sl@0: enum TSoundDirection sl@0: { sl@0: /** A unit for recording data. */ sl@0: ESoundDirRecord, sl@0: /** A unit for playing data. */ sl@0: ESoundDirPlayback sl@0: }; sl@0: sl@0: /** sl@0: Enumeration of possible sample rates. @see TCurrentSoundFormatV02. sl@0: */ sl@0: enum TSoundRate sl@0: { sl@0: /** 7.35KHz sample rate. */ sl@0: ESoundRate7350Hz, sl@0: /** 8KHz sample rate. */ sl@0: ESoundRate8000Hz, sl@0: /** 8.82KHz sample rate. */ sl@0: ESoundRate8820Hz, sl@0: /** 9.6KHz sample rate. */ sl@0: ESoundRate9600Hz, sl@0: /** 11.025KHz sample rate. */ sl@0: ESoundRate11025Hz, sl@0: /** 12KHz sample rate. */ sl@0: ESoundRate12000Hz, sl@0: /** 14.7KHz sample rate. */ sl@0: ESoundRate14700Hz, sl@0: /** 16KHz sample rate. */ sl@0: ESoundRate16000Hz, sl@0: /** 22.05KHz sample rate. */ sl@0: ESoundRate22050Hz, sl@0: /** 24KHz sample rate. */ sl@0: ESoundRate24000Hz, sl@0: /** 29.4KHz sample rate. */ sl@0: ESoundRate29400Hz, sl@0: /** 32KHz sample rate. */ sl@0: ESoundRate32000Hz, sl@0: /** 44.1KHz sample rate. */ sl@0: ESoundRate44100Hz, sl@0: /** 48KHz sample rate. */ sl@0: ESoundRate48000Hz sl@0: }; sl@0: sl@0: /** sl@0: Enumeration of possible sound encoding formats. @see TCurrentSoundFormatV02. sl@0: */ sl@0: enum TSoundEncoding sl@0: { sl@0: /** 8bit PCM encoding format. */ sl@0: ESoundEncoding8BitPCM, sl@0: /** 16bit PCM encoding format. */ sl@0: ESoundEncoding16BitPCM, sl@0: /** 24bit PCM encoding format. */ sl@0: ESoundEncoding24BitPCM sl@0: }; sl@0: sl@0: /** sl@0: Enumeration of possible sound data formats. @see TCurrentSoundFormatV02. sl@0: */ sl@0: enum TSoundDataFormat sl@0: { sl@0: /** The device supports an interleaved data format. */ sl@0: ESoundDataFormatInterleaved, sl@0: /** The device supports a non-interleaved data format. */ sl@0: ESoundDataFormatNonInterleaved sl@0: }; sl@0: sl@0: /** sl@0: The general driver capabilites class - returned by the LDD factory in response to RDevice::GetCaps(). sl@0: */ sl@0: class TCapsSoundScV01 sl@0: { sl@0: public: sl@0: TVersion iVersion; sl@0: }; sl@0: sl@0: /** sl@0: The main audio capabilities class. This is used by the LDD to get either the play or record capabilities sl@0: of a particular sound device once a channel to it has been opened. sl@0: */ sl@0: class TSoundFormatsSupportedV02 sl@0: { sl@0: public: sl@0: /** The data transfer direction for this unit: play or record. @see TSoundDirection. */ sl@0: TSoundDirection iDirection; sl@0: /** The audio channel configurations supported by this unit - a bitfield. */ sl@0: TUint32 iChannels; sl@0: /** The sample rates supported - a bitfield. */ sl@0: TUint32 iRates; sl@0: /** The encoding formats supported - a bitfield. */ sl@0: TUint32 iEncodings; sl@0: /** The data formats supported - a bitfield. */ sl@0: TUint32 iDataFormats; sl@0: /** The minimum request size that the device can support. All requests to play or record data must be of a sl@0: length that is a multiple of this value. */ sl@0: TInt iRequestMinSize; sl@0: /** The logarithm to base 2 of the alignment required for request arguments. All requests to play or sl@0: record data must specify locations in the shared chunk which conform to this alignment. sl@0: For example, iRequestAlignment of 1 is 2 byte aligned (2^1), 2 is 4 byte aligned (2^2) etc. */ sl@0: TInt iRequestAlignment; sl@0: /** Indicates whether this unit is capable of detecting changes in its hardware configuration. */ sl@0: TBool iHwConfigNotificationSupport; sl@0: /** Reserved field. */ sl@0: TInt iReserved1; sl@0: }; sl@0: typedef TPckgBuf TSoundFormatsSupportedV02Buf; sl@0: sl@0: /** sl@0: The sound format configuration class. This is used to get and set the current configuration sl@0: of the sound device (both for playing and recording). sl@0: */ sl@0: class TCurrentSoundFormatV02 sl@0: { sl@0: public: sl@0: /** The audio channel configuration: 1=Mono, 2=Stereo etc. */ sl@0: TInt iChannels; sl@0: /** The sample rate. @see TSoundRate. */ sl@0: TSoundRate iRate; sl@0: /** The encoding format. @see TSoundEncoding. */ sl@0: TSoundEncoding iEncoding; sl@0: /** The data format: interleaved, non-interleaved etc. @see TSoundDataFormat. */ sl@0: TSoundDataFormat iDataFormat; sl@0: /** Reserved field. */ sl@0: TInt iReserved1; sl@0: }; sl@0: typedef TPckgBuf TCurrentSoundFormatV02Buf; sl@0: sl@0: /** sl@0: A flag that can be passed via the 'aFlags' argument of the function RSoundSc::PlayData(). This being sl@0: set signifies that this particular play request is the last one of a series (ie EOF) and therefore an underflow is sl@0: expected after this request completes. sl@0: */ sl@0: const TUint KSndFlagLastSample=0x00000001; sl@0: sl@0: /** Reserved settings used with CustomConfig(). */ sl@0: const TInt KSndCustomConfigMaxReserved=0x0FFFFFFF; sl@0: #ifdef _DEBUG sl@0: const TInt KSndCustom_ForceHwConfigNotifSupported=0x00; sl@0: const TInt KSndCustom_CompleteChangeOfHwConfig=0x01; sl@0: const TInt KSndCustom_ForceStartTransferError=0x02; sl@0: const TInt KSndCustom_ForceTransferDataError=0x03; sl@0: const TInt KSndCustom_ForceTransferTimeout=0x04; sl@0: #endif sl@0: sl@0: /** A structure used to assemble arguments for the function RSoundSc::PlayData() and to pass these to the driver. */ sl@0: struct SRequestPlayDataInfo sl@0: { sl@0: TInt iBufferOffset; sl@0: TInt iLength; sl@0: TUint iFlags; sl@0: }; sl@0: sl@0: #ifndef __KERNEL_MODE__ sl@0: typedef TPckgBuf TTimeIntervalMicroSecondsBuf; sl@0: #endif sl@0: sl@0: class RSoundSc : public RBusLogicalChannel sl@0: { sl@0: private: sl@0: enum TRequest sl@0: /** sl@0: Asynchronous request types sl@0: */ sl@0: { sl@0: EMsgRequestPlayData, sl@0: ERequestNotifyChangeOfHwConfig, sl@0: EMsgRequestMax=3, // All requests less than this value are handled in the driver DFC thread. sl@0: ERequestRecordData, sl@0: ENumRequests, sl@0: EAllRequests = (1< sl@0: sl@0: #endif // __D32SOUNDSC_H__ sl@0: