0

The tutorials showed this way,

SDL_AudioSpec   wanted_spec, spec;
wanted_spec.freq = aCodecCtx->sample_rate;
wanted_spec.format = AUDIO_S16SYS;
wanted_spec.channels = aCodecCtx->channels;
wanted_spec.silence = 0;
wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;
wanted_spec.callback = audio_callback;
wanted_spec.userdata = aCodecCtx;
SDL_OpenAudio(&wanted_spec, &spec);

It doesn't work, apparently the samples are floating points and sdl audio spec format is 16 bit samples. How to make SDL work with floating point samples?

1

Most people typically use libswresample (part of FFmpeg) to convert from fltp to s16.

1
  • Thank you, bro. libswresample does the job. – imdadable Sep 15 '15 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.