There is an old code that uses SDL audio to output music. I am porting it to Qt and I want to replace SDL audio with native Qt audio API.
The flow, in simplest terms, is this:
...
// Initialization
wanted_spec.callback = sdl_audio_callback;
SDL_OpenAudio(&wanted_spec, &spec);
...
// copies raw data to audio buffer
static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
Which audio Api of Qt should I be using? There is no video involved
Normally you would use the higher level
Phononmodule, here are the API docs for it. But because you are dealing with raw samples you will need the lower levelQtMultimediamodule, specifically theQAudioOutputclass. Docs here.