[Fixed] [SDL Mixer X] Building problems, CMake, ...

Description: Report bugs and ask questions regarding PGE here.
Forum rules: Here you can ask any question related to PGE Project components:


Any questions related to LunaLUA project please ask HERE (LunaLUA subsection)
Any questions related to SMBX-38A (1.4.x) Chinese project please ask HERE (SMBX-38A subsection)
Moderators: Semi-moderatos, Moderators

StefG
Topic author, Nice citizen
Nice citizen
StefG
Topic author, Nice citizen
Nice citizen
Reputation: 2
Posts: 14
Joined: 7 Jan 2019

Post #1by StefG » 7 Jan 2019, 17:13

Hello,

I will list here the problems I meet while trying to build SDL_Mixer_X (standalone, as I am not not interested in the whole PGE project at the moment).

My remarks are based on today's git version.

Let's start with the first one I hit.

Problem with Opus

I run cmake, it detects Opus positively:

Code: Select all

 ~/extsvn/SDL-Mixer-X.git/trunk/build $cmake .. -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
AudioCodecs will NOT be used. Libraries will be recognized in the system.
== SDL2: /usr/local/include/SDL2 SDL2 ==
Vorbis: /usr/local/include /usr/local/lib/libvorbis.so
== using Vorbis ==
Opus: /usr/local/include /usr/local/lib/libopusfile.so /usr/local/lib/libopusfile.so
== using Opus ==
FLAC: /usr/local/include /usr/local/lib/libFLAC.so
== using FLAC ==
MAD: /usr/local/include /usr/local/lib/libmad.so
== using MAD ==
ModPlug: /usr/local/include /usr/local/lib/libmodplug.so
== using libModPlug ==
GME: LIBGME_INCLUDE_DIR-NOTFOUND LIBGME_LIB-NOTFOUND
== using CMD Music ==
ADLMIDI: LIBADLMIDI_INCLUDE_DIR-NOTFOUND LIBADLMIDI_LIB-NOTFOUND
OPNMIDI: LIBOPNMIDI_INCLUDE_DIR-NOTFOUND LIBOPNMIDI_LIB-NOTFOUND
-- Configuring done
-- Generating done
-- Build files have been written to: /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build


But when I run make after that, it fails

Code: Select all

 ~/extsvn/SDL-Mixer-X.git/trunk/build $make
/usr/local/bin/cmake -H/home/stephane/extsvn/SDL-Mixer-X.git/trunk -B/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build/CMakeFiles /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
make -f CMakeFiles/SDL2_mixer_ext_Static.dir/build.make CMakeFiles/SDL2_mixer_ext_Static.dir/depend
make[2]: Entering directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
cd /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /home/stephane/extsvn/SDL-Mixer-X.git/trunk /home/stephane/extsvn/SDL-Mixer-X.git/trunk /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build/CMakeFiles/SDL2_mixer_ext_Static.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
make -f CMakeFiles/SDL2_mixer_ext_Static.dir/build.make CMakeFiles/SDL2_mixer_ext_Static.dir/build
make[2]: Entering directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
[  2%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_opus.c.o
/usr/bin/cc -DFLAC__NO_DLL -DHAVE_FORK -DHAVE_INTTYPES_H -DHAVE_SETENV -DHAVE_SINF -DMODPLUG_STATIC -DMUSIC_CMD -DMUSIC_FLAC -DMUSIC_MOD_MODPLUG -DMUSIC_MP3_MAD -DMUSIC_MP3_MAD_GPL_DITHERING -DMUSIC_OGG -DMUSIC_OPUS -DMUSIC_WAV -DPIC -D_POSIX_C_SOURCE=1 -D_REENTRANT -D_USE_MATH_DEFINES -Dmain=SDL_main -I/home/stephane/extsvn/SDL-Mixer-X.git/trunk/include/SDL_mixer_ext -I/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src -I/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs -I/include/SDL2 -I/home/stephane/extsvn/SDL-Mixer-X.git/trunk/include -I/usr/local/include/SDL2 -I/libogg/include -I/libvorbis/include  -Wall -std=c90 -O3 -DNDEBUG   -o CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_opus.c.o   -c /home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_opus.c
In file included from /home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_opus.c:33:0:
/usr/local/include/opus/opusfile.h:110:31: fatal error: opus_multistream.h: No such file or directory
 # include <opus_multistream.h>
                               ^
compilation terminated.
make[2]: *** [CMakeFiles/SDL2_mixer_ext_Static.dir/build.make:162: CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_opus.c.o] Error 1
make[2]: Leaving directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
make[1]: *** [CMakeFiles/Makefile2:71: CMakeFiles/SDL2_mixer_ext_Static.dir/all] Error 2
make[1]: Leaving directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
make: *** [Makefile:133: all] Error 2


The problem is that /usr/local/include/opus is not among the paths given to the compiler. As long as C files #include "opus/something.h", it is still OK, but when a C file (in this case, the system /usr/local/include/opus/opusfile.h) #includes directly <something.h>, it cannot work.

I am not sure why you don't use pkg-config in your CMake configuration.

It provides the correct paths:

Code: Select all

~/extsvn/SDL-Mixer-X.git/trunk/build $pkg-config --cflags opusfile
-I/usr/local/include/opus -I/usr/local/include -I/usr/local/include/opus


I know nothing about Cmake, so I cannot fix it properly, but I see that you already use pkg-config for SDL2, so I imagine it should be possible to use it for other libraries too?

Deprecated / ADLMIDI / OPNMIDI

OK, let's skip the Opus thing for now:

Code: Select all

 ~/extsvn/SDL-Mixer-X.git/trunk/build $cmake .. -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DUSE_OPUS=OFF
-- The C compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
== Using default build configuration which is a Release!
AudioCodecs will NOT be used. Libraries will be recognized in the system.
-- Checking for module 'sdl2'
--   Found sdl2, version 2.0.8
== SDL2: /usr/local/include/SDL2 SDL2 ==
-- Looking for ov_open in vorbisfile
-- Looking for ov_open in vorbisfile - found
Vorbis: /usr/local/include /usr/local/lib/libvorbis.so
== using Vorbis ==
-- Looking for FLAC__format_sample_rate_is_valid in FLAC
-- Looking for FLAC__format_sample_rate_is_valid in FLAC - found
FLAC: /usr/local/include /usr/local/lib/libFLAC.so
== using FLAC ==
-- Looking for mad_frame_init in mad
-- Looking for mad_frame_init in mad - found
MAD: /usr/local/include /usr/local/lib/libmad.so
== using MAD ==
-- Looking for ModPlug_Load in modplug
-- Looking for ModPlug_Load in modplug - found
ModPlug: /usr/local/include /usr/local/lib/libmodplug.so
== using libModPlug ==
-- Looking for gme_load_file in gme
-- Looking for gme_load_file in gme - not found
GME: LIBGME_INCLUDE_DIR-NOTFOUND LIBGME_LIB-NOTFOUND
== using CMD Music ==
-- Looking for fork
-- Looking for fork - found
-- Looking for adl_init in ADLMIDI
-- Looking for adl_init in ADLMIDI - not found
ADLMIDI: LIBADLMIDI_INCLUDE_DIR-NOTFOUND LIBADLMIDI_LIB-NOTFOUND
-- Looking for opn_init in OPNMIDI
-- Looking for opn_init in OPNMIDI - not found
OPNMIDI: LIBOPNMIDI_INCLUDE_DIR-NOTFOUND LIBOPNMIDI_LIB-NOTFOUND
-- Configuring done
-- Generating done
-- Build files have been written to: /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build


It doesn't find ADLMIDI and OPNMIDI, that's normal. It still generates a Makefile as if it was OK to do without them.

But then when building, make fails:

Code: Select all

 ~/extsvn/SDL-Mixer-X.git/trunk/build $make
/usr/local/bin/cmake -H/home/stephane/extsvn/SDL-Mixer-X.git/trunk -B/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build/CMakeFiles /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
make -f CMakeFiles/SDL2_mixer_ext_Static.dir/build.make CMakeFiles/SDL2_mixer_ext_Static.dir/depend
make[2]: Entering directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
cd /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /home/stephane/extsvn/SDL-Mixer-X.git/trunk /home/stephane/extsvn/SDL-Mixer-X.git/trunk /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build/CMakeFiles/SDL2_mixer_ext_Static.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
make -f CMakeFiles/SDL2_mixer_ext_Static.dir/build.make CMakeFiles/SDL2_mixer_ext_Static.dir/build
make[2]: Entering directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
make[2]: Nothing to be done for 'CMakeFiles/SDL2_mixer_ext_Static.dir/build'.
make[2]: Leaving directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
[ 50%] Built target SDL2_mixer_ext_Static
make -f CMakeFiles/SDL2_mixer_ext.dir/build.make CMakeFiles/SDL2_mixer_ext.dir/depend
make[2]: Entering directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
cd /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /home/stephane/extsvn/SDL-Mixer-X.git/trunk /home/stephane/extsvn/SDL-Mixer-X.git/trunk /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build/CMakeFiles/SDL2_mixer_ext.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
make -f CMakeFiles/SDL2_mixer_ext.dir/build.make CMakeFiles/SDL2_mixer_ext.dir/build
make[2]: Entering directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
[ 53%] Linking C shared library lib/libSDL2_mixer_ext.so
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/SDL2_mixer_ext.dir/link.txt --verbose=1
/usr/bin/cc -fPIC  -Wall -std=c90 -O3 -DNDEBUG  -Wl,--no-undefined -shared -Wl,-soname,libSDL2_mixer_ext.so -o lib/libSDL2_mixer_ext.so CMakeFiles/SDL2_mixer_ext.dir/src/codecs/load_aiff.c.o CMakeFiles/SDL2_mixer_ext.dir/src/codecs/load_voc.c.o CMakeFiles/SDL2_mixer_ext.dir/src/codecs/music_wav.c.o CMakeFiles/SDL2_mixer_ext.dir/src/codecs/music_ogg.c.o CMakeFiles/SDL2_mixer_ext.dir/src/codecs/music_flac.c.o CMakeFiles/SDL2_mixer_ext.dir/src/codecs/music_mad.c.o CMakeFiles/SDL2_mixer_ext.dir/src/codecs/music_id3tag.c.o CMakeFiles/SDL2_mixer_ext.dir/src/codecs/music_modplug.c.o CMakeFiles/SDL2_mixer_ext.dir/src/codecs/music_cmd.c.o CMakeFiles/SDL2_mixer_ext.dir/src/effect_position.c.o CMakeFiles/SDL2_mixer_ext.dir/src/effects_internal.c.o CMakeFiles/SDL2_mixer_ext.dir/src/effect_stereoreverse.c.o CMakeFiles/SDL2_mixer_ext.dir/src/mixer.c.o CMakeFiles/SDL2_mixer_ext.dir/src/music.c.o CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o -Wl,-rpath,/usr/local/lib: -lSDL2 /usr/local/lib/libvorbisfile.so /usr/local/lib/libvorbis.so /usr/local/lib/libFLAC.so /usr/local/lib/libogg.so /usr/local/lib/libmad.so /usr/local/lib/libmodplug.so /usr/local/lib/libSDL2.so -lstdc++
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_Timidity_addToPathList':
mixer_x_deprecated.c:(.text+0x1): undefined reference to `Mix_Timidity_addToPathList'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_getBankNames':
mixer_x_deprecated.c:(.text+0x11): undefined reference to `Mix_ADLMIDI_getBankNames'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_getBankID':
mixer_x_deprecated.c:(.text+0x21): undefined reference to `Mix_ADLMIDI_getBankID'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_setBankID':
mixer_x_deprecated.c:(.text+0x31): undefined reference to `Mix_ADLMIDI_setBankID'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_getTremolo':
mixer_x_deprecated.c:(.text+0x41): undefined reference to `Mix_ADLMIDI_getTremolo'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_setTremolo':
mixer_x_deprecated.c:(.text+0x51): undefined reference to `Mix_ADLMIDI_setTremolo'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_getVibrato':
mixer_x_deprecated.c:(.text+0x61): undefined reference to `Mix_ADLMIDI_getVibrato'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_setVibrato':
mixer_x_deprecated.c:(.text+0x71): undefined reference to `Mix_ADLMIDI_setVibrato'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_getScaleMod':
mixer_x_deprecated.c:(.text+0x81): undefined reference to `Mix_ADLMIDI_getScaleMod'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_setScaleMod':
mixer_x_deprecated.c:(.text+0x91): undefined reference to `Mix_ADLMIDI_setScaleMod'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_getAdLibMode':
mixer_x_deprecated.c:(.text+0xa1): undefined reference to `Mix_ADLMIDI_getAdLibMode'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_setAdLibMode':
mixer_x_deprecated.c:(.text+0xb1): undefined reference to `Mix_ADLMIDI_setAdLibMode'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_setSetDefaults':
mixer_x_deprecated.c:(.text+0xc1): undefined reference to `Mix_ADLMIDI_setSetDefaults'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_getLogarithmicVolumes':
mixer_x_deprecated.c:(.text+0xd1): undefined reference to `Mix_ADLMIDI_getLogarithmicVolumes'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_setLogarithmicVolumes':
mixer_x_deprecated.c:(.text+0xe1): undefined reference to `Mix_ADLMIDI_setLogarithmicVolumes'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_getVolumeModel':
mixer_x_deprecated.c:(.text+0xf1): undefined reference to `Mix_ADLMIDI_getVolumeModel'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_ADLMIDI_setVolumeModel':
mixer_x_deprecated.c:(.text+0x101): undefined reference to `Mix_ADLMIDI_setVolumeModel'
CMakeFiles/SDL2_mixer_ext.dir/src/mixer_x_deprecated.c.o: In function `MIX_OPNMIDI_setCustomBankFile':
mixer_x_deprecated.c:(.text+0x111): undefined reference to `Mix_OPNMIDI_setCustomBankFile'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/SDL2_mixer_ext.dir/build.make:469: lib/libSDL2_mixer_ext.so] Error 1
make[2]: Leaving directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
make[1]: *** [CMakeFiles/Makefile2:108: CMakeFiles/SDL2_mixer_ext.dir/all] Error 2
make[1]: Leaving directory '/home/stephane/extsvn/SDL-Mixer-X.git/trunk/build'
make: *** [Makefile:133: all] Error 2


Because it still tried to compile and link function related to ADLMIDI and OPNMIDI, despite having detected that they were not present.

I guess CMake should either:
  • refuse to go on when ADLMIDI or OPNMIDI are missing, if they are truly required;
  • or generate a Makefile which won't build parts related to ADLMIDI and OPNMIDI, if those parts are optional.

What's your opinion on this?




Explanation of why I am interested in your library (and not coming from an interest in the PGE project).

I found your library after spending time to implement a feature in the official SDL_mixer and finding a few problems in the code of that official library. Then after I did that, I found your project and found out that you had already implemented the same feature I worked on :hi: and that your rewrite possibly solved (a few of?) the problems I had found in the official library. So I thought it would be easier to replace the official library with your fork than to struggle with the problems of the original one.




(I tried to post this message yesterday, but it didn't appear after 24 hours, so I post it again; I hope both won't appear at the same time.)
Last edited by Wohlstand on 9 Jan 2019, 3:17, edited 1 time in total.

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 27
Reputation: 385
Posts: 1420
Joined: 15 Feb 2014
Location: Moscow, Russia
Website Skype YouTube

Post #2by Wohlstand » 9 Jan 2019, 3:10

CMake build is not polished to fully use system libraries and that I need to polish... You can turn the usage of "AudioCodecs" repository:

Code: Select all

cmake -DDOWNLOAD_AUDIO_CODECS_DEPENDENCY=ON ..

to tell CMake download the complete AudioCodecs package that includes all necessary libraries and will compile it for you which is easiest way to get the complete SDL Mixer X be built. All libraries of AudioCodecs (include OPUS, libADLMIDI and libOPNMIDI) will be built into separated folder as static libraries and will be linked with your SDL Mixer X build. In this case, you will take the SDL Mixer X that will contain all necessary libraries and features are enabled by default, even they aren't installed in your system. Note that if you linking SDL Mixer X with your application statically, you will also need to link all libraries are used by SDL Mixer X too.

Alternatively, you can manually disable any unnecessary libraries to just use in-system stuff:

Code: Select all

cmake -DUSE_MIDI_ADLMIDI=OFF -DUSE_MIDI_OPNMIDI=OFF -DUSE_OPUS=OFF ..


As I can see, the automatical detection of OPUS is incorrectly made at me in CMakeLists.txt of SDL Mixer X, therefore it can't figure out for OPUS's header. I need to fix this, thanks for a report! I have made an issue to fix this soon https://github.com/WohlSoft/SDL-Mixer-X/issues/25

Also, I think, it's better for me to split up the library-specific codes to make the whole stuff more organized...

EDIT: For your convenience, you can use `ccmake` or GUI CMake to tune any SDL Mixer X's build flags and disable unnecessary parts you don't want see in your SDL Mixer X build. Otherwise, all flags/options you can see in code of CMakeLists.txt directly, just find any "option(" ;-)

Added after 8 minutes 33 seconds:
(P.S. To avoid spam, every first post is pre-moderated. The appearence of post is dependent on how quickly me or any moderator here will figure out that new message for review is appeared here ;-) No one spam-bot or spam-human will enter here! :fox-comando:)

Added after 11 minutes 42 seconds:
StefG wrote:I found your library after spending time to implement a feature in the official SDL_mixer and finding a few problems in the code of that official library. Then after I did that, I found your project and found out that you had already implemented the same feature I worked on :hi: and that your rewrite possibly solved (a few of?) the problems I had found in the official library. So I thought it would be easier to replace the official library with your fork than to struggle with the problems of the original one.
Yeah, the library fork I made to resolve several issues inlucde resampling troubles (was in a past on SDL2 side until they are made it much better, but also with my minor set of patches I helped them) and adding of some own codecs aren't supported officially, the first was libSPC to play SPC files, and later I replaced it with libGME. Later I made own MIDI synthesizer libraries (libADLMIDI, and later, libOPNMIDI) and I have made the native ability to switch MIDI playing libraries on runtime. Related to WAV playing, I have extended support of them with supporting of more WAV file types include Float32, Float64, PCM24 of different types, and even ALAW/uLAW support. I have made better seekability support with giving of more API calls to get song length and loop points. I have made the ability to retrieve some meta-tags to allow some informative things like showing the music title while playing game (as example, Tux Kart does that), or making some sort of music player like my simple PGE MusPlay thing. Anyway, once official SDL Mixer was majorely changed, I have done similar rework on my side to port all my features into updated base of official SDL Mixer.

And yeah, I kept full API compatibility with official SDL Mixer to allow easy migration between official SDL Mixer and SDL Mixer X. Even the library is mainly used by me in PGE Project, the library is very useful for any other cases too ;-)

StefG
Topic author, Nice citizen
Nice citizen
StefG
Topic author, Nice citizen
Nice citizen
Reputation: 2
Posts: 14
Joined: 7 Jan 2019

Post #3by StefG » 9 Jan 2019, 18:25

Wohlstand wrote:Alternatively, you can manually disable any unnecessary libraries to just use in-system stuff:

Code: Select all

cmake -DUSE_MIDI_ADLMIDI=OFF -DUSE_MIDI_OPNMIDI=OFF -DUSE_OPUS=OFF ..


So, I tried disabling all MIDI support with

Code: Select all

cmake -DUSE_MIDI=OFF ..


and I still hit the same errors as before with mixer_x_deprecated.c.o. make still tries to link this object file into libSDL2_mixer_ext.so and this object file still has undefined references to Mix_Timidity_addToPathList (because it doesn't exist in the standard non-patched Timidity) and all Mix_ADLMIDI_* functions.


Wohlstand wrote:CMake build is not polished to fully use system libraries and that I need to polish... You can turn the usage of "AudioCodecs" repository:

Code: Select all

cmake -DDOWNLOAD_AUDIO_CODECS_DEPENDENCY=ON ..

to tell CMake download the complete AudioCodecs package that includes all necessary libraries and will compile it for you which is easiest way to get the complete SDL Mixer X be built. All libraries of AudioCodecs (include OPUS, libADLMIDI and libOPNMIDI) will be built into separated folder as static libraries and will be linked with your SDL Mixer X build.

I'll explore other solutions first because this static building/linking is not not my favourite (just a matter of personal taste/habits, I am not arguing about anything  ;-) ). And those explorations will allow me to find unnoticed bugs on less often used code paths, he he.

So, I built and installed a system-wide libADLMIDI. Then I made a

Code: Select all

cmake .. -DUSE_OPUS=OFF


which produced this output (I only copied the end of it):

Code: Select all

-- Looking for fork
-- Looking for fork - found
-- Looking for adl_init in ADLMIDI
-- Looking for adl_init in ADLMIDI - found
ADLMIDI: /usr/local/include /usr/local/lib/libADLMIDI.so
== using ADLMIDI ==
-- Looking for opn_init in OPNMIDI
-- Looking for opn_init in OPNMIDI - not found
OPNMIDI: LIBOPNMIDI_INCLUDE_DIR-NOTFOUND LIBOPNMIDI_LIB-NOTFOUND
-- Configuring done
-- Generating done
-- Build files have been written to: /home/stephane/extsvn/SDL-Mixer-X.git/trunk/build


OK, fine. So now, let's make:

Code: Select all


Scanning dependencies of target SDL2_mixer_ext_Static
[  2%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/load_aiff.c.o
[  5%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/load_voc.c.o
[  8%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_wav.c.o
[ 11%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_ogg.c.o
[ 14%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_flac.c.o
[ 17%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_mad.c.o
[ 20%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_id3tag.c.o
[ 23%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_modplug.c.o
[ 26%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_cmd.c.o
[ 29%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_midi_adl.c.o
[ 32%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/effect_position.c.o
[ 35%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/effects_internal.c.o
[ 38%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/effect_stereoreverse.c.o
[ 41%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/mixer.c.o
[ 44%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/music.c.o
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/music.c: In function 'xmi_compatible_midi_player':
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/music.c:649:9: error: 'mididevice_next' undeclared (first use in this function)
     if (mididevice_next != MIDI_ADLMIDI)
         ^~~~~~~~~~~~~~~
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/music.c:649:9: note: each undeclared identifier is reported only once for each function it appears in
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/music.c:654:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[2]: *** [CMakeFiles/SDL2_mixer_ext_Static.dir/build.make:399: CMakeFiles/SDL2_mixer_ext_Static.dir/src/music.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/SDL2_mixer_ext_Static.dir/all] Error 2
make: *** [Makefile:130: all] Error 2


So, I hit another bug.

It is only triggered when ALDMIDI is present, but not OPNMIDI. Relevant chunk of code:

Code: Select all

#if defined(MUSIC_MID_ADLMIDI) || defined(MUSIC_MID_OPNMIDI)
static Mix_MusicType xmi_compatible_midi_player()
{
#if defined(MUSIC_MID_ADLMIDI) && defined(MUSIC_MID_OPNMIDI)
    if((mididevice_current != MIDI_ADLMIDI) && (mididevice_current != MIDI_OPNMIDI))
        return MUS_ADLMIDI;
    else
#elif defined(MUSIC_MID_ADLMIDI)
    if (mididevice_next != MIDI_ADLMIDI)
        return MUS_ADLMIDI;
    else
#endif
        return MUS_MID;
}
#endif



Wohlstand wrote:As I can see, the automatical detection of OPUS is incorrectly made at me in CMakeLists.txt of SDL Mixer X, therefore it can't figure out for OPUS's header. I need to fix this, thanks for a report! I have made an issue to fix this soon https://github.com/WohlSoft/SDL-Mixer-X/issues/25

Fine :)

Wohlstand wrote:EDIT: For your convenience, you can use `ccmake`

Oh... I never knew about that tool; until now I have always painfully struggled each time I had to configure a package and it was using cmake instead of autotools... Thank you!


Wohlstand wrote:(P.S. To avoid spam, every first post is pre-moderated. The appearence of post is dependent on how quickly me or any moderator here will figure out that new message for review is appeared here ;-) No one spam-bot or spam-human will enter here! :fox-comando:)
What happened is I did not notice the part of the confirmation page that explains it after I submitted my first post, and I closed it. Then after not seeing my message appear, I thought it could be something like that, but I couldn't access the page any more to check it, and nothing was coming to my mailbox either, so I waited again, for a day, and then, well, I thought if it was a manual moderation thing, one of the mods had time to process this super-low volume traffic, so perhaps I failed at submitting my post, and I posted it again (luckily, I had saved the content in a text file before submitting it the first time). And this second time, I noticed the warning message about manual moderation of first posts on the confirmation page, so I understood I just should have waited a little bit more, but it was too late, my second post was already sent. And I was not going to send a third exemplary to apologise for the first 2 ones :biggrin: Maybe an automated e-mail with the same content as this confirmation page ("post was received and is waiting for a manual moderation, please be patient, do not try to submit again") would be an improvement (if phpBB has this feature built-in). Oh well, it is not important.


Added after 1 hour 11 minutes:
After my previous message, in order to jump over the last quoted problem, I installed libOPNMIDI.

But I still hit the same problem, because cmake doesn't detect libOPNMIDI.

Looking at CMakeLists.txt, I understand you check whether opn_init function is present in libOPNMIDI. But all your functions are named opn2_something(), not opn_something() :mrgreen:

Code: Select all

            check_library_exists(OPNMIDI opn_init "opnmidi.h" FOUND_OPNMIDI)


should be

Code: Select all

            check_library_exists(OPNMIDI opn2_init "opnmidi.h" FOUND_OPNMIDI)



After fixing that, the only remaining problem is with Mix_Timidity_addToPathList. This problem persists even after a

Code: Select all

cmake .. -DUSE_OPUS=OFF -DUSE_MIDI_TIMIDITY=OFF
.

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 27
Reputation: 385
Posts: 1420
Joined: 15 Feb 2014
Location: Moscow, Russia
Website Skype YouTube

Post #4by Wohlstand » 9 Jan 2019, 23:48

StefG wrote:After fixing that, the only remaining problem is with Mix_Timidity_addToPathList. This problem persists even after a

Код: Выделить всё
cmake .. -DUSE_OPUS=OFF -DUSE_MIDI_TIMIDITY=OFF
.
Will check this out...
In the whole, it's still be a stinky smell of unfinish-ness of this: https://github.com/WohlSoft/SDL-Mixer-X/issues/14
So, gonna to try polish this out...

StefG
Topic author, Nice citizen
Nice citizen
StefG
Topic author, Nice citizen
Nice citizen
Reputation: 2
Posts: 14
Joined: 7 Jan 2019

Post #5by StefG » 10 Jan 2019, 0:04

Wohlstand wrote:Will check this out...

I noticed mixer_x_deprecated.c is always built with all its functions enabled, but the functions it calls are defined in files which are not always built.

In this case, codecs/music_timidity.c is not built, even though you had inserted #ifdefs into it so that it could be built without the actual presence of Timidity.

For the time being, on my setup, I just added an #if 0 inside mixer_x_deprecated.c around MIX_Timidity_addToPathList(), to be able to finish the build, but that's of course not the right way, and not the right place either, for a proper fix.

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 27
Reputation: 385
Posts: 1420
Joined: 15 Feb 2014
Location: Moscow, Russia
Website Skype YouTube

Post #6by Wohlstand » 10 Jan 2019, 0:10

Okay, just now I have fixed build and link for the case when ADLMIDI, OPNMIDI and Timidity are disabled: https://github.com/WohlSoft/SDL-Mixer-X/commit/d1 ... 4aeb892181af923191de593a9b229d
Please try to build ;-)

Will try to fix the detection of OPUS...

Added after 50 seconds:
StefG wrote:I noticed mixer_x_deprecated.c is always built with all its functions enabled, but the functions it calls are defined in files which are not always built.
Those functions are public and must be always presented in the build as dummies for the case the library is disabled.

Added after 8 minutes 14 seconds:
OPUS also fixed: https://github.com/WohlSoft/SDL-Mixer-X/commit/61 ... 09582424fb8e698da2c9396c8801b3

Added after 37 minutes 36 seconds:
I also have took care to fix the logic of "Completely disabled MIDI support" build, that is now fine :fox: ;-)

StefG
Topic author, Nice citizen
Nice citizen
StefG
Topic author, Nice citizen
Nice citizen
Reputation: 2
Posts: 14
Joined: 7 Jan 2019

Post #7by StefG » 10 Jan 2019, 1:30

Wohlstand wrote:Please try to build ;-)

All right. So:

cmake .. went fine,

cmake .. -DUSE_MIDI=OFF went fine,

but:

cmake .. -DUSE_MIDI_OPNMIDI=OFF didn't. make failed with:

Code: Select all

~/extsvn/SDL-Mixer-X.git/trunk/build $make
Scanning dependencies of target SDL2_mixer_ext_Static
[  2%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/load_aiff.c.o
[  5%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/load_voc.c.o
[  7%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_wav.c.o
[ 10%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_ogg.c.o
[ 12%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_opus.c.o
[ 15%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_flac.c.o
[ 17%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_mad.c.o
[ 20%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_id3tag.c.o
[ 22%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_modplug.c.o
[ 25%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_cmd.c.o
[ 27%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_midi_adl.c.o
[ 30%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_midi_opn.c.o
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_midi_opn.c: In function 'Mix_OPNMIDI_getFullRangeBrightness':
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_midi_opn.c:81:12: error: 'opnmidi_setup' undeclared (first use in this function)
     return opnmidi_setup.full_brightness_range;
            ^~~~~~~~~~~~~
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_midi_opn.c:81:12: note: each undeclared identifier is reported only once for each function it appears in
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_midi_opn.c: In function 'Mix_OPNMIDI_getFullPanStereo':
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_midi_opn.c:99:12: error: 'opnmidi_setup' undeclared (first use in this function)
     return opnmidi_setup.soft_pan;
            ^~~~~~~~~~~~~
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_midi_opn.c: In function 'Mix_OPNMIDI_getEmulator':
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_midi_opn.c:117:12: error: 'opnmidi_setup' undeclared (first use in this function)
     return opnmidi_setup.emulator;
            ^~~~~~~~~~~~~
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_midi_opn.c: In function 'Mix_OPNMIDI_getFullRangeBrightness':
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_midi_opn.c:85:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_midi_opn.c: In function 'Mix_OPNMIDI_getFullPanStereo':
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_midi_opn.c:103:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_midi_opn.c: In function 'Mix_OPNMIDI_getEmulator':
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_midi_opn.c:121:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[2]: *** [CMakeFiles/SDL2_mixer_ext_Static.dir/build.make:327: CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_midi_opn.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/SDL2_mixer_ext_Static.dir/all] Error 2
make: *** [Makefile:130: all] Error 2


That's apparently just a few Copy-paste mistakes, of #ifdef MUSIC_MID_ADLMIDI instead of #ifdef MUSIC_MID_OPNMIDI

If I correct those mistakes, the file compiles OK, but then I still hit the mididevice_next problem:

Code: Select all

 ~/extsvn/SDL-Mixer-X.git/trunk/build $make
Scanning dependencies of target SDL2_mixer_ext_Static
[  2%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_midi_opn.c.o
[  5%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_timidity.c.o
[  7%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/effect_position.c.o
[ 10%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/effects_internal.c.o
[ 12%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/effect_stereoreverse.c.o
[ 15%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/mixer.c.o
[ 17%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/music.c.o
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/music.c: In function 'xmi_compatible_midi_player':
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/music.c:649:9: error: 'mididevice_next' undeclared (first use in this function)
     if (mididevice_next != MIDI_ADLMIDI)
         ^~~~~~~~~~~~~~~
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/music.c:649:9: note: each undeclared identifier is reported only once for each function it appears in
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/music.c:654:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[2]: *** [CMakeFiles/SDL2_mixer_ext_Static.dir/build.make:471: CMakeFiles/SDL2_mixer_ext_Static.dir/src/music.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/SDL2_mixer_ext_Static.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 27
Reputation: 385
Posts: 1420
Joined: 15 Feb 2014
Location: Moscow, Russia
Website Skype YouTube

Post #8by Wohlstand » 10 Jan 2019, 2:11

StefG wrote:cmake .. -DUSE_MIDI_OPNMIDI=OFF didn't. make failed with:
Oops, gonna to check this out...

Added after 6 minutes 4 seconds:
Damn... My fault... :facepalm:
But, fixed: https://github.com/WohlSoft/SDL-Mixer-X/commit/6c ... d4a0ea20a227ffd8eef46bf1c82ce5

Added after 54 seconds:
StefG wrote:if (mididevice_next != MIDI_ADLMIDI)
That was ancient copy-pasta from SDL Mixer X before I rewrote it after official SDL Mixer got major change... But, I have fixed it just now :comando:

StefG
Topic author, Nice citizen
Nice citizen
StefG
Topic author, Nice citizen
Nice citizen
Reputation: 2
Posts: 14
Joined: 7 Jan 2019

Post #9by StefG » 10 Jan 2019, 13:05

It looks good now!

I just found a minor problem with

Code: Select all

cmake .. -DUSE_MIDI_FLUIDSYNTH=ON


Code: Select all

~/extsvn/SDL-Mixer-X.git/trunk/build $make clean && make
[  2%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/load_aiff.c.o
[  4%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/load_voc.c.o
[  7%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_wav.c.o
[  9%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_ogg.c.o
[ 11%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_opus.c.o
[ 14%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_flac.c.o
[ 16%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_mad.c.o
[ 19%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_id3tag.c.o
[ 21%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_modplug.c.o
[ 23%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_cmd.c.o
[ 26%] Building C object CMakeFiles/SDL2_mixer_ext_Static.dir/src/codecs/music_fluidsynth.c.o
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_fluidsynth.c: In function 'FLUIDSYNTH_Load':
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_fluidsynth.c:69:21: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     fluidsynth.FUNC = FUNC;
                     ^
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_fluidsynth.c:81:9: note: in expansion of macro 'FUNCTION_LOADER'
         FUNCTION_LOADER(delete_fluid_player, int (*)(fluid_player_t*))
         ^~~~~~~~~~~~~~~
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_fluidsynth.c:69:21: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     fluidsynth.FUNC = FUNC;
                     ^
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_fluidsynth.c:83:9: note: in expansion of macro 'FUNCTION_LOADER'
         FUNCTION_LOADER(delete_fluid_synth, int (*)(fluid_synth_t*))


The thing is that Fluidsynth has changed its API. Those functions used to return an int, but now they are void (they simplified because the functions always returned the same value FLUID_OK, so it was useless).

Old API (1.1): http://www.fluidsynth.org/api-1.x/midi_8h.html#a678a3d103532b86dada3d2cd111fed0a
New API (2.0): http://www.fluidsynth.org/api/midi_8h.html#a38494e8ebdab5828518358fb42c94e2c

No other change but changing those 2 signatures is needed, you didn't check the return value of those functions anyway.

I believe no other change is needed elsewhere either, but maybe it is better to check http://www.fluidsynth.org/api/index.html#NewIn2_0_0

I guess that there are 2 possible roads:
  1. tell that Fluidsynth 2.x is not supported (but that's annoying for the user, especially since they didn't do a change in the library name, it is still libfluidsynth.so, not libfluidsynth2.so, so the cohabitation of 2 versions is not easy);
  2. be nice and detect the library version and do some #ifdef for those 2 functions signatures.

They have defined macros (for compile-time) and functions (for run-time) for that purpose, so it should be easier. Here is what I found in my installed version:

Code: Select all

#define FLUIDSYNTH_VERSION       "2.0.3"           /**< String constant of libfluidsynth version. */
#define FLUIDSYNTH_VERSION_MAJOR 2     /**< libfluidsynth major version integer constant. */
#define FLUIDSYNTH_VERSION_MINOR 0     /**< libfluidsynth minor version integer constant. */
#define FLUIDSYNTH_VERSION_MICRO 3     /**< libfluidsynth micro version integer constant. */

FLUIDSYNTH_API void fluid_version(int *major, int *minor, int *micro);
FLUIDSYNTH_API char* fluid_version_str(void);


Here is what I have done:

Code: Select all

~/extsvn/SDL-Mixer-X.git/trunk/src/codecs $svn diff
Index: music_fluidsynth.c
===================================================================
--- music_fluidsynth.c   (révision 242)
+++ music_fluidsynth.c   (copie de travail)
@@ -32,14 +32,19 @@
 
 #include <fluidsynth.h>
 
+#if FLUIDSYNTH_VERSION_MAJOR >= 2
+   #define DELETE_RETURNTYPE void
+#else
+   #define DELETE_RETURNTYPE int
+#endif
 
 typedef struct {
     int loaded;
     void *handle;
 
-    int (*delete_fluid_player)(fluid_player_t*);
+    DELETE_RETURNTYPE (*delete_fluid_player)(fluid_player_t*);
     void (*delete_fluid_settings)(fluid_settings_t*);
-    int (*delete_fluid_synth)(fluid_synth_t*);
+    DELETE_RETURNTYPE (*delete_fluid_synth)(fluid_synth_t*);
     int (*fluid_player_add)(fluid_player_t*, const char*);
     int (*fluid_player_add_mem)(fluid_player_t*, const void*, size_t);
     int (*fluid_player_get_status)(fluid_player_t*);
@@ -78,9 +83,9 @@
             return -1;
         }
 #endif
-        FUNCTION_LOADER(delete_fluid_player, int (*)(fluid_player_t*))
+        FUNCTION_LOADER(delete_fluid_player, DELETE_RETURNTYPE (*)(fluid_player_t*))
         FUNCTION_LOADER(delete_fluid_settings, void (*)(fluid_settings_t*))
-        FUNCTION_LOADER(delete_fluid_synth, int (*)(fluid_synth_t*))
+        FUNCTION_LOADER(delete_fluid_synth, DELETE_RETURNTYPE (*)(fluid_synth_t*))
         FUNCTION_LOADER(fluid_player_add, int (*)(fluid_player_t*, const char*))
         FUNCTION_LOADER(fluid_player_add_mem, int (*)(fluid_player_t*, const void*, size_t))
         FUNCTION_LOADER(fluid_player_get_status, int (*)(fluid_player_t*))

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 27
Reputation: 385
Posts: 1420
Joined: 15 Feb 2014
Location: Moscow, Russia
Website Skype YouTube

Post #10by Wohlstand » 10 Jan 2019, 15:09

StefG, yeah, the code here is made for FluidSynth 1 and incompatible with FluidSynth 2 yet... Long time I didn't touched FluidSynth thing as I worked on a way to make united MIDI sequencer module (splitted out from libADLMIDI and libOPNMIDI are was embedded parts) to use it with all MIDI synths to support same behavior include loop points of different formats and special events. I wanted to use FluidLite that lacks MIDI sequencer, but full FluidSynth stinks on Windows - no way to build clean library with no audio output integration use. Also it needs DirectX headers are usually lack on MinGW toolchains (but exists on MinGW-w64 I think).

I'll try to check out the FluidSynth 2 and will tune the thing to support both: https://github.com/WohlSoft/SDL-Mixer-X/issues/26
EDIT: Will check out your patch at my home, for now I'm at my job.

StefG
Topic author, Nice citizen
Nice citizen
StefG
Topic author, Nice citizen
Nice citizen
Reputation: 2
Posts: 14
Joined: 7 Jan 2019

Post #11by StefG » 10 Jan 2019, 19:55

Wohlstand wrote:Long time I didn't touched FluidSynth thing as I worked on a way to make united MIDI sequencer module (splitted out from libADLMIDI and libOPNMIDI are was embedded parts) to use it with all MIDI synths to support same behavior include loop points of different formats and special events. I wanted to use FluidLite that lacks MIDI sequencer, but full FluidSynth stinks on Windows - no way to build clean library with no audio output integration use. Also it needs DirectX headers are usually lack on MinGW toolchains (but exists on MinGW-w64 I think).

I declare myself incompetent as far as Windows programming is concerned ;-)

EDIT: Will check out your patch at my home, for now I'm at my job.

Sure, do not feel any need to rush for me, anyway. Take all the time you want; if I happen to have any "need", I can find a way to find temporary workarounds, in general.

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 27
Reputation: 385
Posts: 1420
Joined: 15 Feb 2014
Location: Moscow, Russia
Website Skype YouTube

Post #12by Wohlstand » 11 Jan 2019, 1:57

Made just now! https://github.com/WohlSoft/SDL-Mixer-X/commit/c8 ... 20e31ee3a94ab3d900248f5a5c0443

Please test this, at me with FluidSynth 1 it builds fine! :)

Added after 1 minute 30 seconds:
StefG wrote:I declare myself incompetent as far as Windows programming is concerned ;-)
I using Windows mainly from off VirtualBox to debug some specific issues with my apps. I making cross-platform stuff and I testing on three platforms: Linux (my host system that is Linux Mint 19.1 at this moment), Windows under VirtualBox and macOS.

StefG
Topic author, Nice citizen
Nice citizen
StefG
Topic author, Nice citizen
Nice citizen
Reputation: 2
Posts: 14
Joined: 7 Jan 2019

Post #13by StefG » 14 Jan 2019, 0:40

Wohlstand wrote:Please test this, at me with FluidSynth 1 it builds fine! :)

I forgot to do it: I now confirm it builds OK here too (with FluidSynth 2).


Return to “Troubleshooting”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest