2018-05-09 20:09:23 +00:00
|
|
|
|
|
|
|
#include "test.h"
|
|
|
|
#include "fluidsynth.h"
|
|
|
|
|
|
|
|
// this test should make sure that sample rate changed are handled correctly
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
fluid_synth_t *synth;
|
|
|
|
fluid_settings_t *settings = new_fluid_settings();
|
|
|
|
TEST_ASSERT(settings != NULL);
|
2018-06-24 11:01:31 +00:00
|
|
|
|
2018-05-17 19:44:03 +00:00
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.reverb.room-size", 0.1));
|
2018-05-17 19:15:48 +00:00
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.reverb.damp", 0.2));
|
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.reverb.width", 0.3));
|
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.reverb.level", 0.4));
|
2018-06-24 11:01:31 +00:00
|
|
|
|
2018-05-09 20:09:23 +00:00
|
|
|
TEST_SUCCESS(fluid_settings_setint(settings, "synth.chorus.nr", 99));
|
2018-05-17 19:15:48 +00:00
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.chorus.level", 0.5));
|
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.chorus.speed", 0.6));
|
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.chorus.depth", 0.7));
|
2018-06-24 11:01:31 +00:00
|
|
|
|
2018-05-09 20:09:23 +00:00
|
|
|
synth = new_fluid_synth(settings);
|
2018-06-24 11:01:31 +00:00
|
|
|
TEST_ASSERT(synth != NULL);
|
|
|
|
|
2018-05-17 19:15:48 +00:00
|
|
|
// check that the synth is initialized with the correct values
|
|
|
|
TEST_ASSERT(fluid_synth_get_reverb_roomsize(synth) == 0.1);
|
|
|
|
TEST_ASSERT(fluid_synth_get_reverb_damp(synth) == 0.2);
|
|
|
|
TEST_ASSERT(fluid_synth_get_reverb_width(synth) == 0.3);
|
|
|
|
TEST_ASSERT(fluid_synth_get_reverb_level(synth) == 0.4);
|
2018-06-24 11:01:31 +00:00
|
|
|
|
2018-05-09 20:09:23 +00:00
|
|
|
TEST_ASSERT(fluid_synth_get_chorus_nr(synth) == 99);
|
2018-05-17 19:15:48 +00:00
|
|
|
TEST_ASSERT(fluid_synth_get_chorus_level(synth) == 0.5);
|
|
|
|
TEST_ASSERT(fluid_synth_get_chorus_speed(synth) == 0.6);
|
|
|
|
TEST_ASSERT(fluid_synth_get_chorus_depth(synth) == 0.7);
|
2018-06-24 11:01:31 +00:00
|
|
|
|
2018-05-17 19:15:48 +00:00
|
|
|
// update the realtime settings afterward
|
2018-05-17 19:44:03 +00:00
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.reverb.room-size", 0.11));
|
2018-05-17 19:15:48 +00:00
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.reverb.damp", 0.22));
|
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.reverb.width", 0.33));
|
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.reverb.level", 0.44));
|
2018-06-24 11:01:31 +00:00
|
|
|
|
2018-05-17 19:15:48 +00:00
|
|
|
TEST_SUCCESS(fluid_settings_setint(settings, "synth.chorus.nr", 11));
|
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.chorus.level", 0.55));
|
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.chorus.speed", 0.66));
|
|
|
|
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.chorus.depth", 0.77));
|
2018-06-24 11:01:31 +00:00
|
|
|
|
2018-05-17 19:15:48 +00:00
|
|
|
// check that the realtime settings correctly update the values in the synth
|
|
|
|
TEST_ASSERT(fluid_synth_get_reverb_roomsize(synth) == 0.11);
|
|
|
|
TEST_ASSERT(fluid_synth_get_reverb_damp(synth) == 0.22);
|
|
|
|
TEST_ASSERT(fluid_synth_get_reverb_width(synth) == 0.33);
|
|
|
|
TEST_ASSERT(fluid_synth_get_reverb_level(synth) == 0.44);
|
2018-06-24 11:01:31 +00:00
|
|
|
|
2018-05-17 19:15:48 +00:00
|
|
|
TEST_ASSERT(fluid_synth_get_chorus_nr(synth) == 11);
|
|
|
|
TEST_ASSERT(fluid_synth_get_chorus_level(synth) == 0.55);
|
|
|
|
TEST_ASSERT(fluid_synth_get_chorus_speed(synth) == 0.66);
|
|
|
|
TEST_ASSERT(fluid_synth_get_chorus_depth(synth) == 0.77);
|
2018-06-24 11:01:31 +00:00
|
|
|
|
2018-05-09 20:09:23 +00:00
|
|
|
delete_fluid_synth(synth);
|
|
|
|
delete_fluid_settings(settings);
|
2018-06-24 11:01:31 +00:00
|
|
|
|
2018-05-09 20:09:23 +00:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|