Skip to content

Fix OPENMPT deprecation error, openmpt_module_ctl_set

mazmazz requested to merge mazmazz_/SRB2:openmpt-deprecated-fix into master

Compiling with libopenmpt 0.5.0 complains about a deprecation error, as seen in this build log.

[ 88%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/mixer_sound.c.o
/Users/travis/build/STJr/SRB2/src/sdl/mixer_sound.c:889:3: error: 'openmpt_module_ctl_set' is deprecated [-Werror,-Wdeprecated-declarations]
                openmpt_module_ctl_set(openmpt_mhandle, "play.tempo_factor", modspd);
                ^
/usr/local/include/libopenmpt/libopenmpt.h:1489:16: note: 'openmpt_module_ctl_set' has been explicitly marked deprecated here
LIBOPENMPT_API LIBOPENMPT_DEPRECATED int openmpt_module_ctl_set( openmpt_module * mod, const char * ctl, const char * value );
               ^
/usr/local/include/libopenmpt/libopenmpt_config.h:143:46: note: expanded from macro 'LIBOPENMPT_DEPRECATED'
#define LIBOPENMPT_DEPRECATED __attribute__((deprecated))
                                             ^

The deprecation is documented in the libopenmpt docs:

Member openmpt_module_ctl_set (openmpt_module *mod, const char *ctl, const char *value)
Please use openmpt_module_ctl_set_boolean(), openmpt_module_ctl_set_integer(), openmpt_module_ctl_set_floatingpoint(), or openmpt_module_ctl_set_text().

I applied the fix and compile is successful.

I IFDEF for older libopenmpt versions to use the older behavior because not all build systems have 0.5.0 available.

Merge request reports