Most of the synchronization was too deep in the implementation so that it did not guard everything it needed.
Now each song has precisely one mutex which must be locked for all access to its internals - this is done in the public ZMusic interface
This reverts commit 747b3dfcfe.
# Conflicts:
# libraries/asmjit/asmjit/core/compiler.h
This had to be reverted because it breaks exception handling which is a critical problem.
With the updated code any exception thrown inside code that had a JITed call stack would crash.
FluidSynth 1.x: these functions return 1 on success and 0 otherwise
FluidSynth 2.x: these functions return FLUID_OK (0) on success and FLUID_FAILED (-1) otherwise
DYN_SNDFILE=NO and DYN_MPG123=NO were ignored while DYN_FLUIDSYNTH=NO broke compilation
These options should be applied to ZMusic target instead of the main executable
As a bonus, it's now possible to build GZDoom without FluidSynth
Now there is only one single entry point for both, instead of previously 2 entry and 4 exit points.
This also eliminates the explicit shutdown of ZMusic. Timidity++'s two buffers have been put in containers that self-destruct on shutdown and calling dumb_exit is not necessary because the only feature requiring it is not used by any code in the music library.
This was the last player class.
This code was also cleaned up for non-Windows systems where CD Audio is not implemented.
Instead of providing an empty implementation, all related code is now explicitly deactivated.
It is now being handled by the controlling code.
While of no benefit for GZDoom itself, this finally allows to separate the entire music code into a separate, engine independent project that merely provides streamed music data when not playing on a hardware device (WinMM Midi or CD Audio.)
The tight coupling of the music code with the sound backend made this nearly impossible before
This was getting a bit unwieldy. The include path setup is not perfect yet, that's work for later.
(It's about time we're getting C++20 with modules so that this include path madness can be put to an end.)
Also made the decode_vorbis function in DUMB a function pointer so that the library does not depend on high level code and can just ignore the vorbis case if no supported.
libraries/oplsynth/oplio.cpp:59:32: error: ‘memset’ was not declared in this scope
src/sound/mididevices/midi_cvars.cpp:43:31: error: expected initializer before ‘GetSystemDirectoryA’
libraries/wildmidi/file_io.cpp:68:40: error: use of undeclared identifier 'malloc'
libraries/wildmidi/wildmidi_lib.cpp:672:10: error: use of undeclared identifier 'stricmp'; did you mean 'strcmp'?
libraries/wildmidi/wildmidi_lib.cpp:1011:11: error: use of undeclared identifier 'strnicmp'; did you mean 'strncmp'?
libraries/timidity/instrum_dls.cpp:1071:18: error: ‘INT_MIN’ was not declared in this scope
libraries/timidity/instrum_font.cpp:37:47: error: ‘stricmp’ was not declared in this scope
libraries/timidity/timidity.cpp:207:32: error: ‘strcmp’ was not declared in this scope
libraries/timidity/timidity.cpp:235:24: error: ‘strcmp’ was not declared in this scope
libraries/timidity/timidity.cpp:310:33: error: ‘strchr’ was not declared in this scope
libraries/timidity/timidity.cpp:515:30: error: ‘strchr’ was not declared in this scope
libraries/timidity/timidity.cpp:602:34: error: ‘memset’ was not declared in this scope
libraries/timidity/timidity.cpp:648:35: error: ‘memcpy’ was not declared in this scope
libraries/timidity/timidity.cpp:753:41: error: ‘memset’ was not declared in this scope
The organization here is now the same as for the Timidity++ device, i.e. it is the device owning the instruments to give better control over their lifecycle.
This is to improve compile times because the MSVC compiler tends to become slow with large lists of source files in a single project.
This new project is still our stripped down copy of libadl, not the original, because that project contains a large amount of baggage we do not need.