I’m trying to make a C program record a MIDI keyboard using fluidsynth and it’s router functions from the documentation website (https://www.fluidsynth.org/api/MIDIRouter.html but for some reason it isn’t showing any of the log information that usually comes when creating a fluid_midi_driver_t
object.
Here is the router program I’m currently trying to run:
#include <fluidsynth.h>
#include <signal.h>
#define FPS 30
int getMidiEventType(fluid_midi_event_t *event)
{
return fluid_midi_event_get_type(event) >> 4;
}
static volatile int running = 1;
void intHandler(int value)
{
running = 0;
printf("Exitting loop!n");
}
int handle_midi_event(void *data, fluid_midi_event_t *event)
{
printf("event type: %dn", fluid_midi_event_get_type(event) >> 4);
return 1;
}
int main(int argc, char **argv)
{
fluid_settings_t *settings;
fluid_midi_router_t *router;
settings = new_fluid_settings();
fluid_settings_setint(settings, "midi.autoconnect", 1);
router = new_fluid_midi_router(settings, handle_midi_event, NULL);
signal(SIGINT, intHandler);
while (running)
{
continue;
}
delete_fluid_midi_router(router);
delete_fluid_settings(settings);
return 0;
}
I’m not sure if I’m forgetting to call a function to start the MIDI recording, as when running the MIDI driver example from the website it starts recording and calling the call back after new_fluid_midi_driver
is called.
So far the above program compiles and runs without any errors or logs being output from fluidsynth, but the callback doesn’t seem to be called at all when inputting MIDI events.
2