Wiki Page Content

Revision 27 as of 2013-08-08 01:06:49

Clear message

SDL_BuildAudioCVT

Use this function to initialize an SDL_AudioCVT structure for conversion.

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.


CategoryAPI, CategoryAudio

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit