Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5131 clevermous 1
2
>
3
>
4
>SDL_AudioCVT
5
>
6
NAME="GENERATOR"
7
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
8
">
9
REL="HOME"
10
TITLE="SDL Library Documentation"
11
HREF="index.html">
12
REL="UP"
13
TITLE="Audio"
14
HREF="audio.html">
15
REL="PREVIOUS"
16
TITLE="SDL_FreeWAV"
17
HREF="sdlfreewav.html">
18
REL="NEXT"
19
TITLE="SDL_BuildAudioCVT"
20
HREF="sdlbuildaudiocvt.html">
21
>
22
CLASS="REFENTRY"
23
BGCOLOR="#FFF8DC"
24
TEXT="#000000"
25
LINK="#0000ee"
26
VLINK="#551a8b"
27
ALINK="#ff0000"
28
>
29
CLASS="NAVHEADER"
30
>
31
WIDTH="100%"
32
BORDER="0"
33
CELLPADDING="0"
34
CELLSPACING="0"
35
>
36
>
37
COLSPAN="3"
38
ALIGN="center"
39
>SDL Library Documentation
40
>
41
>
42
>
43
WIDTH="10%"
44
ALIGN="left"
45
VALIGN="bottom"
46
>
47
HREF="sdlfreewav.html"
48
>Prev
49
>
50
>
51
WIDTH="80%"
52
ALIGN="center"
53
VALIGN="bottom"
54
>
55
>
56
WIDTH="10%"
57
ALIGN="right"
58
VALIGN="bottom"
59
>
60
HREF="sdlbuildaudiocvt.html"
61
>Next
62
>
63
>
64
>
65
>
66
ALIGN="LEFT"
67
WIDTH="100%">
68
>
69
>
70
NAME="SDLAUDIOCVT"
71
>SDL_AudioCVT
72
>
73
>
74
CLASS="REFNAMEDIV"
75
>
76
NAME="AEN6337"
77
>
78
>
79
>Name
80
>SDL_AudioCVT -- Audio Conversion Structure
81
>
82
CLASS="REFSECT1"
83
>
84
NAME="AEN6340"
85
>
86
>
87
>Structure Definition
88
>
89
CLASS="PROGRAMLISTING"
90
>typedef struct{
91
  int needed;
92
  Uint16 src_format;
93
  Uint16 dest_format;
94
  double rate_incr;
95
  Uint8 *buf;
96
  int len;
97
  int len_cvt;
98
  int len_mult;
99
  double len_ratio;
100
  void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
101
  int filter_index;
102
} SDL_AudioCVT;
103
>
104
>
105
CLASS="REFSECT1"
106
>
107
NAME="AEN6343"
108
>
109
>
110
>Structure Data
111
>
112
CLASS="INFORMALTABLE"
113
>
114
NAME="AEN6345"
115
>
116
>
117
>
118
>
119
BORDER="0"
120
CLASS="CALSTABLE"
121
>
122
>
123
>
124
ALIGN="LEFT"
125
VALIGN="TOP"
126
>
127
CLASS="STRUCTFIELD"
128
>
129
>needed
130
>
131
>
132
>
133
ALIGN="LEFT"
134
VALIGN="TOP"
135
>Set to one if the conversion is possible
136
>
137
>
138
>
139
ALIGN="LEFT"
140
VALIGN="TOP"
141
>
142
CLASS="STRUCTFIELD"
143
>
144
>src_format
145
>
146
>
147
>
148
ALIGN="LEFT"
149
VALIGN="TOP"
150
>Audio format of the source
151
>
152
>
153
>
154
ALIGN="LEFT"
155
VALIGN="TOP"
156
>
157
CLASS="STRUCTFIELD"
158
>
159
>dest_format
160
>
161
>
162
>
163
ALIGN="LEFT"
164
VALIGN="TOP"
165
>Audio format of the destination
166
>
167
>
168
>
169
ALIGN="LEFT"
170
VALIGN="TOP"
171
>
172
CLASS="STRUCTFIELD"
173
>
174
>rate_incr
175
>
176
>
177
>
178
ALIGN="LEFT"
179
VALIGN="TOP"
180
>Rate conversion increment
181
>
182
>
183
>
184
ALIGN="LEFT"
185
VALIGN="TOP"
186
>
187
CLASS="STRUCTFIELD"
188
>
189
>buf
190
>
191
>
192
>
193
ALIGN="LEFT"
194
VALIGN="TOP"
195
>Audio buffer
196
>
197
>
198
>
199
ALIGN="LEFT"
200
VALIGN="TOP"
201
>
202
CLASS="STRUCTFIELD"
203
>
204
>len
205
>
206
>
207
>
208
ALIGN="LEFT"
209
VALIGN="TOP"
210
>Length of the original audio buffer in bytes
211
>
212
>
213
>
214
ALIGN="LEFT"
215
VALIGN="TOP"
216
>
217
CLASS="STRUCTFIELD"
218
>
219
>len_cvt
220
>
221
>
222
>
223
ALIGN="LEFT"
224
VALIGN="TOP"
225
>Length of converted audio buffer in bytes (calculated)
226
>
227
>
228
>
229
ALIGN="LEFT"
230
VALIGN="TOP"
231
>
232
CLASS="STRUCTFIELD"
233
>
234
>len_mult
235
>
236
>
237
>
238
ALIGN="LEFT"
239
VALIGN="TOP"
240
>
241
CLASS="STRUCTFIELD"
242
>
243
>buf
244
>
245
> must be 
246
CLASS="STRUCTFIELD"
247
>
248
>len
249
>
250
>*
251
CLASS="STRUCTFIELD"
252
>
253
>len_mult
254
>
255
> bytes in size(calculated)
256
>
257
>
258
>
259
ALIGN="LEFT"
260
VALIGN="TOP"
261
>
262
CLASS="STRUCTFIELD"
263
>
264
>len_ratio
265
>
266
>
267
>
268
ALIGN="LEFT"
269
VALIGN="TOP"
270
>Final audio size is 
271
CLASS="STRUCTFIELD"
272
>
273
>len
274
>
275
>*
276
CLASS="STRUCTFIELD"
277
>
278
>len_ratio
279
>
280
>
281
>
282
>
283
>
284
ALIGN="LEFT"
285
VALIGN="TOP"
286
>
287
CLASS="STRUCTFIELD"
288
>
289
>filters[10](..)
290
>
291
>
292
>
293
ALIGN="LEFT"
294
VALIGN="TOP"
295
>Pointers to functions needed for this conversion
296
>
297
>
298
>
299
ALIGN="LEFT"
300
VALIGN="TOP"
301
>
302
CLASS="STRUCTFIELD"
303
>
304
>filter_index
305
>
306
>
307
>
308
ALIGN="LEFT"
309
VALIGN="TOP"
310
>Current conversion function
311
>
312
>
313
>
314
>
315
>
316
>
317
>
318
>
319
CLASS="REFSECT1"
320
>
321
NAME="AEN6397"
322
>
323
>
324
>Description
325
>
326
>The 
327
CLASS="STRUCTNAME"
328
>SDL_AudioCVT
329
> is used to convert audio data between different formats. A 
330
CLASS="STRUCTNAME"
331
>SDL_AudioCVT
332
> structure is created with the 
333
HREF="sdlbuildaudiocvt.html"
334
>
335
CLASS="FUNCTION"
336
>SDL_BuildAudioCVT
337
>
338
> function, while the actual conversion is done by the 
339
HREF="sdlconvertaudio.html"
340
>
341
CLASS="FUNCTION"
342
>SDL_ConvertAudio
343
>
344
> function.
345
>
346
>Many of the fields in the 
347
CLASS="STRUCTNAME"
348
>SDL_AudioCVT
349
> structure should be considered private and their function will not be discussed here.
350
>
351
>
352
>
353
CLASS="VARIABLELIST"
354
>
355
>
356
>
357
CLASS="TYPE"
358
>Uint8 *
359
>
360
CLASS="STRUCTFIELD"
361
>
362
>buf
363
>
364
>
365
>
366
>
367
>This points to the audio data that will be used in the conversion. It is both the source and the destination, which means the converted audio data overwrites the original data. It also means that the converted data may be larger than the original data (if you were converting from 8-bit to 16-bit, for instance), so you must ensure 
368
CLASS="STRUCTFIELD"
369
>
370
>buf
371
>
372
> is large enough. See below.
373
>
374
>
375
>
376
CLASS="TYPE"
377
>int
378
> 
379
CLASS="STRUCTFIELD"
380
>
381
>len
382
>
383
>
384
>
385
>
386
>This is the length of the original audio data in bytes.
387
>
388
>
389
>
390
CLASS="TYPE"
391
>int
392
> 
393
CLASS="STRUCTFIELD"
394
>
395
>len_mult
396
>
397
>
398
>
399
>
400
>As explained above, the audio buffer needs to be big enough to store the converted data, which may be bigger than the original audio data. The length of 
401
CLASS="STRUCTFIELD"
402
>
403
>buf
404
>
405
> should be 
406
CLASS="STRUCTFIELD"
407
>
408
>len
409
>
410
>*
411
CLASS="STRUCTFIELD"
412
>
413
>len_mult
414
>
415
>.
416
>
417
>
418
>
419
CLASS="TYPE"
420
>double
421
> 
422
CLASS="STRUCTFIELD"
423
>
424
>len_ratio
425
>
426
>
427
>
428
>
429
>When you have finished converting your audio data, you need to know how much of your audio buffer is valid. 
430
CLASS="STRUCTFIELD"
431
>
432
>len
433
>
434
>*
435
CLASS="STRUCTFIELD"
436
>
437
>len_ratio
438
>
439
> is the size of the converted audio data in bytes. This is very similar to 
440
CLASS="STRUCTFIELD"
441
>
442
>len_mult
443
>
444
>, however when the convert audio data is shorter than the original 
445
CLASS="STRUCTFIELD"
446
>
447
>len_mult
448
>
449
> would be 1. 
450
CLASS="STRUCTFIELD"
451
>
452
>len_ratio
453
>
454
>, on the other hand, would be a fractional number between 0 and 1.
455
>
456
>
457
>
458
>
459
>
460
CLASS="REFSECT1"
461
>
462
NAME="AEN6442"
463
>
464
>
465
>See Also
466
>
467
>
468
HREF="sdlbuildaudiocvt.html"
469
>
470
CLASS="FUNCTION"
471
>SDL_BuildAudioCVT
472
>
473
>,
474
475
HREF="sdlconvertaudio.html"
476
>
477
CLASS="FUNCTION"
478
>SDL_ConvertAudio
479
>
480
>,
481
482
HREF="sdlaudiospec.html"
483
>
484
CLASS="STRUCTNAME"
485
>SDL_AudioSpec
486
>
487
>
488
>
489
>
490
CLASS="NAVFOOTER"
491
>
492
ALIGN="LEFT"
493
WIDTH="100%">
494
WIDTH="100%"
495
BORDER="0"
496
CELLPADDING="0"
497
CELLSPACING="0"
498
>
499
>
500
WIDTH="33%"
501
ALIGN="left"
502
VALIGN="top"
503
>
504
HREF="sdlfreewav.html"
505
>Prev
506
>
507
>
508
WIDTH="34%"
509
ALIGN="center"
510
VALIGN="top"
511
>
512
HREF="index.html"
513
>Home
514
>
515
>
516
WIDTH="33%"
517
ALIGN="right"
518
VALIGN="top"
519
>
520
HREF="sdlbuildaudiocvt.html"
521
>Next
522
>
523
>
524
>
525
>
526
WIDTH="33%"
527
ALIGN="left"
528
VALIGN="top"
529
>SDL_FreeWAV
530
>
531
WIDTH="34%"
532
ALIGN="center"
533
VALIGN="top"
534
>
535
HREF="audio.html"
536
>Up
537
>
538
>
539
WIDTH="33%"
540
ALIGN="right"
541
VALIGN="top"
542
>SDL_BuildAudioCVT
543
>
544
>
545
>
546
>
547
>
548
>