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