A basic example of using fluidsynth to play a single note
#include <stdio.h>
#include <fluidsynth.h>
int main(int argc, char **argv)
{
int err = 0;
if(argc != 2)
{
fprintf(stderr, "Usage: fluidsynth_simple [soundfont]\n");
return 1;
}
if(settings == NULL)
{
fprintf(stderr, "Failed to create the settings\n");
err = 2;
goto cleanup;
}
if(synth == NULL)
{
fprintf(stderr, "Failed to create the synthesizer\n");
err = 3;
goto cleanup;
}
{
fprintf(stderr, "Failed to load the SoundFont\n");
err = 4;
goto cleanup;
}
if(adriver == NULL)
{
fprintf(stderr, "Failed to create the audio driver\n");
err = 5;
goto cleanup;
}
printf("Press \"Enter\" to stop: ");
fgetc(stdin);
printf("done\n");
cleanup:
if(adriver)
{
}
if(synth)
{
}
if(settings)
{
}
return err;
}