Hi,
I have been exprerimenting FFmpeg libraries + SDL2 library using Delphi for audio and video output(playing).
Currently since few days I am trying to use BSS library for audio output but I am stuck at some point. It seems BASS is a powerfull library for playing files like mp3 etc.
But I my point is not to let BASS play (radio)streams or (aduio)files. I am trying to play audio samples got from FFmpeg libraries which I am able to play using SDL2 library.
I am using the following construct:
initialize;
BASS_Init(-1, freq, 0, WindowHandleToPlatform(wHandle).Wnd, nil) //frequency retrieved from FFmpeg's format context
create a streamhandle;
StreamHandle := BASS_StreamCreate(freq, channels, 0, strmproc, Self);//I assume using "0" -> sample format s16 ?
BASS_ChannelPlay(StreamHandle, false);
in the callback "strmproc" I get audio "frames" from FFmpeg libraries, try to convert them to sample format s16 and put in the buffer;
move(audio_buf^, buf^, c);
Result := c;
This way I get some noisy audio, I don't know how to fix.
Is this the converted frame or something else ? Or can somebody give a small example ?