sl@0
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\multimedia\t_soundutils.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
/**
|
sl@0
|
19 |
@file Utilities used by the shared chunk sound driver test code.
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
#include <e32test.h>
|
sl@0
|
23 |
#include <e32math.h>
|
sl@0
|
24 |
#include "t_soundutils.h"
|
sl@0
|
25 |
|
sl@0
|
26 |
const TInt SineAddressBits = 10;
|
sl@0
|
27 |
const TInt SineAddressFractionBits = 32-SineAddressBits;
|
sl@0
|
28 |
const TInt SineTableSize = 1<<SineAddressBits;
|
sl@0
|
29 |
|
sl@0
|
30 |
TUint32 ToneIndex = 0;
|
sl@0
|
31 |
TUint32 ToneIndexStep = 0;
|
sl@0
|
32 |
|
sl@0
|
33 |
TInt32* SineTable = NULL;
|
sl@0
|
34 |
|
sl@0
|
35 |
_LIT(KSndDirCapsTitle, "Direction :");
|
sl@0
|
36 |
_LIT(KSndDirRecord, " Record");
|
sl@0
|
37 |
_LIT(KSndDirPlay, " Playback");
|
sl@0
|
38 |
|
sl@0
|
39 |
_LIT(KSndRateCapsTitle,"Sample rates :");
|
sl@0
|
40 |
_LIT(KSndRateConfigTitle,"Current rate :");
|
sl@0
|
41 |
_LIT(KSndRate7350Hz," 7.35KHz");
|
sl@0
|
42 |
_LIT(KSndRate8000Hz," 8KHz");
|
sl@0
|
43 |
_LIT(KSndRate8820Hz," 8.82KHz");
|
sl@0
|
44 |
_LIT(KSndRate9600Hz," 9.6KHz");
|
sl@0
|
45 |
_LIT(KSndRate11025Hz," 11.025KHz");
|
sl@0
|
46 |
_LIT(KSndRate12000Hz," 12KHz");
|
sl@0
|
47 |
_LIT(KSndRate14700Hz," 14.7KHz");
|
sl@0
|
48 |
_LIT(KSndRate16000Hz," 16KHz");
|
sl@0
|
49 |
_LIT(KSndRate22050Hz," 22.05KHz");
|
sl@0
|
50 |
_LIT(KSndRate24000Hz," 24KHz");
|
sl@0
|
51 |
_LIT(KSndRate29400Hz," 29.4KHz");
|
sl@0
|
52 |
_LIT(KSndRate32000Hz," 32KHz");
|
sl@0
|
53 |
_LIT(KSndRate44100Hz," 44.1KHz");
|
sl@0
|
54 |
_LIT(KSndRate48000Hz," 48KHz");
|
sl@0
|
55 |
|
sl@0
|
56 |
_LIT(KSndChanConfigCapsTitle,"Chan configs :");
|
sl@0
|
57 |
_LIT(KSndChanConfigMono," Mono");
|
sl@0
|
58 |
_LIT(KSndChanConfigStereo," Stereo");
|
sl@0
|
59 |
_LIT(KSndChanConfig3Chan," 3Chan");
|
sl@0
|
60 |
_LIT(KSndChanConfig4Chan," 4Chan");
|
sl@0
|
61 |
_LIT(KSndChanConfig5Chan," 5Chan");
|
sl@0
|
62 |
_LIT(KSndChanConfig6Chan," 6Chan");
|
sl@0
|
63 |
|
sl@0
|
64 |
_LIT(KSndEncodingCapsTitle,"Encodings :");
|
sl@0
|
65 |
_LIT(KSndEncodingConfigTitle,"Encoding :");
|
sl@0
|
66 |
_LIT(KSndEncoding8BitPCM," 8bit PCM");
|
sl@0
|
67 |
_LIT(KSndEncoding16BitPCM," 16bit PCM");
|
sl@0
|
68 |
_LIT(KSndEncoding24BitPCM," 24bit PCM");
|
sl@0
|
69 |
|
sl@0
|
70 |
_LIT(KSndDataFormatCapsTitle,"Data formats :");
|
sl@0
|
71 |
_LIT(KSndDataFormatConfigTitle,"Data format :");
|
sl@0
|
72 |
_LIT(KSndDataFormatInterleaved," Interleaved");
|
sl@0
|
73 |
_LIT(KSndDataFormatNonInterleaved," Non-interleaved");
|
sl@0
|
74 |
|
sl@0
|
75 |
|
sl@0
|
76 |
GLDEF_C TInt BytesPerSample(TCurrentSoundFormatV02& aFormat)
|
sl@0
|
77 |
{
|
sl@0
|
78 |
TInt bytes = aFormat.iChannels;
|
sl@0
|
79 |
switch(aFormat.iEncoding)
|
sl@0
|
80 |
{
|
sl@0
|
81 |
case ESoundEncoding24BitPCM:
|
sl@0
|
82 |
bytes *= 3;
|
sl@0
|
83 |
break;
|
sl@0
|
84 |
case ESoundEncoding16BitPCM:
|
sl@0
|
85 |
bytes *= 2;
|
sl@0
|
86 |
break;
|
sl@0
|
87 |
case ESoundEncoding8BitPCM:
|
sl@0
|
88 |
break;
|
sl@0
|
89 |
default:
|
sl@0
|
90 |
bytes=0;
|
sl@0
|
91 |
break;
|
sl@0
|
92 |
}
|
sl@0
|
93 |
return(bytes);
|
sl@0
|
94 |
}
|
sl@0
|
95 |
|
sl@0
|
96 |
GLDEF_C TInt RateInSamplesPerSecond(TSoundRate aRate)
|
sl@0
|
97 |
{
|
sl@0
|
98 |
switch(aRate)
|
sl@0
|
99 |
{
|
sl@0
|
100 |
case ESoundRate7350Hz: return(7350);
|
sl@0
|
101 |
case ESoundRate8000Hz: return(8000);
|
sl@0
|
102 |
case ESoundRate8820Hz: return(8820);
|
sl@0
|
103 |
case ESoundRate9600Hz: return(9600);
|
sl@0
|
104 |
case ESoundRate11025Hz: return(11025);
|
sl@0
|
105 |
case ESoundRate12000Hz: return(12000);
|
sl@0
|
106 |
case ESoundRate14700Hz: return(14700);
|
sl@0
|
107 |
case ESoundRate16000Hz: return(16000);
|
sl@0
|
108 |
case ESoundRate22050Hz: return(22050);
|
sl@0
|
109 |
case ESoundRate24000Hz: return(24000);
|
sl@0
|
110 |
case ESoundRate29400Hz: return(29400);
|
sl@0
|
111 |
case ESoundRate32000Hz: return(32000);
|
sl@0
|
112 |
case ESoundRate44100Hz: return(44100);
|
sl@0
|
113 |
case ESoundRate48000Hz: return(48000);
|
sl@0
|
114 |
default: return(0);
|
sl@0
|
115 |
};
|
sl@0
|
116 |
}
|
sl@0
|
117 |
|
sl@0
|
118 |
GLDEF_C TInt BytesPerSecond(TCurrentSoundFormatV02& aFormat)
|
sl@0
|
119 |
{
|
sl@0
|
120 |
return(RateInSamplesPerSecond(aFormat.iRate) * BytesPerSample(aFormat));
|
sl@0
|
121 |
}
|
sl@0
|
122 |
|
sl@0
|
123 |
GLDEF_C TInt ValidBufferSize(TInt aSize, TInt aDeviceMinSize, TCurrentSoundFormatV02& aFormat)
|
sl@0
|
124 |
{
|
sl@0
|
125 |
// Keep the buffer length a multiple of the number of bytes per sample
|
sl@0
|
126 |
TInt bytesPerSample=BytesPerSample(aFormat);
|
sl@0
|
127 |
aSize-=(aSize%bytesPerSample);
|
sl@0
|
128 |
|
sl@0
|
129 |
// Keep the buffer length valid for driver.
|
sl@0
|
130 |
if (aDeviceMinSize)
|
sl@0
|
131 |
aSize&=~(aDeviceMinSize-1);
|
sl@0
|
132 |
return(aSize);
|
sl@0
|
133 |
}
|
sl@0
|
134 |
|
sl@0
|
135 |
GLDEF_C TInt MakeSineTable(TCurrentSoundFormatV02& aPlayFormat)
|
sl@0
|
136 |
{
|
sl@0
|
137 |
delete SineTable;
|
sl@0
|
138 |
SineTable = (TInt32*)User::Alloc(SineTableSize*sizeof(TInt32));
|
sl@0
|
139 |
if (!SineTable)
|
sl@0
|
140 |
return(KErrNoMemory);
|
sl@0
|
141 |
|
sl@0
|
142 |
TInt i;
|
sl@0
|
143 |
TReal scale;
|
sl@0
|
144 |
|
sl@0
|
145 |
switch(aPlayFormat.iEncoding)
|
sl@0
|
146 |
{
|
sl@0
|
147 |
case ESoundEncoding8BitPCM:
|
sl@0
|
148 |
scale = 127;
|
sl@0
|
149 |
break;
|
sl@0
|
150 |
case ESoundEncoding16BitPCM:
|
sl@0
|
151 |
scale = 32767;
|
sl@0
|
152 |
break;
|
sl@0
|
153 |
case ESoundEncoding24BitPCM:
|
sl@0
|
154 |
scale = 8388607;
|
sl@0
|
155 |
break;
|
sl@0
|
156 |
default:
|
sl@0
|
157 |
return(KErrNotSupported);
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
for(i=0; i<SineTableSize; i++)
|
sl@0
|
161 |
{
|
sl@0
|
162 |
TReal r = KPi*2.0*(TReal)i/(TReal)SineTableSize;
|
sl@0
|
163 |
Math::Sin(r,r);
|
sl@0
|
164 |
r *= scale;
|
sl@0
|
165 |
Math::Int(SineTable[i],r);
|
sl@0
|
166 |
}
|
sl@0
|
167 |
|
sl@0
|
168 |
return KErrNone;
|
sl@0
|
169 |
};
|
sl@0
|
170 |
|
sl@0
|
171 |
GLDEF_C TInt SetToneFrequency(TUint aFrequency,TCurrentSoundFormatV02& aPlayFormat)
|
sl@0
|
172 |
{
|
sl@0
|
173 |
TInt64 step(MAKE_TINT64(aFrequency,0));
|
sl@0
|
174 |
step /= RateInSamplesPerSecond(aPlayFormat.iRate);
|
sl@0
|
175 |
ToneIndexStep = I64LOW(step);
|
sl@0
|
176 |
return((I64HIGH(step)==0) ? KErrNone : KErrGeneral);
|
sl@0
|
177 |
}
|
sl@0
|
178 |
|
sl@0
|
179 |
GLDEF_C void WriteTone(TDes8& aBuffer,TCurrentSoundFormatV02& aPlayFormat)
|
sl@0
|
180 |
{
|
sl@0
|
181 |
aBuffer.SetMax();
|
sl@0
|
182 |
|
sl@0
|
183 |
TUint32 index = ToneIndex;
|
sl@0
|
184 |
TUint32 step = ToneIndexStep;
|
sl@0
|
185 |
TInt32* table = SineTable;
|
sl@0
|
186 |
|
sl@0
|
187 |
switch(aPlayFormat.iEncoding)
|
sl@0
|
188 |
{
|
sl@0
|
189 |
case ESoundEncoding16BitPCM:
|
sl@0
|
190 |
{
|
sl@0
|
191 |
TInt16* ptr = (TInt16*)aBuffer.Ptr();
|
sl@0
|
192 |
TInt16* end = ptr+aBuffer.Length()/2;
|
sl@0
|
193 |
while(ptr<end)
|
sl@0
|
194 |
{
|
sl@0
|
195 |
*ptr++ = (TInt16)table[index>>SineAddressFractionBits];
|
sl@0
|
196 |
if (aPlayFormat.iChannels == 2)
|
sl@0
|
197 |
*ptr++ = (TInt16)table[index>>SineAddressFractionBits];
|
sl@0
|
198 |
index += step;
|
sl@0
|
199 |
}
|
sl@0
|
200 |
}
|
sl@0
|
201 |
break;
|
sl@0
|
202 |
case ESoundEncoding8BitPCM:
|
sl@0
|
203 |
{
|
sl@0
|
204 |
TUint8* ptr = (TUint8*)aBuffer.Ptr();
|
sl@0
|
205 |
TUint8* end = ptr+aBuffer.Length();
|
sl@0
|
206 |
while(ptr<end)
|
sl@0
|
207 |
{
|
sl@0
|
208 |
*ptr++ = (TUint8)table[index>>8];
|
sl@0
|
209 |
if (aPlayFormat.iChannels == 2)
|
sl@0
|
210 |
*ptr++ = (TInt8)table[index>>8];
|
sl@0
|
211 |
index += step;
|
sl@0
|
212 |
}
|
sl@0
|
213 |
}
|
sl@0
|
214 |
break;
|
sl@0
|
215 |
case ESoundEncoding24BitPCM:
|
sl@0
|
216 |
{
|
sl@0
|
217 |
TUint8* ptr = (TUint8*)aBuffer.Ptr();
|
sl@0
|
218 |
TUint8* end = ptr+aBuffer.Length();
|
sl@0
|
219 |
while(ptr<end)
|
sl@0
|
220 |
{
|
sl@0
|
221 |
*ptr++ = (TUint8)table[index>>24];
|
sl@0
|
222 |
if (aPlayFormat.iChannels == 2)
|
sl@0
|
223 |
*ptr++ = (TInt8)table[index>>24];
|
sl@0
|
224 |
index += step;
|
sl@0
|
225 |
}
|
sl@0
|
226 |
}
|
sl@0
|
227 |
break;
|
sl@0
|
228 |
|
sl@0
|
229 |
default:
|
sl@0
|
230 |
break;
|
sl@0
|
231 |
}
|
sl@0
|
232 |
|
sl@0
|
233 |
ToneIndex = index;
|
sl@0
|
234 |
}
|
sl@0
|
235 |
|
sl@0
|
236 |
GLDEF_C void Cleanup()
|
sl@0
|
237 |
{
|
sl@0
|
238 |
delete SineTable;
|
sl@0
|
239 |
}
|
sl@0
|
240 |
|
sl@0
|
241 |
GLDEF_C void PrintCaps(TSoundFormatsSupportedV02& aCaps,RTest& aTest)
|
sl@0
|
242 |
{
|
sl@0
|
243 |
TBuf<128> buf;
|
sl@0
|
244 |
|
sl@0
|
245 |
aTest.Printf(_L("**Sound Capabilities**\r\n"));
|
sl@0
|
246 |
|
sl@0
|
247 |
// Display the data transfer direction
|
sl@0
|
248 |
buf.Zero();
|
sl@0
|
249 |
buf.Append(KSndDirCapsTitle);
|
sl@0
|
250 |
if (aCaps.iDirection==ESoundDirRecord)
|
sl@0
|
251 |
buf.Append(KSndDirRecord);
|
sl@0
|
252 |
else
|
sl@0
|
253 |
buf.Append(KSndDirPlay);
|
sl@0
|
254 |
buf.Append(_L("\r\n"));
|
sl@0
|
255 |
aTest.Printf(buf);
|
sl@0
|
256 |
|
sl@0
|
257 |
// Display the channel configuration
|
sl@0
|
258 |
buf.Zero();
|
sl@0
|
259 |
buf.Append(KSndChanConfigCapsTitle);
|
sl@0
|
260 |
if (aCaps.iChannels & KSoundMonoChannel)
|
sl@0
|
261 |
buf.Append(KSndChanConfigMono);
|
sl@0
|
262 |
if (aCaps.iChannels & KSoundStereoChannel)
|
sl@0
|
263 |
buf.Append(KSndChanConfigStereo);
|
sl@0
|
264 |
if (aCaps.iChannels & KSoundThreeChannel)
|
sl@0
|
265 |
buf.Append(KSndChanConfig3Chan);
|
sl@0
|
266 |
if (aCaps.iChannels & KSoundFourChannel)
|
sl@0
|
267 |
buf.Append(KSndChanConfig4Chan);
|
sl@0
|
268 |
if (aCaps.iChannels & KSoundFiveChannel)
|
sl@0
|
269 |
buf.Append(KSndChanConfig5Chan);
|
sl@0
|
270 |
if (aCaps.iChannels & KSoundSixChannel)
|
sl@0
|
271 |
buf.Append(KSndChanConfig6Chan);
|
sl@0
|
272 |
buf.Append(_L("\r\n"));
|
sl@0
|
273 |
aTest.Printf(buf);
|
sl@0
|
274 |
|
sl@0
|
275 |
// Display the supported sample rates
|
sl@0
|
276 |
buf.Zero();
|
sl@0
|
277 |
buf.Append(KSndRateCapsTitle);
|
sl@0
|
278 |
if (aCaps.iRates & KSoundRate7350Hz)
|
sl@0
|
279 |
buf.Append(KSndRate7350Hz);
|
sl@0
|
280 |
if (aCaps.iRates & KSoundRate8000Hz)
|
sl@0
|
281 |
buf.Append(KSndRate8000Hz);
|
sl@0
|
282 |
if (aCaps.iRates & KSoundRate8820Hz)
|
sl@0
|
283 |
buf.Append(KSndRate8820Hz);
|
sl@0
|
284 |
if (aCaps.iRates & KSoundRate9600Hz)
|
sl@0
|
285 |
buf.Append(KSndRate9600Hz);
|
sl@0
|
286 |
if (aCaps.iRates & KSoundRate11025Hz)
|
sl@0
|
287 |
buf.Append(KSndRate11025Hz);
|
sl@0
|
288 |
if (aCaps.iRates & KSoundRate12000Hz)
|
sl@0
|
289 |
buf.Append(KSndRate12000Hz);
|
sl@0
|
290 |
if (aCaps.iRates & KSoundRate14700Hz)
|
sl@0
|
291 |
buf.Append(KSndRate14700Hz);
|
sl@0
|
292 |
if (aCaps.iRates & KSoundRate16000Hz)
|
sl@0
|
293 |
buf.Append(KSndRate16000Hz);
|
sl@0
|
294 |
if (aCaps.iRates & KSoundRate22050Hz)
|
sl@0
|
295 |
buf.Append(KSndRate22050Hz);
|
sl@0
|
296 |
if (aCaps.iRates & KSoundRate24000Hz)
|
sl@0
|
297 |
buf.Append(KSndRate24000Hz);
|
sl@0
|
298 |
if (aCaps.iRates & KSoundRate29400Hz)
|
sl@0
|
299 |
buf.Append(KSndRate29400Hz);
|
sl@0
|
300 |
if (aCaps.iRates & KSoundRate32000Hz)
|
sl@0
|
301 |
buf.Append(KSndRate32000Hz);
|
sl@0
|
302 |
if (aCaps.iRates & KSoundRate44100Hz)
|
sl@0
|
303 |
buf.Append(KSndRate44100Hz);
|
sl@0
|
304 |
if (aCaps.iRates & KSoundRate48000Hz)
|
sl@0
|
305 |
buf.Append(KSndRate48000Hz);
|
sl@0
|
306 |
buf.Append(_L("\r\n"));
|
sl@0
|
307 |
aTest.Printf(buf);
|
sl@0
|
308 |
|
sl@0
|
309 |
// Display the sound encodings supported
|
sl@0
|
310 |
buf.Zero();
|
sl@0
|
311 |
buf.Append(KSndEncodingCapsTitle);
|
sl@0
|
312 |
if (aCaps.iEncodings & KSoundEncoding8BitPCM)
|
sl@0
|
313 |
buf.Append(KSndEncoding8BitPCM);
|
sl@0
|
314 |
if (aCaps.iEncodings & KSoundEncoding16BitPCM)
|
sl@0
|
315 |
buf.Append(KSndEncoding16BitPCM);
|
sl@0
|
316 |
if (aCaps.iEncodings & KSoundEncoding24BitPCM)
|
sl@0
|
317 |
buf.Append(KSndEncoding24BitPCM);
|
sl@0
|
318 |
buf.Append(_L("\r\n"));
|
sl@0
|
319 |
aTest.Printf(buf);
|
sl@0
|
320 |
|
sl@0
|
321 |
// Display the data formats supported
|
sl@0
|
322 |
buf.Zero();
|
sl@0
|
323 |
buf.Append(KSndDataFormatCapsTitle);
|
sl@0
|
324 |
if (aCaps.iDataFormats & KSoundDataFormatInterleaved)
|
sl@0
|
325 |
buf.Append(KSndDataFormatInterleaved);
|
sl@0
|
326 |
if (aCaps.iDataFormats & KSoundDataFormatNonInterleaved)
|
sl@0
|
327 |
buf.Append(KSndDataFormatNonInterleaved);
|
sl@0
|
328 |
buf.Append(_L("\r\n"));
|
sl@0
|
329 |
aTest.Printf(buf);
|
sl@0
|
330 |
|
sl@0
|
331 |
// Display the minimum request size and the request alignment factor.
|
sl@0
|
332 |
aTest.Printf(_L("Min req size : %d\r\n"),aCaps.iRequestMinSize);
|
sl@0
|
333 |
aTest.Printf(_L("Req alignment: %d\r\n"),aCaps.iRequestAlignment);
|
sl@0
|
334 |
}
|
sl@0
|
335 |
|
sl@0
|
336 |
GLDEF_C void PrintConfig(TCurrentSoundFormatV02& aConfig,RTest& aTest)
|
sl@0
|
337 |
{
|
sl@0
|
338 |
TBuf<80> buf;
|
sl@0
|
339 |
|
sl@0
|
340 |
aTest.Printf(_L("**Sound configuration**\r\n"));
|
sl@0
|
341 |
|
sl@0
|
342 |
// Display the current channel configuration
|
sl@0
|
343 |
aTest.Printf(_L("Channels : %d\r\n"),aConfig.iChannels);
|
sl@0
|
344 |
|
sl@0
|
345 |
// Display the current sample rate
|
sl@0
|
346 |
buf.Zero();
|
sl@0
|
347 |
buf.Append(KSndRateConfigTitle);
|
sl@0
|
348 |
if (aConfig.iRate==ESoundRate7350Hz)
|
sl@0
|
349 |
buf.Append(KSndRate7350Hz);
|
sl@0
|
350 |
else if (aConfig.iRate==ESoundRate8000Hz)
|
sl@0
|
351 |
buf.Append(KSndRate8000Hz);
|
sl@0
|
352 |
else if (aConfig.iRate==ESoundRate8820Hz)
|
sl@0
|
353 |
buf.Append(KSndRate8820Hz);
|
sl@0
|
354 |
else if (aConfig.iRate==ESoundRate9600Hz)
|
sl@0
|
355 |
buf.Append(KSndRate9600Hz);
|
sl@0
|
356 |
else if (aConfig.iRate==ESoundRate11025Hz)
|
sl@0
|
357 |
buf.Append(KSndRate11025Hz);
|
sl@0
|
358 |
else if (aConfig.iRate==ESoundRate12000Hz)
|
sl@0
|
359 |
buf.Append(KSndRate12000Hz);
|
sl@0
|
360 |
else if (aConfig.iRate==ESoundRate14700Hz)
|
sl@0
|
361 |
buf.Append(KSndRate14700Hz);
|
sl@0
|
362 |
else if (aConfig.iRate==ESoundRate16000Hz)
|
sl@0
|
363 |
buf.Append(KSndRate16000Hz);
|
sl@0
|
364 |
else if (aConfig.iRate==ESoundRate22050Hz)
|
sl@0
|
365 |
buf.Append(KSndRate22050Hz);
|
sl@0
|
366 |
else if (aConfig.iRate==ESoundRate24000Hz)
|
sl@0
|
367 |
buf.Append(KSndRate24000Hz);
|
sl@0
|
368 |
else if (aConfig.iRate==ESoundRate29400Hz)
|
sl@0
|
369 |
buf.Append(KSndRate29400Hz);
|
sl@0
|
370 |
else if (aConfig.iRate==ESoundRate32000Hz)
|
sl@0
|
371 |
buf.Append(KSndRate32000Hz);
|
sl@0
|
372 |
else if (aConfig.iRate==ESoundRate44100Hz)
|
sl@0
|
373 |
buf.Append(KSndRate44100Hz);
|
sl@0
|
374 |
else if (aConfig.iRate==ESoundRate48000Hz)
|
sl@0
|
375 |
buf.Append(KSndRate48000Hz);
|
sl@0
|
376 |
buf.Append(_L("\r\n"));
|
sl@0
|
377 |
aTest.Printf(buf);
|
sl@0
|
378 |
|
sl@0
|
379 |
// Display the current encoding
|
sl@0
|
380 |
buf.Zero();
|
sl@0
|
381 |
buf.Append(KSndEncodingConfigTitle);
|
sl@0
|
382 |
if (aConfig.iEncoding==ESoundEncoding8BitPCM)
|
sl@0
|
383 |
buf.Append(KSndEncoding8BitPCM);
|
sl@0
|
384 |
else if (aConfig.iEncoding==ESoundEncoding16BitPCM)
|
sl@0
|
385 |
buf.Append(KSndEncoding16BitPCM);
|
sl@0
|
386 |
else if (aConfig.iEncoding==ESoundEncoding24BitPCM)
|
sl@0
|
387 |
buf.Append(KSndEncoding24BitPCM);
|
sl@0
|
388 |
buf.Append(_L("\r\n"));
|
sl@0
|
389 |
aTest.Printf(buf);
|
sl@0
|
390 |
|
sl@0
|
391 |
// Display the current data format
|
sl@0
|
392 |
buf.Zero();
|
sl@0
|
393 |
buf.Append(KSndDataFormatConfigTitle);
|
sl@0
|
394 |
if (aConfig.iDataFormat==ESoundDataFormatInterleaved)
|
sl@0
|
395 |
buf.Append(KSndDataFormatInterleaved);
|
sl@0
|
396 |
else if (aConfig.iDataFormat==ESoundDataFormatNonInterleaved)
|
sl@0
|
397 |
buf.Append(KSndDataFormatNonInterleaved);
|
sl@0
|
398 |
buf.Append(_L("\r\n"));
|
sl@0
|
399 |
aTest.Printf(buf);
|
sl@0
|
400 |
}
|
sl@0
|
401 |
|
sl@0
|
402 |
GLDEF_C void PrintBufferConf(TTestSharedChunkBufConfig& aBufConf,RTest& aTest)
|
sl@0
|
403 |
{
|
sl@0
|
404 |
TBuf<80> buf(0);
|
sl@0
|
405 |
|
sl@0
|
406 |
aTest.Printf(_L("**Buffer configuration**\r\n"));
|
sl@0
|
407 |
|
sl@0
|
408 |
// Display the buffer configuration
|
sl@0
|
409 |
buf.Format(_L("NumBufs:%d Size:%xH(%d)\r\n"),aBufConf.iNumBuffers,aBufConf.iBufferSizeInBytes,aBufConf.iBufferSizeInBytes);
|
sl@0
|
410 |
aTest.Printf(buf);
|
sl@0
|
411 |
if (aBufConf.iFlags & KScFlagBufOffsetListInUse)
|
sl@0
|
412 |
{
|
sl@0
|
413 |
buf.Format(_L(" Offsets[%08xH,%08xH,%08xH,%08xH]\r\n"),aBufConf.iBufferOffsetList[0],aBufConf.iBufferOffsetList[1],aBufConf.iBufferOffsetList[2],aBufConf.iBufferOffsetList[3]);
|
sl@0
|
414 |
aTest.Printf(buf);
|
sl@0
|
415 |
buf.Format(_L(" Offsets[%08xH,%08xH,%08xH,%08xH]\r\n"),aBufConf.iBufferOffsetList[4],aBufConf.iBufferOffsetList[5],aBufConf.iBufferOffsetList[6],aBufConf.iBufferOffsetList[7]);
|
sl@0
|
416 |
aTest.Printf(buf);
|
sl@0
|
417 |
}
|
sl@0
|
418 |
}
|