Commit graph

136 commits

Author SHA1 Message Date
Christoph Oelckers
8898448014 - refactored the MIDI list code.
Let's hope nothing got broken on the Linux side, the recent submission's code was not usable.
2020-01-02 14:21:26 +01:00
Christoph Oelckers
f442d2dc54 - made the sound decoding interface DLL friendly and added compile switches to the MIDI players so that different licenses can be uses as compile target. 2020-01-02 12:43:37 +01:00
Christoph Oelckers
77a20ea7d1 - forgot to save this one. 2020-01-02 08:47:03 +01:00
Christoph Oelckers
71cd4ef488 Merge branch 'master' of https://github.com/coelckers/gzdoom
# Conflicts:
#	libraries/zmusic/zmusic/mididefs.h
#	libraries/zmusic/zmusic/zmusic.h
2020-01-02 08:45:48 +01:00
Petr Mrázek
ea1b8de405 - Support for MIDI on Linux via alsa sequencer 2020-01-02 08:29:39 +01:00
Christoph Oelckers
d2ca1ea4e0 - rewrote the ZMusic interface so that it is free of C++ constructs.
Now it is ready to put in a DLL.
2020-01-02 01:26:01 +01:00
Christoph Oelckers
0d000344ca - replaced the C++ based file access wrapper in ZMusic with a C compatible version. 2020-01-01 22:54:27 +01:00
Christoph Oelckers
527fb40a5f - there's no need to let the XM Vorbis decoder run through the client - all related functionality is part of ZMusic itself. 2020-01-01 20:58:15 +01:00
Christoph Oelckers
47d70c839d - made adjustments to the remaining parts of the function interface. 2020-01-01 20:47:33 +01:00
Christoph Oelckers
7923d25cce - made the ZMusic interface more DLL friendly: Reworked all functions not to throw exceptions across the library boundary and made a few definitions internal.
Not complete yet.
2020-01-01 20:01:38 +01:00
Christoph Oelckers
c24f9b42ba - the timidity safe_malloc functions may not throw exceptions.
There is a high chance of them getting called within the stream servicing function which cannot deal with abnormal conditions, so the only choice here is performing a hard abort.
2020-01-01 17:34:37 +01:00
Christoph Oelckers
fe0a6b00ce - blocked the destructor in the sound font reader base class.
If ZMusic is to act like an external library it may not call delete on external objects because there is no guarantee that they use the same allocator. Deletion must be done as a virtual function to ensure that the correct operator delete gets called, which, unlike the actual destructor is not virtual itself.
2020-01-01 16:11:39 +01:00
Christoph Oelckers
0ee0034beb - apply the ZMusic mutex a bit more finely grained.
It should only guard the critical parts, like calling Stop() but can let Update and IsPlaying method work unhindered otherwise.
2019-10-20 16:16:40 +02:00
alexey.lysiuk
1deade93cf - fixed playback of gzip compressed music
https://forum.zdoom.org/viewtopic.php?t=66157
2019-10-19 11:40:01 +03:00
alexey.lysiuk
230da2e2b9 - fixed SPC music looping after update to GME 0.6.2
Why was the default player setup changed at all?

https://forum.zdoom.org/viewtopic.php?t=65863
2019-10-18 10:25:24 +03:00
alexey.lysiuk
50a876906e - added declarations missing from update to GME 0.6.2 2019-10-18 10:22:35 +03:00
Christoph Oelckers
4d8f0fc014 - fixed: ZMusic_Close may not lock the mutex because it will delete it.
Here the calling code must ensure that the music object won't be accessible anymore before it gets deleted.
2019-10-15 01:16:02 +02:00
Christoph Oelckers
6854a509e9 - Moved all music related synchronization to the top level
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
2019-10-15 00:49:40 +02:00
Christoph Oelckers
dc32c2148a - ZMusic interface refactoring.
Use global functions instead of the class interface which exposed too many implementation details.
2019-10-15 00:23:03 +02:00
alexey.lysiuk
5851de9e0c - added dynamic loading of FluidSynth 2.x 2019-10-13 10:09:51 +03:00
alexey.lysiuk
09dcb247cf - return null instead of throwing exception if CD playback isn't supported
The game should switching to MIDI music on platforms without CD playback support
It was impossible to start Hexen on platforms other than Windows
2019-10-12 09:57:58 +03:00
Christoph Oelckers
18464d571d Merge branch 'exit_cleanup' 2019-10-07 20:35:15 +02:00
Christoph Oelckers
523fd0bf3a Revert "AsmJit update"
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.
2019-10-07 20:34:55 +02:00
alexey.lysiuk
53949e05f3 - handled differences of values returned by fluid_settings_...() functions
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
2019-10-07 12:32:40 +03:00
alexey.lysiuk
59f649700f - fixed setting of FluidSynth reverb and chorus 2019-10-07 12:20:56 +03:00
alexey.lysiuk
d7289f6469 - fixed compilation with old versions of Xcode
libraries/zmusic/mididevices/music_fluidsynth_mididevice.cpp:628:3: error: use of undeclared identifier 'free'
2019-10-06 14:28:49 +03:00
alexey.lysiuk
b02ef69d49 - cleaned POSIX compiler arguments for libraries
Removed omission of frame pointers as it makes crash reports much less useful
Modified warning flags to hide annoying reports for external code
2019-10-05 15:02:10 +03:00
alexey.lysiuk
46270326be - implemented str(n)icmp function definitions via CMake macro 2019-10-05 14:47:36 +03:00
alexey.lysiuk
c09f196141 - applied fast math flags to C and C++ files
Avoid copy-paste using CMake macro
2019-10-05 14:41:21 +03:00
alexey.lysiuk
ace677b8a3 - fixed: soundfont selection for FluidSynth was ignored 2019-10-05 11:23:46 +03:00
alexey.lysiuk
7780f774f9 - fixed: mode argument was ignored by utf8_fopen() on POSIX platforms 2019-10-05 11:02:19 +03:00
alexey.lysiuk
1d9b5cb239 - restored ability to link with thirdparty sound libraries explicitly
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
2019-10-03 12:22:46 +03:00
Christoph Oelckers
d2c156224b - cleanup of the sound init/exit code.
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.
2019-10-01 20:04:46 +02:00
Christoph Oelckers
86ab366958 - some reformatting on exit code, mainly to make searching for the content easier. 2019-10-01 19:06:28 +02:00
alexey.lysiuk
8ff51ca129 - fixed build issues with POSIX targets 2019-10-01 12:06:24 +03:00
Christoph Oelckers
9bb8da2533 - fixed the CDDA check to not catch all RIFF files. 2019-09-30 19:57:47 +02:00
Christoph Oelckers
a76cdd0946 - fixed crash with non-looping music ending.
In this case it was the song terminating the stream, with the new setup the main music code has to do this itself.
2019-09-30 19:41:03 +02:00
Christoph Oelckers
83e8e5535d - fixed compilation on Windows. 2019-09-30 18:21:34 +02:00
Christoph Oelckers
2bc72f38cc - renamed a few functions in the public interface of ZMusic. 2019-09-30 02:40:22 +02:00
Christoph Oelckers
02507effe8 - moved the music loader code to ZMusic.
This was the final piece of code reorganization.

What's left is cleaning up the interface.
2019-09-30 02:35:47 +02:00
Christoph Oelckers
c42deda6e6 - cleanup of the remaining music code in the main project 2019-09-30 02:31:12 +02:00
Christoph Oelckers
d0cf21654e - moved the CD Audio code to ZMusic, too.
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.
2019-09-30 02:22:53 +02:00
Christoph Oelckers
352365189f - moved the main music classes to ZMusic
What's left is the CD-Audio playback and some global functions.
2019-09-30 02:10:00 +02:00
Christoph Oelckers
6bfa1bf692 - fixed compilation with XCode and silenced several warnings 2019-09-30 01:51:53 +02:00
Christoph Oelckers
2c33e47988 - hooked up a few more CVARs and other values the music backend needs to know about and moved the MusInfo base class into zmusic. 2019-09-30 01:34:16 +02:00
Christoph Oelckers
7c27cd0c57 - moved the sound system's sound stream for the music out of the song objects.
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
2019-09-30 00:02:31 +02:00
Christoph Oelckers
44a6b6e87c - moved all configuration code to zmusic project.
The CVARs are now just getting forwarded without any own logic.
2019-09-29 22:01:19 +02:00
Christoph Oelckers
b7b57b904d - first state of music configuration refactor. 2019-09-29 20:01:57 +02:00
Christoph Oelckers
6d7b6fb9fd - moved MIDI format detection and source creation into zmusic project. 2019-09-29 14:47:10 +02:00
Christoph Oelckers
54b994e863 - configuration key enums. Not used yet. 2019-09-29 14:13:01 +02:00
Christoph Oelckers
859028b35a - moved the stream sources to zmusic project. 2019-09-29 13:33:09 +02:00
Christoph Oelckers
247346e821 - removed ZDoom dependencies from music_libsndfile.cpp 2019-09-29 13:06:40 +02:00
Christoph Oelckers
cdf2a17c5a - moved the sound decoding code to the zmusic project.
Since this gets used by both the sound backend and the music code it needs to be in a place accessible to both.
2019-09-29 12:48:12 +02:00
Christoph Oelckers
dbabc3c0f6 - ... and the raw OPL format. 2019-09-29 01:31:42 +02:00
Christoph Oelckers
5eed3dab59 - dependency cleanup in music_dumb.cpp. 2019-09-29 00:41:13 +02:00
Christoph Oelckers
7468c0f36d - consolidated the different file access interfaces in the backends into one shared version.
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.)
2019-09-28 23:17:16 +02:00
Christoph Oelckers
d94b63b486 - uncoupled the stream sources from the low level implementation. The entire setup had the stream sources depend on the SoundStream class, severely limiting reusability. This was changed that there is one SoundStream class that uses the StreamSources as mere data source that has no knowledge and no connection to the underlying system, similar to how the MIDI system works. With this there are only 3 top level music classes left - MIDIStreamer, StreamSong and CDSong.
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.
2019-09-28 21:04:41 +02:00
Christoph Oelckers
cfe89ef6e6 - created a new zmusic library which will eventually contain all the music playback code.
Currently all it contains are the MIDI sources and the MIDI devices, the rest needs to be reworked first.
2019-09-28 18:32:25 +02:00
Christoph Oelckers
fc6eba0c26 - more dependency removal, this time from the MIDI devices. 2019-09-28 16:50:00 +02:00
Christoph Oelckers
c5f2578ff5 Merge branch 'midi_work_2' 2019-09-28 00:11:54 +02:00
Christoph Oelckers
890db1fbf9 - Timidity++ done. 2019-09-27 22:19:00 +02:00
Christoph Oelckers
9aecabc887 - moved the last static variable - def_inst_name into the Instruments class.
With this the GUS device should be fully reentrant.
2019-09-27 20:40:19 +02:00
Christoph Oelckers
98a4a77f6b - took make_release_only off those subprojects which contain code that still need debugging on occasion.
For these performance on debug builds doesn't really matter anyway.
2019-09-27 19:43:32 +02:00
alexey.lysiuk
b5e1656c8e - fixed compilation on Linux
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’
2019-09-27 10:21:11 +03:00
Christoph Oelckers
315e15c7f0 - fixed compilation on XCode and silenced several warnings in the music code 2019-09-27 01:42:56 +02:00
Christoph Oelckers
d3df422031 - made the OPL synth backend a separate library. 2019-09-26 20:06:39 +02:00
Christoph Oelckers
159b98ea88 - gave the Timidity error functions better names and hooked up the WildMidi version. 2019-09-26 17:22:54 +02:00
alexey.lysiuk
cb444d3ae3 - fixed compilation with GCC and Clang
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'?
2019-09-26 10:28:34 +03:00
Christoph Oelckers
4ba8da290c - made WildMidi a library. 2019-09-25 19:38:48 +02:00
Christoph Oelckers
a562d69ec3 Merge branch 'wildmidi_cleanup' 2019-09-25 19:21:12 +02:00
Christoph Oelckers
1112a69adb - fixed a few Timidity warnings 2019-09-25 17:26:19 +02:00
alexey.lysiuk
dffcefbfdf - fixed compilation with GCC and Clang
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
2019-09-25 12:07:39 +03:00
Christoph Oelckers
7962bf189e - made the Timidity(GUS) device a separate library. 2019-09-24 23:43:44 +02:00
Christoph Oelckers
d557f609cf - cleanup of the TimidityMIDIDevice(GUS) backend code to eliminate the storage in global variables and to remove the dependencies on core ZDoom code.
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.
2019-09-24 23:08:56 +02:00
alexey.lysiuk
40f01b418f - explicit use of C++11 standard for TiMidity++
This fixes compilation with older GCC and Clang
2019-09-24 11:57:40 +03:00
Marisa Kirisame
7f697348b1 Add string.h includes where needed. Fixes Linux builds. 2019-09-23 17:37:05 +02:00
Christoph Oelckers
05ab859765 - ported the CMake fix to TimidityPlus as well. 2019-09-23 15:22:28 +02:00
Christoph Oelckers
66c9f0902b Merge commit '115d1cb182168bb2c8c29a3650dfc33b08e3e6cb' 2019-09-23 15:21:43 +02:00
Christoph Oelckers
115d1cb182 - made the Timidity++ backend a library, now that it has no dependencies on GZDoom anymore. 2019-09-23 14:27:43 +02:00
alexey.lysiuk
86e8d4711d - fixed compilation with GCC and Clang
'fatal error: no input files' and '-ffast-math: not found'
2019-09-23 12:25:30 +03:00
Christoph Oelckers
b3a9884eb1 - gave libopen the same treatment and made it its own subproject 2019-09-23 10:03:18 +02:00
Christoph Oelckers
84cc7cbdd2 - made libadl its own library subproject.
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.
2019-09-23 10:03:17 +02:00
Vitaly Novichkov
1a070d12a1 GME update with bug-fixes
- True fix for infinite loops [please verify!]
- True fix for KSS silence
- Fix for HES distorted and unstable/random tempo
2019-08-25 15:38:39 +03:00
Petr Kobalicek
747b3dfcfe AsmJit update 2019-08-19 21:02:36 +02:00
alexey.lysiuk
05cae50612 - updated bzip2 to version 1.0.8
https://www.sourceware.org/bzip2/
https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
2019-07-28 11:53:32 +03:00
Christoph Oelckers
ed6ab39b2d - moved third party library projects to a subfolder to reduce size of the root. 2019-07-14 15:06:54 +02:00