Penguin

SDL_!ConvertAudio?

SDL_!ConvertAudio?

NAME SYNOPSIS DESCRIPTION EXAMPLES SEE ALSO


NAME

SDL_!ConvertAudio?- Convert audio data to a desired audio format.

SYNOPSIS

#include

int SDL_!ConvertAudio?(__SDL_AudioCVT

  • cvt__);

DESCRIPTION

SDL_!ConvertAudio? takes one parameter, cvt, which was previously initilized. Initilizing a SDL_AudioCVT is a two step process. First of all, the structure must be passed to SDL_BuildAudioCVT along with source and destination format parameters. Secondly, the cvt-buf and cvt-len fields must be setup. cvt-buf should point to the audio data and cvt-len should be set to the length of the audio data in bytes. Remember, the length of the buffer pointed to by buf show be len*len_mult bytes in length.

Once the SDL_AudioCVTstructure is initilized then we can pass it to SDL_!ConvertAudio?, which will convert the audio data pointer to by cvt-buf. If SDL_!ConvertAudio? returned 0 then the conversion was completed successfully, otherwise -1 is returned.

If the conversion completed successfully then the converted audio data can be read from cvt-buf. The amount of valid, converted, audio data in the buffer is equal to cvt-len*cvt-len_ratio.

EXAMPLES

/* Converting some WAV data to hardware format / void my_audio_callback(void userdata, Uint8 *stream, int len); SDL_!AudioSpec? *desired, *obtained; SDL_!AudioSpec? wav_spec; SDL_AudioCVT wav_cvt; Uint32 wav_len; Uint8 *wav_buf; int ret; / Allocated audio specs */ desired=(SDL_!AudioSpec? *)malloc(sizeof(SDL_!AudioSpec?)); obtained=(SDL_!AudioSpec? *)malloc(sizeof(SDL_!AudioSpec?)); / Set desired format */ desired-

SEE ALSO

SDL_BuildAudioCVT, SDL_AudioCVT


This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.