Penguin
Note: You are viewing an old revision of this page. View the current version.

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.