sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
/**
|
sl@0
|
19 |
@test
|
sl@0
|
20 |
@internalComponent
|
sl@0
|
21 |
|
sl@0
|
22 |
This contains CT_CurrentSoundFormatData
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
// User includes
|
sl@0
|
26 |
#include "t_currentsoundformatdata.h"
|
sl@0
|
27 |
#include "sound_util.h"
|
sl@0
|
28 |
|
sl@0
|
29 |
/*@{*/
|
sl@0
|
30 |
/// Commands
|
sl@0
|
31 |
_LIT(KCmdNew, "new");
|
sl@0
|
32 |
_LIT(KCmdDestructor, "~");
|
sl@0
|
33 |
_LIT(KCmd_iRate_get, "irate_get");
|
sl@0
|
34 |
_LIT(KCmd_iRate_set, "irate_set");
|
sl@0
|
35 |
_LIT(KCmd_iEncoding_get, "iencoding_get");
|
sl@0
|
36 |
_LIT(KCmd_iEncoding_set, "iencoding_set");
|
sl@0
|
37 |
_LIT(KCmd_iChannels_get, "ichannels_get");
|
sl@0
|
38 |
_LIT(KCmd_iChannels_set, "ichannels_set");
|
sl@0
|
39 |
_LIT(KCmd_iBufferSize_get, "ibuffer_size_get");
|
sl@0
|
40 |
_LIT(KCmd_iBufferSize_set, "ibuffer_size_set");
|
sl@0
|
41 |
|
sl@0
|
42 |
/*@{*/
|
sl@0
|
43 |
/// Parameters
|
sl@0
|
44 |
|
sl@0
|
45 |
_LIT(KRate, "rate");
|
sl@0
|
46 |
_LIT(KRateExpected, "rate_expected");
|
sl@0
|
47 |
_LIT(KEncoding, "encoding");
|
sl@0
|
48 |
_LIT(KEncodingExpected, "encoding_expected");
|
sl@0
|
49 |
_LIT(KChannels, "channels");
|
sl@0
|
50 |
_LIT(KChannelsExpected, "channels_expected");
|
sl@0
|
51 |
_LIT(KBufferSize, "buffer_size");
|
sl@0
|
52 |
_LIT(KBufferSizeExpected, "buffer_size_expected");
|
sl@0
|
53 |
// possible parameter for new to indicate loading settings from
|
sl@0
|
54 |
// SoundFormatsSupported object
|
sl@0
|
55 |
_LIT(KNewFromSoundFormatsSupported, "new_from_sound_formats_supported");
|
sl@0
|
56 |
// for SoundFormatsSupported object
|
sl@0
|
57 |
_LIT(KSoundFormatsSupportedObject, "SoundFormatsSupportedObject");
|
sl@0
|
58 |
// Enums declared in INI file
|
sl@0
|
59 |
|
sl@0
|
60 |
/// Logging
|
sl@0
|
61 |
_LIT(KLogNew, "New object created successfully");
|
sl@0
|
62 |
_LIT(KLogNewError, "Error in creating object error code=%d");
|
sl@0
|
63 |
/*@}*/
|
sl@0
|
64 |
|
sl@0
|
65 |
/**
|
sl@0
|
66 |
* Two phase constructor
|
sl@0
|
67 |
*/
|
sl@0
|
68 |
CT_CurrentSoundFormatData* CT_CurrentSoundFormatData::NewL()
|
sl@0
|
69 |
{
|
sl@0
|
70 |
CT_CurrentSoundFormatData* ret=new (ELeave) CT_CurrentSoundFormatData();
|
sl@0
|
71 |
CleanupStack::PushL(ret);
|
sl@0
|
72 |
ret->ConstructL();
|
sl@0
|
73 |
CleanupStack::Pop(ret);
|
sl@0
|
74 |
return ret;
|
sl@0
|
75 |
}
|
sl@0
|
76 |
|
sl@0
|
77 |
/**
|
sl@0
|
78 |
* Constructor. First phase construction
|
sl@0
|
79 |
*/
|
sl@0
|
80 |
CT_CurrentSoundFormatData::CT_CurrentSoundFormatData()
|
sl@0
|
81 |
: CDataWrapperBase()
|
sl@0
|
82 |
, iCurrentFormat(NULL)
|
sl@0
|
83 |
{
|
sl@0
|
84 |
}
|
sl@0
|
85 |
|
sl@0
|
86 |
/**
|
sl@0
|
87 |
* Second phase construction
|
sl@0
|
88 |
*/
|
sl@0
|
89 |
void CT_CurrentSoundFormatData::ConstructL()
|
sl@0
|
90 |
{
|
sl@0
|
91 |
}
|
sl@0
|
92 |
|
sl@0
|
93 |
/**
|
sl@0
|
94 |
* Destructor
|
sl@0
|
95 |
*/
|
sl@0
|
96 |
CT_CurrentSoundFormatData::~CT_CurrentSoundFormatData()
|
sl@0
|
97 |
{
|
sl@0
|
98 |
DoCleanup();
|
sl@0
|
99 |
}
|
sl@0
|
100 |
|
sl@0
|
101 |
/**
|
sl@0
|
102 |
* Helper method for doing cleanup operation
|
sl@0
|
103 |
*/
|
sl@0
|
104 |
void CT_CurrentSoundFormatData::DoCleanup()
|
sl@0
|
105 |
{
|
sl@0
|
106 |
delete iCurrentFormat;
|
sl@0
|
107 |
iCurrentFormat=NULL;
|
sl@0
|
108 |
}
|
sl@0
|
109 |
|
sl@0
|
110 |
/**
|
sl@0
|
111 |
* Return a pointer to the object that the data wraps
|
sl@0
|
112 |
*
|
sl@0
|
113 |
* @return pointer to the object that the data wraps
|
sl@0
|
114 |
*/
|
sl@0
|
115 |
TAny* CT_CurrentSoundFormatData::GetObject()
|
sl@0
|
116 |
|
sl@0
|
117 |
{
|
sl@0
|
118 |
return iCurrentFormat;
|
sl@0
|
119 |
}
|
sl@0
|
120 |
|
sl@0
|
121 |
/**
|
sl@0
|
122 |
* Set the wrapped data object with new value
|
sl@0
|
123 |
*/
|
sl@0
|
124 |
void CT_CurrentSoundFormatData::SetObjectL(TAny* aAny)
|
sl@0
|
125 |
|
sl@0
|
126 |
{
|
sl@0
|
127 |
DoCleanup();
|
sl@0
|
128 |
iCurrentFormat=static_cast<RMdaDevSound::TCurrentSoundFormat*>(aAny);
|
sl@0
|
129 |
}
|
sl@0
|
130 |
|
sl@0
|
131 |
/**
|
sl@0
|
132 |
* Clear the wrapped data object pointer w/o de-initialization
|
sl@0
|
133 |
*/
|
sl@0
|
134 |
void CT_CurrentSoundFormatData::DisownObjectL()
|
sl@0
|
135 |
|
sl@0
|
136 |
{
|
sl@0
|
137 |
iCurrentFormat=NULL;
|
sl@0
|
138 |
}
|
sl@0
|
139 |
|
sl@0
|
140 |
/**
|
sl@0
|
141 |
* Return static cleanup function
|
sl@0
|
142 |
*/
|
sl@0
|
143 |
inline TCleanupOperation CT_CurrentSoundFormatData::CleanupOperation()
|
sl@0
|
144 |
|
sl@0
|
145 |
{
|
sl@0
|
146 |
return CleanupOperation;
|
sl@0
|
147 |
}
|
sl@0
|
148 |
|
sl@0
|
149 |
/**
|
sl@0
|
150 |
* Static cleanup function
|
sl@0
|
151 |
*/
|
sl@0
|
152 |
void CT_CurrentSoundFormatData::CleanupOperation( TAny* aAny )
|
sl@0
|
153 |
{
|
sl@0
|
154 |
RMdaDevSound::TCurrentSoundFormat* format = static_cast<RMdaDevSound::TCurrentSoundFormat*> ( aAny );
|
sl@0
|
155 |
delete format;
|
sl@0
|
156 |
}
|
sl@0
|
157 |
|
sl@0
|
158 |
/**
|
sl@0
|
159 |
* Process a command read from the ini file
|
sl@0
|
160 |
*
|
sl@0
|
161 |
* @param aDataWrapper test step requiring command to be processed
|
sl@0
|
162 |
* @param aCommand the command to process
|
sl@0
|
163 |
* @param aSection the entry in the ini file requiring the command to be processed
|
sl@0
|
164 |
*
|
sl@0
|
165 |
* @return ETrue if the command is processed
|
sl@0
|
166 |
*/
|
sl@0
|
167 |
TBool CT_CurrentSoundFormatData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
|
sl@0
|
168 |
{
|
sl@0
|
169 |
TBool ret=ETrue;
|
sl@0
|
170 |
if ( aCommand==KCmdNew )
|
sl@0
|
171 |
{
|
sl@0
|
172 |
DoCmdNewL(aSection);
|
sl@0
|
173 |
}
|
sl@0
|
174 |
else if ( aCommand==KCmdDestructor )
|
sl@0
|
175 |
{
|
sl@0
|
176 |
DoCmdDestructor();
|
sl@0
|
177 |
}
|
sl@0
|
178 |
else if ( aCommand==KCmd_iRate_get )
|
sl@0
|
179 |
{
|
sl@0
|
180 |
DoCmd_iRate_get(aSection);
|
sl@0
|
181 |
}
|
sl@0
|
182 |
else if ( aCommand==KCmd_iEncoding_get )
|
sl@0
|
183 |
{
|
sl@0
|
184 |
DoCmd_iEncoding_getL(aSection);
|
sl@0
|
185 |
}
|
sl@0
|
186 |
else if ( aCommand==KCmd_iChannels_get )
|
sl@0
|
187 |
{
|
sl@0
|
188 |
DoCmd_iChannels_get(aSection);
|
sl@0
|
189 |
}
|
sl@0
|
190 |
else if ( aCommand==KCmd_iBufferSize_get )
|
sl@0
|
191 |
{
|
sl@0
|
192 |
DoCmd_iBufferSize_get(aSection);
|
sl@0
|
193 |
}
|
sl@0
|
194 |
else if ( aCommand==KCmd_iRate_set )
|
sl@0
|
195 |
{
|
sl@0
|
196 |
DoCmd_iRate_set(aSection);
|
sl@0
|
197 |
}
|
sl@0
|
198 |
else if ( aCommand==KCmd_iEncoding_set )
|
sl@0
|
199 |
{
|
sl@0
|
200 |
DoCmd_iEncoding_set(aSection);
|
sl@0
|
201 |
}
|
sl@0
|
202 |
else if ( aCommand==KCmd_iChannels_set )
|
sl@0
|
203 |
{
|
sl@0
|
204 |
DoCmd_iChannels_set(aSection);
|
sl@0
|
205 |
}
|
sl@0
|
206 |
else if ( aCommand==KCmd_iBufferSize_set )
|
sl@0
|
207 |
{
|
sl@0
|
208 |
DoCmd_iBufferSize_set(aSection);
|
sl@0
|
209 |
}
|
sl@0
|
210 |
else
|
sl@0
|
211 |
{
|
sl@0
|
212 |
ret=CDataWrapperBase::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
|
sl@0
|
213 |
}
|
sl@0
|
214 |
|
sl@0
|
215 |
return ret;
|
sl@0
|
216 |
}
|
sl@0
|
217 |
|
sl@0
|
218 |
/**
|
sl@0
|
219 |
* Function for creating new instance of RMdaDevSound::TCurrentSoundFormat
|
sl@0
|
220 |
*
|
sl@0
|
221 |
* @param aSection section name where can be indicated to create new
|
sl@0
|
222 |
* from SoundFormatsSupported object values
|
sl@0
|
223 |
* KNewFromSoundFormatsSupported - create from
|
sl@0
|
224 |
* SoundFormatsSupported object
|
sl@0
|
225 |
*
|
sl@0
|
226 |
* @return void
|
sl@0
|
227 |
*
|
sl@0
|
228 |
* @leave System wide error
|
sl@0
|
229 |
*/
|
sl@0
|
230 |
void CT_CurrentSoundFormatData::DoCmdNewL(const TDesC& aSection)
|
sl@0
|
231 |
{
|
sl@0
|
232 |
DoCleanup();
|
sl@0
|
233 |
|
sl@0
|
234 |
TRAPD(err, iCurrentFormat = new (ELeave) RMdaDevSound::TCurrentSoundFormat());
|
sl@0
|
235 |
if ( err!=KErrNone )
|
sl@0
|
236 |
{
|
sl@0
|
237 |
ERR_PRINTF2(KLogNewError, err);
|
sl@0
|
238 |
SetError(err);
|
sl@0
|
239 |
}
|
sl@0
|
240 |
else
|
sl@0
|
241 |
{
|
sl@0
|
242 |
INFO_PRINTF1(KLogNew);
|
sl@0
|
243 |
TBool new_object;
|
sl@0
|
244 |
if (GET_OPTIONAL_BOOL_PARAMETER(KNewFromSoundFormatsSupported(), aSection, new_object))
|
sl@0
|
245 |
{
|
sl@0
|
246 |
DoInitiateSupportedFormatsL(aSection);
|
sl@0
|
247 |
}
|
sl@0
|
248 |
}
|
sl@0
|
249 |
}
|
sl@0
|
250 |
|
sl@0
|
251 |
/**
|
sl@0
|
252 |
* Function to perform cleanup opertation
|
sl@0
|
253 |
*/
|
sl@0
|
254 |
void CT_CurrentSoundFormatData::DoCmdDestructor()
|
sl@0
|
255 |
{
|
sl@0
|
256 |
DoCleanup();
|
sl@0
|
257 |
}
|
sl@0
|
258 |
|
sl@0
|
259 |
/**
|
sl@0
|
260 |
* Get function for iRate
|
sl@0
|
261 |
*
|
sl@0
|
262 |
* @param aSection section name where expected value can be read
|
sl@0
|
263 |
* KRateExpected - expected rate
|
sl@0
|
264 |
*
|
sl@0
|
265 |
* @return void
|
sl@0
|
266 |
*
|
sl@0
|
267 |
* @leave no
|
sl@0
|
268 |
*/
|
sl@0
|
269 |
void CT_CurrentSoundFormatData::DoCmd_iRate_get(const TDesC& aSection)
|
sl@0
|
270 |
{
|
sl@0
|
271 |
TInt expected;
|
sl@0
|
272 |
if (GET_OPTIONAL_INT_PARAMETER(KRateExpected(), aSection, expected))
|
sl@0
|
273 |
{
|
sl@0
|
274 |
if(iCurrentFormat->iRate != expected)
|
sl@0
|
275 |
{
|
sl@0
|
276 |
ERR_PRINTF3(_L("Expected result != iRate, expected=%d, iRate=%d"), expected, iCurrentFormat->iRate);
|
sl@0
|
277 |
SetBlockResult(EFail);
|
sl@0
|
278 |
}
|
sl@0
|
279 |
else
|
sl@0
|
280 |
{
|
sl@0
|
281 |
INFO_PRINTF1(_L("iRate == expected result!"));
|
sl@0
|
282 |
}
|
sl@0
|
283 |
}
|
sl@0
|
284 |
else
|
sl@0
|
285 |
{
|
sl@0
|
286 |
INFO_PRINTF2(_L("iRate=%d"), iCurrentFormat->iRate);
|
sl@0
|
287 |
}
|
sl@0
|
288 |
}
|
sl@0
|
289 |
|
sl@0
|
290 |
|
sl@0
|
291 |
/**
|
sl@0
|
292 |
* Set function for iRate
|
sl@0
|
293 |
*
|
sl@0
|
294 |
* @param aSection section name where value to set can be read
|
sl@0
|
295 |
* KRate - rate to set
|
sl@0
|
296 |
*
|
sl@0
|
297 |
* @return void
|
sl@0
|
298 |
*
|
sl@0
|
299 |
* @leave no
|
sl@0
|
300 |
*/
|
sl@0
|
301 |
void CT_CurrentSoundFormatData::DoCmd_iRate_set(const TDesC& aSection)
|
sl@0
|
302 |
{
|
sl@0
|
303 |
GET_MANDATORY_INT_PARAMETER(KRate(), aSection, iCurrentFormat->iRate);
|
sl@0
|
304 |
}
|
sl@0
|
305 |
|
sl@0
|
306 |
/**
|
sl@0
|
307 |
* Get function for iEncoding
|
sl@0
|
308 |
*
|
sl@0
|
309 |
* @param aSection section name where expected value can be read
|
sl@0
|
310 |
* KEncodingExpected - expected encoding
|
sl@0
|
311 |
*
|
sl@0
|
312 |
* @return void
|
sl@0
|
313 |
*
|
sl@0
|
314 |
* @leave no
|
sl@0
|
315 |
*/
|
sl@0
|
316 |
void CT_CurrentSoundFormatData::DoCmd_iEncoding_getL(const TDesC& aSection)
|
sl@0
|
317 |
{
|
sl@0
|
318 |
TUint expEncoding;
|
sl@0
|
319 |
if(GetOrFromConfig(aSection, KEncodingExpected(), TSoundUtil::iEnumTableSoundEncoding, expEncoding ))
|
sl@0
|
320 |
{
|
sl@0
|
321 |
TUint encodings = iCurrentFormat->iEncoding;
|
sl@0
|
322 |
if(expEncoding != encodings)
|
sl@0
|
323 |
{
|
sl@0
|
324 |
ERR_PRINTF3(_L("iEncoding != expected result! iEncodings=0x%x, expected result=0x%x"), encodings, expEncoding);
|
sl@0
|
325 |
SetBlockResult(EFail);
|
sl@0
|
326 |
}
|
sl@0
|
327 |
else
|
sl@0
|
328 |
{
|
sl@0
|
329 |
INFO_PRINTF3(_L("iEncoding == expected result!, iEncodings=0x%x, expected=0x%x"), encodings, expEncoding);
|
sl@0
|
330 |
}
|
sl@0
|
331 |
}
|
sl@0
|
332 |
else
|
sl@0
|
333 |
{
|
sl@0
|
334 |
INFO_PRINTF2(_L("iEncoding=0x%x"), iCurrentFormat->iEncoding);
|
sl@0
|
335 |
}
|
sl@0
|
336 |
}
|
sl@0
|
337 |
|
sl@0
|
338 |
/**
|
sl@0
|
339 |
* Set function for iEncoding
|
sl@0
|
340 |
*
|
sl@0
|
341 |
* @param aSection section name where value to set can be read
|
sl@0
|
342 |
* KEncoding - encoding to set
|
sl@0
|
343 |
*
|
sl@0
|
344 |
* @return void
|
sl@0
|
345 |
*
|
sl@0
|
346 |
* @leave no
|
sl@0
|
347 |
*/
|
sl@0
|
348 |
void CT_CurrentSoundFormatData::DoCmd_iEncoding_set(const TDesC& aSection)
|
sl@0
|
349 |
{
|
sl@0
|
350 |
TUint encoding;
|
sl@0
|
351 |
if(GetOrFromConfig(aSection, KEncoding(), TSoundUtil::iEnumTableSoundEncoding, encoding ))
|
sl@0
|
352 |
{
|
sl@0
|
353 |
iCurrentFormat->iEncoding = (RMdaDevSound::TMdaSoundEncoding)encoding;
|
sl@0
|
354 |
INFO_PRINTF2(_L("iEncoding=0x%x"), iCurrentFormat->iEncoding);
|
sl@0
|
355 |
}
|
sl@0
|
356 |
else
|
sl@0
|
357 |
{
|
sl@0
|
358 |
ERR_PRINTF1(_L("Could not get encoding from TMdaSoundEncoding in INI file"));
|
sl@0
|
359 |
SetBlockResult(EFail);
|
sl@0
|
360 |
}
|
sl@0
|
361 |
}
|
sl@0
|
362 |
|
sl@0
|
363 |
/**
|
sl@0
|
364 |
* Get function for iChannels
|
sl@0
|
365 |
*
|
sl@0
|
366 |
* @param aSection section name where expected value can be read
|
sl@0
|
367 |
* KChannelsExpected - channels expected
|
sl@0
|
368 |
*
|
sl@0
|
369 |
* @return void
|
sl@0
|
370 |
*
|
sl@0
|
371 |
* @leave no
|
sl@0
|
372 |
*/
|
sl@0
|
373 |
void CT_CurrentSoundFormatData::DoCmd_iChannels_get(const TDesC& aSection)
|
sl@0
|
374 |
{
|
sl@0
|
375 |
TInt expected;
|
sl@0
|
376 |
if (GET_OPTIONAL_INT_PARAMETER(KChannelsExpected(), aSection, expected))
|
sl@0
|
377 |
{
|
sl@0
|
378 |
if(iCurrentFormat->iChannels != expected)
|
sl@0
|
379 |
{
|
sl@0
|
380 |
ERR_PRINTF3(_L("Expected result != iChannels, expected=%d, iChannels=%d"), expected, iCurrentFormat->iChannels);
|
sl@0
|
381 |
SetBlockResult(EFail);
|
sl@0
|
382 |
}
|
sl@0
|
383 |
else
|
sl@0
|
384 |
{
|
sl@0
|
385 |
INFO_PRINTF1(_L("iChannels == expected result!"));
|
sl@0
|
386 |
}
|
sl@0
|
387 |
}
|
sl@0
|
388 |
else
|
sl@0
|
389 |
{
|
sl@0
|
390 |
INFO_PRINTF2(_L("iChannels=%d"), iCurrentFormat->iChannels);
|
sl@0
|
391 |
}
|
sl@0
|
392 |
}
|
sl@0
|
393 |
|
sl@0
|
394 |
/**
|
sl@0
|
395 |
* Set function for iChannels
|
sl@0
|
396 |
*
|
sl@0
|
397 |
* @param aSection section name where value to set can be read
|
sl@0
|
398 |
* KChannels - channels to set
|
sl@0
|
399 |
*
|
sl@0
|
400 |
* @return void
|
sl@0
|
401 |
*
|
sl@0
|
402 |
* @leave no
|
sl@0
|
403 |
*/
|
sl@0
|
404 |
void CT_CurrentSoundFormatData::DoCmd_iChannels_set(const TDesC& aSection)
|
sl@0
|
405 |
{
|
sl@0
|
406 |
GET_MANDATORY_INT_PARAMETER(KChannels(), aSection, iCurrentFormat->iChannels);
|
sl@0
|
407 |
}
|
sl@0
|
408 |
|
sl@0
|
409 |
/**
|
sl@0
|
410 |
* Get function for iBufferSize
|
sl@0
|
411 |
*
|
sl@0
|
412 |
* @param aSection section name where expected value can be read
|
sl@0
|
413 |
* KBufferSizeExpected - buffer size expected
|
sl@0
|
414 |
*
|
sl@0
|
415 |
* @return void
|
sl@0
|
416 |
*
|
sl@0
|
417 |
* @leave no
|
sl@0
|
418 |
*/
|
sl@0
|
419 |
void CT_CurrentSoundFormatData::DoCmd_iBufferSize_get(const TDesC& aSection)
|
sl@0
|
420 |
{
|
sl@0
|
421 |
TInt expected;
|
sl@0
|
422 |
if (GET_OPTIONAL_INT_PARAMETER(KBufferSizeExpected(), aSection, expected))
|
sl@0
|
423 |
{
|
sl@0
|
424 |
if(iCurrentFormat->iBufferSize != expected)
|
sl@0
|
425 |
{
|
sl@0
|
426 |
ERR_PRINTF3(_L("Expected result != iBufferSize, expected=%d, iBufferSize=%d"), expected, iCurrentFormat->iBufferSize);
|
sl@0
|
427 |
SetBlockResult(EFail);
|
sl@0
|
428 |
}
|
sl@0
|
429 |
else
|
sl@0
|
430 |
{
|
sl@0
|
431 |
INFO_PRINTF1(_L("iBufferSize == expected result!"));
|
sl@0
|
432 |
}
|
sl@0
|
433 |
}
|
sl@0
|
434 |
else
|
sl@0
|
435 |
{
|
sl@0
|
436 |
INFO_PRINTF2(_L("iBufferSize=%d"), iCurrentFormat->iBufferSize);
|
sl@0
|
437 |
}
|
sl@0
|
438 |
}
|
sl@0
|
439 |
|
sl@0
|
440 |
/**
|
sl@0
|
441 |
* Set function for iBufferSize
|
sl@0
|
442 |
*
|
sl@0
|
443 |
* @param aSection section name where value to set can be read
|
sl@0
|
444 |
* KBufferSize - buffer size to set
|
sl@0
|
445 |
*
|
sl@0
|
446 |
* @return void
|
sl@0
|
447 |
*
|
sl@0
|
448 |
* @leave no
|
sl@0
|
449 |
*/
|
sl@0
|
450 |
void CT_CurrentSoundFormatData::DoCmd_iBufferSize_set(const TDesC& aSection)
|
sl@0
|
451 |
{
|
sl@0
|
452 |
GET_MANDATORY_INT_PARAMETER(KBufferSize(), aSection, iCurrentFormat->iBufferSize);
|
sl@0
|
453 |
}
|
sl@0
|
454 |
|
sl@0
|
455 |
/**
|
sl@0
|
456 |
* Function to set current sound format with first valid values from
|
sl@0
|
457 |
* TSoundFormatsSupported object. Function will set iBufferSize, iChannels,
|
sl@0
|
458 |
* iRate and iEncoding variable
|
sl@0
|
459 |
*
|
sl@0
|
460 |
* @param aSection section name which contains SoundFormatsSupported object
|
sl@0
|
461 |
* KSoundFormatsSupportedObject - SoundFormatsSupported object
|
sl@0
|
462 |
* name
|
sl@0
|
463 |
*
|
sl@0
|
464 |
* @return void
|
sl@0
|
465 |
*
|
sl@0
|
466 |
* @leave System wide error
|
sl@0
|
467 |
*/
|
sl@0
|
468 |
void CT_CurrentSoundFormatData::DoInitiateSupportedFormatsL(const TDesC& aSection)
|
sl@0
|
469 |
{
|
sl@0
|
470 |
INFO_PRINTF1(_L("Calling DoInitiateSupportedFormats(), Setting iCurrentFormat variables from TSoundFormatsSupported"));
|
sl@0
|
471 |
TPtrC objectName;
|
sl@0
|
472 |
if (GET_MANDATORY_STRING_PARAMETER(KSoundFormatsSupportedObject, aSection, objectName))
|
sl@0
|
473 |
{
|
sl@0
|
474 |
RMdaDevSound::TSoundFormatsSupported* soundFormat =
|
sl@0
|
475 |
static_cast<RMdaDevSound::TSoundFormatsSupported*>(GetDataObjectL(objectName));
|
sl@0
|
476 |
iCurrentFormat->iBufferSize = soundFormat->iMinBufferSize;
|
sl@0
|
477 |
iCurrentFormat->iChannels = soundFormat->iChannels;
|
sl@0
|
478 |
iCurrentFormat->iRate = soundFormat->iMinRate;
|
sl@0
|
479 |
if (soundFormat->iEncodings & RMdaDevSound::EMdaSoundEncoding8BitPCM)
|
sl@0
|
480 |
{
|
sl@0
|
481 |
iCurrentFormat->iEncoding = RMdaDevSound::EMdaSoundEncoding8BitPCM;
|
sl@0
|
482 |
}
|
sl@0
|
483 |
else if(soundFormat->iEncodings & RMdaDevSound::EMdaSoundEncoding16BitPCM)
|
sl@0
|
484 |
{
|
sl@0
|
485 |
iCurrentFormat->iEncoding = RMdaDevSound::EMdaSoundEncoding16BitPCM;
|
sl@0
|
486 |
}
|
sl@0
|
487 |
else if(soundFormat->iEncodings & RMdaDevSound::EMdaSoundEncoding8BitALaw)
|
sl@0
|
488 |
{
|
sl@0
|
489 |
iCurrentFormat->iEncoding = RMdaDevSound::EMdaSoundEncoding8BitALaw;
|
sl@0
|
490 |
}
|
sl@0
|
491 |
else if(soundFormat->iEncodings & RMdaDevSound::EMdaSoundEncoding8BitMuLaw)
|
sl@0
|
492 |
{
|
sl@0
|
493 |
iCurrentFormat->iEncoding = RMdaDevSound::EMdaSoundEncoding8BitMuLaw;
|
sl@0
|
494 |
}
|
sl@0
|
495 |
}
|
sl@0
|
496 |
}
|