2018-05-08 20:19:28 +00:00
|
|
|
|
|
|
|
#include "test.h"
|
|
|
|
#include "fluidsynth.h" // use local fluidsynth header
|
|
|
|
|
|
|
|
// simple test to ensure that manually unregistering and deleting the internal fluid_seqbind_t works without crashing
|
2018-05-19 07:29:39 +00:00
|
|
|
int main(void)
|
2018-05-08 20:19:28 +00:00
|
|
|
{
|
2018-06-24 11:01:31 +00:00
|
|
|
fluid_settings_t *settings = new_fluid_settings();
|
|
|
|
fluid_synth_t *synth = new_fluid_synth(settings);
|
|
|
|
fluid_sequencer_t *seq = new_fluid_sequencer2(0 /*i.e. use sample timer*/);
|
2018-05-08 20:19:28 +00:00
|
|
|
|
|
|
|
// silently creates a fluid_seqbind_t
|
|
|
|
int seqid = fluid_sequencer_register_fluidsynth(seq, synth);
|
|
|
|
|
2018-06-24 11:01:31 +00:00
|
|
|
fluid_event_t *evt = new_fluid_event();
|
2018-05-08 20:19:28 +00:00
|
|
|
fluid_event_set_source(evt, -1);
|
|
|
|
fluid_event_set_dest(evt, seqid);
|
2018-06-24 11:01:31 +00:00
|
|
|
|
2018-05-08 20:19:28 +00:00
|
|
|
// manually free the fluid_seqbind_t
|
|
|
|
fluid_event_unregistering(evt);
|
|
|
|
fluid_sequencer_send_now(seq, evt);
|
2018-06-24 11:01:31 +00:00
|
|
|
|
2018-05-08 20:19:28 +00:00
|
|
|
// client should be removed, deleting the seq should not free the struct again
|
2019-07-10 15:00:30 +00:00
|
|
|
delete_fluid_event(evt);
|
2018-05-08 20:19:28 +00:00
|
|
|
delete_fluid_sequencer(seq);
|
|
|
|
delete_fluid_synth(synth);
|
|
|
|
delete_fluid_settings(settings);
|
2018-06-24 11:01:31 +00:00
|
|
|
|
2018-05-08 20:19:28 +00:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|