Update contrib.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #ifndef MDASOUNDADAPTER_H
18 #define MDASOUNDADAPTER_H
24 #define MDADEVSOUNDNAME _L8("RMdaDevSound")
27 Adapter class which routes the calls on RMdaDevSound(old sound driver interface) to RSoundSc(new sound driver interface).
28 The purpose of this class is to use the new sound driver in MDF without changing the calling code. This class
29 does not support any new functionalities supported by the shared chunk sound driver but supports the functionality of the
30 of the old driver with the new driver.
37 enum for major, minor and build version of sound device driver.
39 enum TVer {EMajorVersionNumber=1,EMinorVersionNumber=0,EBuildVersionNumber=KE32BuildVersionNumber};
41 enum for sound media device play/record request.
45 /* Play data request */
47 /* Play error notification */
48 EMdaRequestPlayErrorNotification,
49 /* Record data request */
50 EMdaRequestRecordData,
51 /* Record error notification */
52 EMdaRequestRecordErrorNotification
55 /* enum for media device control request */
58 /* play format (capability) supported request */
59 EMdaControlPlayFormatsSupported,
60 /* get the current play format request */
61 EMdaControlGetPlayFormat,
62 /* set the play format request */
63 EMdaControlSetPlayFormat,
64 /* get play volume request */
65 EMdaControlGetPlayVolume,
66 /* set play volume request */
67 EMdaControlSetPlayVolume,
68 /* record format supported request */
69 EMdaControlRecordFormatsSupported,
70 /* get the current record format request */
71 EMdaControlGetRecordFormat,
72 /* set record format request */
73 EMdaControlSetRecordFormat,
74 /* get record volume request */
75 EMdaControlGetRecordLevel,
76 /* set record volume request */
77 EMdaControlSetRecordLevel,
78 /* stop play request */
79 EMdaControlFlushPlayBuffer,
80 /* stop record request */
81 EMdaControlFlushRecordBuffer,
82 /* bytes played request */
83 EMdaControlBytesPlayed,
84 /* set base value for the bytes played */
85 EMdaControlResetBytesPlayed,
86 /* Investigate for sound media driver request */
87 EMdaControlIsMdaSound,
88 /* pause play request */
89 EMdaControlPausePlayBuffer,
90 /* resume play request */
91 EMdaControlResumePlaying
95 This enum corresponds to supported sound encoding schemes
97 enum TMdaSoundEncoding
99 /* sound encoding(compression) using 8 bit PCM (pulse code modulation) */
100 EMdaSoundEncoding8BitPCM = 0x00000001,
101 /* sound encoding using 16 bit PCM */
102 EMdaSoundEncoding16BitPCM = 0x00000002,
103 /* sound encoding using 8 bit A law */
104 EMdaSoundEncoding8BitALaw = 0x00000004,
105 /* sound encoding using 8 bit Mu law */
106 EMdaSoundEncoding8BitMuLaw = 0x00000008,
110 This class corresponds to a supported sound format.
111 The format describes the supported audio device's min/max sampling rate, encoding, channels and buffer size of play/record and volume.
113 class TSoundFormatsSupported
117 This corresponds to minimum sample rate supported. This depends on the physical sound device used(example: 8000 hertz).
122 This corresponds to maximum sample rate supported. This depends on the physical sound device used(example: 48000 hertz).
127 This corresponds to encoding format supported.
128 @see TMdaSoundEncoding
133 This corresponds to the number of sound channels supported. Possible values are EMono for a single channel and EStereo for two channel sound.
134 Also this depends on the physical device used.
139 This corresponds to minimum buffer size. This depends on the physical device used and sampling rate adapted.
140 @see KSoundMinBufferSize
145 This corresponds to maximum buffer size.This depends on the physical device used and sampling rate adapted.
146 @see KSoundPlayBufferSize
147 @see KSoundRecordBufferSize
152 This corresponds to minimum play/record volume.
157 This corresponds to maximum play/record volume.
162 /* A typedef'd packaged RMdaDevSound::TSoundFormatsSupported for passing through a generic API method */
163 typedef TPckgBuf<TSoundFormatsSupported> TSoundFormatsSupportedBuf;
166 This class corresponds to current supported sound format.
167 The format describes the supported audio device's sampling rate, encoding, channels and buffer size of play/record.
169 class TCurrentSoundFormat
173 This corresponds to sound sampling rate like (44000 Hertz, 8000 Hertz). The possible values depends on the physical device used.
178 @see TMdaSoundEncoding
180 TMdaSoundEncoding iEncoding;
183 This corresponds to the number of sound channels supported. Possible values are EMono for a single channel and EStereo for two channel sound.
184 Also this depends on the physical device used.
189 Play or Record buffer size. The possible value depends on the physical device used.
194 /* A typedef'd packaged RMdaDevSound::TCurrentSoundFormat for passing through a generic API method */
195 typedef TPckgBuf<TCurrentSoundFormat> TCurrentSoundFormatBuf;
197 IMPORT_C RMdaDevSound();
198 IMPORT_C TInt Open(TInt aUnit=KNullUnit);
199 IMPORT_C TVersion VersionRequired() const;
200 IMPORT_C TInt IsMdaSound();
201 IMPORT_C void PlayFormatsSupported(TSoundFormatsSupportedBuf& aFormatsSupported);
202 IMPORT_C void GetPlayFormat(TCurrentSoundFormatBuf& aFormat);
203 IMPORT_C TInt SetPlayFormat(const TCurrentSoundFormatBuf& aFormat);
204 IMPORT_C TInt PlayVolume();
205 // This function mimics RMdaDevSound interface with linear volume semantics
206 IMPORT_C void SetPlayVolume(TInt aLinearVolume);
207 // This function supports volume change with logarithmic semantics
208 IMPORT_C void SetVolume(TInt aLogarithmicVolume);
209 IMPORT_C void PlayData(TRequestStatus& aStatus,const TDesC8& aData);
210 IMPORT_C void CancelPlayData();
211 IMPORT_C void NotifyPlayError(TRequestStatus& aStatus);
212 IMPORT_C void CancelNotifyPlayError();
214 IMPORT_C void RecordFormatsSupported(TSoundFormatsSupportedBuf& aFormatsSupported);
215 IMPORT_C void GetRecordFormat(TCurrentSoundFormatBuf& aFormat);
216 IMPORT_C TInt SetRecordFormat(const TCurrentSoundFormatBuf& aFormat);
217 IMPORT_C TInt RecordLevel();
218 IMPORT_C void SetRecordLevel(TInt aLevel);
219 IMPORT_C void RecordData(TRequestStatus& aStatus,TDes8& aData);
220 IMPORT_C void CancelRecordData();
221 IMPORT_C void NotifyRecordError(TRequestStatus& aStatus);
222 IMPORT_C void CancelNotifyRecordError();
224 IMPORT_C void FlushPlayBuffer();
225 IMPORT_C void FlushRecordBuffer();
226 IMPORT_C TInt BytesPlayed();
227 IMPORT_C void ResetBytesPlayed();
228 IMPORT_C void PausePlayBuffer();
229 IMPORT_C void ResumePlaying();
230 IMPORT_C void ResumePlaying(TRequestStatus&);
231 IMPORT_C void Close();
232 IMPORT_C TInt Handle();
233 IMPORT_C void PauseRecordBuffer();
234 IMPORT_C void ResumeRecording();
235 IMPORT_C TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTimePlayed);