|
Size: 1114
Comment: create page, add content
|
Size: 3193
Comment: correct typo
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| ||<tablewidth="100%" style="color: #FF0000;" :> DRAFT|| | |
| Line 5: | Line 6: |
| A structure that contains a set of audio conversion filters and buffers. | A structure that ^contains^ ,,is used for,, audio data conversion ^information^. |
| Line 14: | Line 15: |
| ||Uint8||'''^*^buf'''||^a pointer to a^ buffer to hold entire audio data|| ||int||'''len'''||length of original audio buffer|| |
||Uint8*||'''buf'''||a pointer to a buffer to hold entire audio data; see [[#buf|Remarks]] for details|| ||int||'''len'''||length of original audio buffer; see [[#len|Remarks]] for details|| |
| Line 17: | Line 18: |
| ||int||'''len_mult'''||buffer must be len*len_mult big|| ||double||'''len_ratio'''||given len, final size is len*len_ratio|| ||[[SDL_AudioFilter]]||'''filters[10]'''||filter list|| ||int||'''filter_index'''||current audio conversion function|| |
||int||'''len_mult'''||'''buf''' must be len*len_mult big; see [[#len_mult|Remarks]] for details|| ||double||'''len_ratio'''||given '''len''', final size is len*len_ratio; see [[#len_ratio|Remarks]] for details|| ||<style="color: #808080;">SDL_Audio``Filter[10]||<style="color: #808080;">'''filters'''||<style="color: #808080;">filter list (internal use)|| ||<style="color: #808080;">int||<style="color: #808080;">'''filter_index'''||<style="color: #808080;">current audio conversion function (internal use)|| |
| Line 28: | Line 29: |
| ''You can add useful comments here'' | *<<BR>>The [[SDL_AudioCVT]] is used to convert audio data between different formats. An [[SDL_AudioCVT]] structure is created with the [[SDL_BuildAudioCVT]]() function, while the actual conversion is done by the [[SDL_ConvertAudio]]() function. Many of the fields in the [[SDL_AudioCVT]] structure should be considered private and their function will not be discussed here. <<Anchor(buf)>>'''buf''' 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 '''buf''' is large enough. See '''len_mult''' below for more info. <<Anchor(len)>>'''len''' is the length of the original audio data in bytes. <<Anchor(len_mult)>>'''len_mult''' ^is the length multiplier for determining the size of the converted data.^ 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 ^size^ ,,length,, of '''buf''' should be '''len'''*'''len_mult'''. <<Anchor(len_ratio)>>'''len_ratio''' ^is the length ratio of the converted data to the original data.^ When you have finished converting your audio data, you need to know how much of your audio buffer is valid. '''len'''*'''len_ratio''' is the size of the converted audio data in bytes. This is very similar to '''len_mult''', however when the convert^ed^ audio data is shorter than the original, '''len_mult''' would be 1. '''len_ratio''', on the other hand, would be a fractional number between 0 and 1. <<BR>>* |
DRAFT |
SDL_AudioCVT
A structure that contains is used for audio data conversion information.
Data Fields
int |
needed |
set to 1 if conversion possible |
src_format |
source audio format |
|
dst_format |
target audio format |
|
double |
rate_incr |
rate conversion increment |
Uint8* |
buf |
a pointer to a buffer to hold entire audio data; see Remarks for details |
int |
len |
length of original audio buffer; see Remarks for details |
int |
len_cvt |
length of converted audio buffer |
int |
len_mult |
buf must be len*len_mult big; see Remarks for details |
double |
len_ratio |
given len, final size is len*len_ratio; see Remarks for details |
SDL_AudioFilter[10] |
filters |
filter list (internal use) |
int |
filter_index |
current audio conversion function (internal use) |
Code Examples
You can add your code example here
Remarks
*
The SDL_AudioCVT is used to convert audio data between different formats. An SDL_AudioCVT structure is created with the SDL_BuildAudioCVT() function, while the actual conversion is done by the SDL_ConvertAudio() function.
Many of the fields in the SDL_AudioCVT structure should be considered private and their function will not be discussed here.
buf 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 buf is large enough. See len_mult below for more info.
len is the length of the original audio data in bytes.
len_mult is the length multiplier for determining the size of the converted data. 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 size length of buf should be len*len_mult.
len_ratio is the length ratio of the converted data to the original data. When you have finished converting your audio data, you need to know how much of your audio buffer is valid. len*len_ratio is the size of the converted audio data in bytes. This is very similar to len_mult, however when the converted audio data is shorter than the original, len_mult would be 1. len_ratio, on the other hand, would be a fractional number between 0 and 1.
*
