add a unit test for reverb and chorus settings

This commit is contained in:
derselbst 2018-05-09 22:09:23 +02:00
parent 36546a9efb
commit cb58583050
2 changed files with 40 additions and 0 deletions

View File

@ -14,6 +14,7 @@ ADD_FLUID_TEST(test_sfont_loading)
ADD_FLUID_TEST(test_sample_rate_change) ADD_FLUID_TEST(test_sample_rate_change)
ADD_FLUID_TEST(test_preset_sample_loading) ADD_FLUID_TEST(test_preset_sample_loading)
ADD_FLUID_TEST(test_seqbind_unregister) ADD_FLUID_TEST(test_seqbind_unregister)
ADD_FLUID_TEST(test_synth_chorus_reverb)
if ( LIBSNDFILE_HASVORBIS ) if ( LIBSNDFILE_HASVORBIS )
ADD_FLUID_TEST(test_sf3_sfont_loading) ADD_FLUID_TEST(test_sf3_sfont_loading)

View File

@ -0,0 +1,39 @@
#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);
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.reverb.roomsize", 1.0));
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.reverb.damp", 1.0));
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.reverb.width", 1.0));
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.reverb.level", 1.0));
TEST_SUCCESS(fluid_settings_setint(settings, "synth.chorus.nr", 99));
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.chorus.level", 1.0));
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.chorus.speed", 1.0));
TEST_SUCCESS(fluid_settings_setnum(settings, "synth.chorus.depth", 1.0));
synth = new_fluid_synth(settings);
TEST_ASSERT(synth != NULL);
TEST_ASSERT(fluid_synth_get_reverb_roomsize(synth) == 1.0);
TEST_ASSERT(fluid_synth_get_reverb_damp(synth) == 1.0);
TEST_ASSERT(fluid_synth_get_reverb_width(synth) == 1.0);
TEST_ASSERT(fluid_synth_get_reverb_level(synth) == 1.0);
TEST_ASSERT(fluid_synth_get_chorus_nr(synth) == 99);
TEST_ASSERT(fluid_synth_get_chorus_level(synth) == 1.0);
TEST_ASSERT(fluid_synth_get_chorus_speed_Hz(synth) == 1.0);
TEST_ASSERT(fluid_synth_get_chorus_depth_ms(synth) == 1.0);
delete_fluid_synth(synth);
delete_fluid_settings(settings);
return EXIT_SUCCESS;
}