From abab1f87e4e22ceb91e869b8bc5dfc14436f2a61 Mon Sep 17 00:00:00 2001 From: derselbst Date: Mon, 30 Oct 2017 15:21:38 +0100 Subject: [PATCH] make modulator API const correct --- include/fluidsynth/mod.h | 20 ++++++++++---------- src/synth/fluid_mod.c | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/fluidsynth/mod.h b/include/fluidsynth/mod.h index d68b85f1..857a622e 100644 --- a/include/fluidsynth/mod.h +++ b/include/fluidsynth/mod.h @@ -76,18 +76,18 @@ FLUIDSYNTH_API void fluid_mod_set_source2(fluid_mod_t* mod, int src, int flags); FLUIDSYNTH_API void fluid_mod_set_dest(fluid_mod_t* mod, int dst); FLUIDSYNTH_API void fluid_mod_set_amount(fluid_mod_t* mod, double amount); -FLUIDSYNTH_API int fluid_mod_get_source1(fluid_mod_t* mod); -FLUIDSYNTH_API int fluid_mod_get_flags1(fluid_mod_t* mod); -FLUIDSYNTH_API int fluid_mod_get_source2(fluid_mod_t* mod); -FLUIDSYNTH_API int fluid_mod_get_flags2(fluid_mod_t* mod); -FLUIDSYNTH_API int fluid_mod_get_dest(fluid_mod_t* mod); -FLUIDSYNTH_API double fluid_mod_get_amount(fluid_mod_t* mod); +FLUIDSYNTH_API int fluid_mod_get_source1(const fluid_mod_t* mod); +FLUIDSYNTH_API int fluid_mod_get_flags1(const fluid_mod_t* mod); +FLUIDSYNTH_API int fluid_mod_get_source2(const fluid_mod_t* mod); +FLUIDSYNTH_API int fluid_mod_get_flags2(const fluid_mod_t* mod); +FLUIDSYNTH_API int fluid_mod_get_dest(const fluid_mod_t* mod); +FLUIDSYNTH_API double fluid_mod_get_amount(const fluid_mod_t* mod); -FLUIDSYNTH_API int fluid_mod_test_identity(fluid_mod_t * mod1, fluid_mod_t * mod2); -FLUIDSYNTH_API int fluid_mod_has_source(fluid_mod_t * mod, int cc, int ctrl); -FLUIDSYNTH_API int fluid_mod_has_dest(fluid_mod_t * mod, int gen); +FLUIDSYNTH_API int fluid_mod_test_identity(const fluid_mod_t * mod1, const fluid_mod_t * mod2); +FLUIDSYNTH_API int fluid_mod_has_source(const fluid_mod_t * mod, int cc, int ctrl); +FLUIDSYNTH_API int fluid_mod_has_dest(const fluid_mod_t * mod, int gen); -FLUIDSYNTH_API void fluid_mod_clone(fluid_mod_t* mod, fluid_mod_t* src); +FLUIDSYNTH_API void fluid_mod_clone(fluid_mod_t* mod, const fluid_mod_t* src); #ifdef __cplusplus } diff --git a/src/synth/fluid_mod.c b/src/synth/fluid_mod.c index 087b94c7..1dd7ec63 100644 --- a/src/synth/fluid_mod.c +++ b/src/synth/fluid_mod.c @@ -29,7 +29,7 @@ * @note The \c next member of \c mod will be left unchanged. */ void -fluid_mod_clone(fluid_mod_t* mod, fluid_mod_t* src) +fluid_mod_clone(fluid_mod_t* mod, const fluid_mod_t* src) { mod->dest = src->dest; mod->src1 = src->src1; @@ -97,7 +97,7 @@ fluid_mod_set_amount(fluid_mod_t* mod, double amount) * @return The primary source value (#fluid_mod_src or a MIDI CC controller value). */ int -fluid_mod_get_source1(fluid_mod_t* mod) +fluid_mod_get_source1(const fluid_mod_t* mod) { return mod->src1; } @@ -108,7 +108,7 @@ fluid_mod_get_source1(fluid_mod_t* mod) * @return The primary source flags (#fluid_mod_flags). */ int -fluid_mod_get_flags1(fluid_mod_t* mod) +fluid_mod_get_flags1(const fluid_mod_t* mod) { return mod->flags1; } @@ -119,7 +119,7 @@ fluid_mod_get_flags1(fluid_mod_t* mod) * @return The secondary source value (#fluid_mod_src or a MIDI CC controller value). */ int -fluid_mod_get_source2(fluid_mod_t* mod) +fluid_mod_get_source2(const fluid_mod_t* mod) { return mod->src2; } @@ -130,7 +130,7 @@ fluid_mod_get_source2(fluid_mod_t* mod) * @return The secondary source flags (#fluid_mod_flags). */ int -fluid_mod_get_flags2(fluid_mod_t* mod) +fluid_mod_get_flags2(const fluid_mod_t* mod) { return mod->flags2; } @@ -141,7 +141,7 @@ fluid_mod_get_flags2(fluid_mod_t* mod) * @return Destination generator (#fluid_gen_type) */ int -fluid_mod_get_dest(fluid_mod_t* mod) +fluid_mod_get_dest(const fluid_mod_t* mod) { return mod->dest; } @@ -152,7 +152,7 @@ fluid_mod_get_dest(fluid_mod_t* mod) * @return Scale amount */ double -fluid_mod_get_amount(fluid_mod_t* mod) +fluid_mod_get_amount(const fluid_mod_t* mod) { return (double) mod->amount; } @@ -412,7 +412,7 @@ fluid_mod_delete (fluid_mod_t *mod) * SF2.01 section 9.5.1 page 69, 'bullet' 3 defines 'identical'. */ int -fluid_mod_test_identity (fluid_mod_t *mod1, fluid_mod_t *mod2) +fluid_mod_test_identity (const fluid_mod_t *mod1, const fluid_mod_t *mod2) { return mod1->dest == mod2->dest && mod1->src1 == mod2->src1 @@ -429,7 +429,7 @@ fluid_mod_test_identity (fluid_mod_t *mod1, fluid_mod_t *mod2) * * @return TRUE if the modulator has the given source, FALSE otherwise. */ -int fluid_mod_has_source(fluid_mod_t * mod, int cc, int ctrl) +int fluid_mod_has_source(const fluid_mod_t * mod, int cc, int ctrl) { return ( @@ -450,7 +450,7 @@ int fluid_mod_has_source(fluid_mod_t * mod, int cc, int ctrl) * @param gen The destination generator of type #fluid_gen_type to check for * @return TRUE if the modulator has the given destination, FALSE otherwise. */ -int fluid_mod_has_dest(fluid_mod_t * mod, int gen) +int fluid_mod_has_dest(const fluid_mod_t * mod, int gen) { return mod->dest == gen; }