I'm using SDL_Mixer in my project currently and I found the following library to play sounds from a soundfont https://github.com/schellingb/TinySoundFont

I tried this example which use the normal SDL_OpenAudio and it works fine https://github.com/schellingb/TinySoundFont/blob/master/examples/example2.c#L72

The issue here is that I'm not sure how to translate this example into SDL_Mixer.

Usually in SDL_Mixer I just load a wav into a Mix_Chunk with Mix_LoadWav, and then I play it with Mix_PlayChannel(-1, myChunk, 0)

In the TinySoundFont example it seems like there is a callback that I'm not sure where to add in the SDL_Mixer, and also, how I put tsf_note_on inside a chunk so it gets played when I call Mix_PlayChannel?


Your Answer

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

Browse other questions tagged or ask your own question.