|
Size: 2954
Comment: create page - 2/14 changeset 5295 (since 5138) remove Get/SetTextureScaleMode
|
Size: 1868
Comment: Updated
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| ||<tablewidth="100%" style="color: #FF0000;" :> DRAFT|| | |
| Line 25: | Line 24: |
| ||'''src_rate'''||the frequency or samples-per-second of the source|| | ||'''src_rate'''||the frequency (samples-frames-per-second) of the source|| |
| Line 28: | Line 27: |
| ||'''dst_rate'''||the frequency or samples-per-second of the destination|| <<Color2(green,Should "frequency or samples-per-second" be changed to "frequency (samples per second)" or can rate be two different types of units?)>> |
||'''dst_rate'''||the frequency (samples-frames-per-second) of the destination|| |
| Line 33: | Line 30: |
| Returns 1 if the audio filter is set up, 0 if there is no conversion needed, or a negative error code on failure; call [[SDL_GetError]]() for more information. <<Color2(purple,If audio format conversion is not supported this function returns -1.)>> |
Returns 1 if the audio filter is prepared, 0 if no conversion is needed, or a negative error code on failure; call [[SDL_GetError]]() for more information. |
| Line 39: | Line 34: |
| You can add your code example here | // Change stereo audio at 48000Hz from Float32 to Int16. SDL_AudioCVT cvt; SDL_BuildAudioCVT(&cvt, AUDIO_F32, 2, 48000, AUDIO_S16, 2, 48000); |
| Line 47: | Line 44: |
| *<<BR>>Currently only rate conversions of 2^x^ and (1/2)^x^ with x > 0 are done, ,,nearing,, ^whichever most closely approximates^ the requested rate conversion.<<BR>>* <<Color2(green,Is there a 'you can call' function to "automatically" get more information in this case like there was for [[SDL_SetTextureColorMod]] [[SDL_SetTextureBlendMode]] [[SDL_SetTextureAlphaMod]] etc? I thought it would be [[SDL_ConvertAudio]]() but that seems to ''use'' the struct not set it up. If this is the only other RF then does the programmer need to determine whether conversion is possible and manually set that as a fixed data value when the struct is first set up?)>> ^You can call [[some function]]() to fill in an [[SDL_AudioCVT]] structure with the remaining information about the current audio converter. This structure will have the `needed` member/mask set to 1 if conversion is possible.^ |
SDL_BuildAudioCVT
Use this function to initialize an SDL_AudioCVT structure for conversion.
Contents
Syntax
int SDL_BuildAudioCVT(SDL_AudioCVT* cvt,
SDL_AudioFormat src_format,
Uint8 src_channels,
int src_rate,
SDL_AudioFormat dst_format,
Uint8 dst_channels,
int dst_rate)
Function Parameters
cvt |
an SDL_AudioCVT structure filled in with audio conversion information |
src_format |
the source format of the audio data; for more info see SDL_AudioFormat |
src_channels |
the number of channels in the source |
src_rate |
the frequency (samples-frames-per-second) of the source |
dst_format |
the destination format of the audio data; for more info see SDL_AudioFormat |
dst_channels |
the number of channels in the destination |
dst_rate |
the frequency (samples-frames-per-second) of the destination |
Return Value
Returns 1 if the audio filter is prepared, 0 if no conversion is needed, or a negative error code on failure; call SDL_GetError() for more information.
Code Examples
// Change stereo audio at 48000Hz from Float32 to Int16.
SDL_AudioCVT cvt;
SDL_BuildAudioCVT(&cvt, AUDIO_F32, 2, 48000, AUDIO_S16, 2, 48000);
Remarks
Before an SDL_AudioCVT structure can be used to convert audio data it must be initialized with source and destination information.
For information on audio formats see SDL_AudioSpec.
