Commit graph

56 commits

Author SHA1 Message Date
alexey.lysiuk
42f732798d - fixed uninitialized variable in OPL song
Mono streams could be erroneously treated as stereo, doubling their playback speed

https://forum.zdoom.org/viewtopic.php?t=66939
2020-01-12 18:08:47 +01:00
drfrag
cb48b796a8 - Fixed compilation with MinGW. 2020-01-10 01:11:54 +01:00
Petr Mrázek
848438839b - Run the Alsa MIDI thread every 40ms or so, use non-blocking sequencer 2020-01-07 19:55:55 +01:00
Christoph Oelckers
1cf5ce6bab - fixed warnings. 2020-01-07 18:37:01 +01:00
Rachael Alexanderson
a085088893 - add EnumerateDevices for alsa per suggestion of the original author 2020-01-07 18:36:59 +01:00
Rachael Alexanderson
f67b217415 - fix compiler error with Alsa enumeration 2020-01-07 18:36:58 +01:00
Christoph Oelckers
ff3606e44e - refactored the MIDI list code.
Let's hope nothing got broken on the Linux side, the recent submission's code was not usable.

# Conflicts:
#	libraries/zmusic/zmusic/configuration.cpp
#	src/sound/music/i_music.cpp
#	src/sound/music/music_midi_base.cpp
2020-01-07 18:36:55 +01:00
Christoph Oelckers
dee8af1902 - 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.
# Conflicts:
#	src/sound/backend/i_sound.h

# Conflicts:
#	libraries/zmusic/mididevices/music_timiditypp_mididevice.cpp
2020-01-07 18:22:15 +01:00
Christoph Oelckers
b6577d9f55 - forgot to save this one. 2020-01-07 18:07:28 +01:00
Christoph Oelckers
e89cc73f80 - rewrote the ZMusic interface so that it is free of C++ constructs.
Now it is ready to put in a DLL.

# Conflicts:
#	libraries/zmusic/zmusic/mididefs.h
#	libraries/zmusic/zmusic/zmusic.h
2020-01-07 18:07:26 +01:00
Christoph Oelckers
f2a3a70aec - replaced the C++ based file access wrapper in ZMusic with a C compatible version. 2020-01-07 18:07:23 +01:00
Christoph Oelckers
7e01b19753 - there's no need to let the XM Vorbis decoder run through the client - all related functionality is part of ZMusic itself. 2020-01-07 18:07:21 +01:00
Christoph Oelckers
e5faff8cbb - made adjustments to the remaining parts of the function interface. 2020-01-07 18:07:19 +01:00
Christoph Oelckers
4e8359100f - 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.

# Conflicts:
#	libraries/zmusic/zmusic/zmusic.h
2020-01-07 18:07:17 +01:00
alexey.lysiuk
e1460eb050 - fixed crash during enumeration of MIDI devices
libraries/zmusic/zmusic/configuration.cpp:109:9: warning: returning reference to local temporary object [-Wreturn-stack-address]
2020-01-07 18:04:30 +01:00
Petr Mrázek
b07254507a - Support for MIDI on Linux via alsa sequencer 2020-01-07 18:04:28 +01:00
Christoph Oelckers
a92f71917a - 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.
2020-01-06 01:30:55 +01:00
Christoph Oelckers
5544e50ca4 - 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.
2020-01-06 01:30:47 +01:00
Christoph Oelckers
2498fbf2b7 - 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
2020-01-06 01:30:45 +01:00
Christoph Oelckers
6b098107ce - ZMusic interface refactoring.
Use global functions instead of the class interface which exposed too many implementation details.
2020-01-06 01:30:43 +01:00
alexey.lysiuk
baa613ff62 - added dynamic loading of FluidSynth 2.x 2020-01-06 01:11:20 +01:00
alexey.lysiuk
f144af949b - 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
2020-01-06 01:11:02 +01:00
alexey.lysiuk
fe76293f2d - 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
2020-01-05 21:09:31 +01:00
alexey.lysiuk
d7f0da033d - fixed setting of FluidSynth reverb and chorus 2020-01-05 21:09:29 +01:00
alexey.lysiuk
922eb28ca2 - fixed compilation with old versions of Xcode
libraries/zmusic/mididevices/music_fluidsynth_mididevice.cpp:628:3: error: use of undeclared identifier 'free'
2020-01-05 21:08:03 +01:00
alexey.lysiuk
9d49e33a80 - 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
2020-01-05 21:08:01 +01:00
alexey.lysiuk
4c099300ca - implemented str(n)icmp function definitions via CMake macro 2020-01-05 21:07:58 +01:00
alexey.lysiuk
aa8438cb45 - applied fast math flags to C and C++ files
Avoid copy-paste using CMake macro

# Conflicts:
#	CMakeLists.txt
#	libraries/glslang/OGLCompilersDLL/CMakeLists.txt
#	libraries/glslang/glslang/CMakeLists.txt
#	libraries/glslang/spirv/CMakeLists.txt
2020-01-05 21:07:36 +01:00
alexey.lysiuk
49b8bedc86 - fixed: soundfont selection for FluidSynth was ignored 2020-01-05 21:06:42 +01:00
alexey.lysiuk
a4930f9d8b - 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
2020-01-05 21:06:37 +01:00
Christoph Oelckers
89d7330ba9 - 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.
2020-01-05 21:04:09 +01:00
drfrag
731e11bd88 - Add libdl to ZMusic for linux targets, hope this fixes linking. 2020-01-05 14:44:54 +01:00
alexey.lysiuk
0c86fad217 - fixed build issues with POSIX targets 2020-01-05 14:44:01 +01:00
Christoph Oelckers
0888b0b0e7 - fixed the CDDA check to not catch all RIFF files. 2020-01-05 14:39:11 +01:00
Christoph Oelckers
7bd8abc074 - 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.
2020-01-05 14:39:09 +01:00
Christoph Oelckers
1616bc93a7 - fixed compilation on Windows.
# Conflicts:
#	libraries/zmusic/musicformats/win32/i_cd.cpp

# Conflicts:
#	libraries/zmusic/musicformats/win32/i_cd.cpp
2020-01-05 14:39:08 +01:00
Christoph Oelckers
ee4bf9670e - renamed a few functions in the public interface of ZMusic. 2020-01-05 14:39:03 +01:00
Christoph Oelckers
16212e946b - moved the music loader code to ZMusic.
This was the final piece of code reorganization.

What's left is cleaning up the interface.
2020-01-05 14:39:01 +01:00
Christoph Oelckers
09fe55d462 - cleanup of the remaining music code in the main project
# Conflicts:
#	src/menu/menudef.cpp
#	src/scripting/vmthunks.cpp

# Conflicts:
#	src/p_acs.cpp
2020-01-05 14:39:00 +01:00
Christoph Oelckers
d7db010217 - 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.

# Conflicts:
#	src/CMakeLists.txt
2020-01-05 14:38:27 +01:00
Christoph Oelckers
01de5a071b - moved the main music classes to ZMusic
What's left is the CD-Audio playback and some global functions.

# Conflicts:
#	src/CMakeLists.txt
2020-01-05 14:02:12 +01:00
Christoph Oelckers
cf16dc510a - fixed compilation with XCode and silenced several warnings 2020-01-05 13:38:07 +01:00
Christoph Oelckers
768a7bdd18 - hooked up a few more CVARs and other values the music backend needs to know about and moved the MusInfo base class into zmusic.
# Conflicts:
#	src/sound/musicformats/music_midistream.cpp
2020-01-05 13:37:50 +01:00
Christoph Oelckers
08d2ac0eee - 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
2020-01-05 12:56:39 +01:00
Christoph Oelckers
e76f590df8 - moved all configuration code to zmusic project.
The CVARs are now just getting forwarded without any own logic.
2020-01-05 12:56:30 +01:00
Christoph Oelckers
5d73f09ebf - first state of music configuration refactor.
# Conflicts:
#	src/sound/music/midi_cvars.cpp
2020-01-05 12:56:28 +01:00
Christoph Oelckers
eccff92420 - moved MIDI format detection and source creation into zmusic project. 2020-01-05 12:33:48 +01:00
Christoph Oelckers
4db555626f - configuration key enums. Not used yet. 2020-01-05 12:32:50 +01:00
Christoph Oelckers
531a5a8857 - moved the stream sources to zmusic project.
# Conflicts:
#	src/CMakeLists.txt
2020-01-05 12:32:47 +01:00
Christoph Oelckers
09993ca39b - removed ZDoom dependencies from music_libsndfile.cpp
# Conflicts:
#	src/sound/musicformats/music_libsndfile.cpp
2020-01-05 12:32:43 +01:00