Penguin
Blame: SDL_ConvertAudio(3)
EditPageHistoryDiffInfoLikePages
Annotated edit history of SDL_ConvertAudio(3) version 2, including all changes. View license author blame.
Rev Author # Line
2 perry 1 SDL_!ConvertAudio
2 !!!SDL_!ConvertAudio
1 perry 3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 EXAMPLES
7 SEE ALSO
8 ----
9 !!NAME
10
11
2 perry 12 SDL_!ConvertAudio- Convert audio data to a desired audio format.
1 perry 13 !!SYNOPSIS
14
15
16 __#include __
17
18
2 perry 19 __int SDL_!ConvertAudio__(__SDL_AudioCVT
1 perry 20 *cvt__);
21 !!DESCRIPTION
22
23
2 perry 24 __SDL_!ConvertAudio__ takes one parameter, __cvt__,
1 perry 25 which was previously initilized. Initilizing a
26 __SDL_AudioCVT__ is a two step process. First of all, the
27 structure must be passed to __SDL_BuildAudioCVT__ along
28 with source and destination format parameters. Secondly, the
29 __cvt__-__buf__ and __cvt__-__len__
30 fields must be setup. __cvt__-__buf__ should point
31 to the audio data and __cvt__-__len__ should be
32 set to the length of the audio data in bytes. Remember, the
33 length of the buffer pointed to by __buf__ show be
34 __len__*__len_mult__ bytes in length.
35
36
37 Once the __SDL_AudioCVT__structure is initilized then we
2 perry 38 can pass it to __SDL_!ConvertAudio__, which will convert
1 perry 39 the audio data pointer to by __cvt__-__buf__. If
2 perry 40 __SDL_!ConvertAudio__ returned __0__ then the
1 perry 41 conversion was completed successfully, otherwise __-1__
42 is returned.
43
44
45 If the conversion completed successfully then the converted
46 audio data can be read from __cvt__-__buf__. The
47 amount of valid, converted, audio data in the buffer is
48 equal to
49 __cvt__-__len__*__cvt__-__len_ratio__.
50 !!EXAMPLES
51
52
53 /* Converting some WAV data to hardware format */
54 void my_audio_callback(void *userdata, Uint8 *stream, int len);
2 perry 55 SDL_!AudioSpec *desired, *obtained;
56 SDL_!AudioSpec wav_spec;
1 perry 57 SDL_AudioCVT wav_cvt;
58 Uint32 wav_len;
59 Uint8 *wav_buf;
60 int ret;
61 /* Allocated audio specs */
2 perry 62 desired=(SDL_!AudioSpec *)malloc(sizeof(SDL_!AudioSpec));
63 obtained=(SDL_!AudioSpec *)malloc(sizeof(SDL_!AudioSpec));
1 perry 64 /* Set desired format */
65 desired-
66 !!SEE ALSO
67
68
69 __SDL_BuildAudioCVT__, __SDL_AudioCVT__
70 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.