Commit graph

746 commits

Author SHA1 Message Date
Christoph Oelckers
4978d979e8 - fixed Windows version of snd_mididevice.
- removed mus2mis and xmi2mid converters from OPNMidi, because they are not needed.
- moved the data file for OPNMidi into gzdoom.pk3.
2018-03-24 18:29:12 +01:00
Christoph Oelckers
8aeb6531be Merge branch 'opnMIDI' of https://github.com/Wohlstand/gzdoom into opnmidi 2018-03-24 17:10:50 +01:00
Vitaly Novichkov
6308fb311b Added support for libOPNMIDI Playing device 2018-03-24 17:58:47 +03:00
Vitaly Novichkov
46942cb27f Added libOPNMIDI sources 2018-03-24 17:52:52 +03:00
alexey.lysiuk
a4bee610b4 Added runtime warning about usage of unsupported OpenAL implementation
https://forum.zdoom.org/viewtopic.php?t=59920
2018-03-24 15:00:36 +02:00
alexey.lysiuk
c4b3dcf266 Fixed indent of OpenAL initialization messages
Tab characters should not be used for indenting messages in console
2018-03-24 14:53:47 +02:00
alexey.lysiuk
40bf8a421e User's OpenAL library has precedence over Apple's framework
https://forum.zdoom.org/viewtopic.php?t=59920
2018-03-24 12:09:23 +02:00
Vitaly Novichkov
4f104b0da9 Fixed incorrect pitch processing in the ADLMIDI 2018-03-23 00:35:20 +01:00
Rachael Alexanderson
0893f0c01e Merge remote-tracking branch 'origin/master' into adlMIDI 2018-03-22 14:28:54 -04:00
Vitaly Novichkov
4481ebbdd2 Fixed an incorrect ADLMIDI playback
As DMX uses both 10'th and 16'th channels for percussions, I'll turn a 16'th channel into percussive by XG way on every init/reset.
2018-03-22 04:30:10 -04:00
alexey.lysiuk
d58169f1b0 Fixed crash with very short music loop
https://forum.zdoom.org/viewtopic.php?t=59883
2018-03-21 12:28:12 +02:00
alexey.lysiuk
f242f0631b Fixed crash in when MP3 length guesstimation failed
https://forum.zdoom.org/viewtopic.php?t=59881
2018-03-20 18:01:35 +02:00
raa-eruanna
251f0c8459 - add one more missing include to make GCC happy 2018-03-12 22:39:50 -04:00
Marisa Kirisame
fb5eae8aaa Added some missing zlib.h and stdint.h includes 2018-03-12 21:06:03 -04:00
Christoph Oelckers
5fccdd9acd - added missing return to translation code.
- a bit of header cleanup.

* moved <zlib.h> and <bzlib.h> from files.h to files_decompress.cpp because they are no longer needed for defining the interface.
* added <functional> to the precompiled header
2018-03-12 21:18:11 +01:00
Christoph Oelckers
73248e7f86 - added a missing nullptr check in Instruments::free_soundfonts() 2018-03-12 18:55:05 +01:00
Christoph Oelckers
b939836846 - renamed FileRdr back to FileReader. 2018-03-11 19:29:37 +01:00
Christoph Oelckers
0be1ed252b - rewrote the operator>> methods of FileReader as normal functions for clarity. 2018-03-11 18:20:49 +01:00
Christoph Oelckers
833dbee167 - fixed some issues with m_swap's design.
The native byte order converters were defined as macros which hid some issues due to lack of type checks.
Additionally the ???Long variants taking 'long' variables were removed, because longs are not always 32 bits so this could be destructive.
As a result of this, removed several DWORDs from struct definitions in i_crash.cpp.
2018-03-11 14:35:36 +01:00
Christoph Oelckers
8bbfd39f42 - fixed some remaining issues:
* initial positioning in a subsection of a file failed. This mainly affected music playback.
* made the FileRdr constructor which takes a FileReaderInterface private so that everything that needs it must be explicitly declared as friend.
* removed a few redundant construction initializers for FileRdrs.
* loading compressed nodes needs to check the validity of its reader.
* use GetLength to detemine the size of a Zip file instead of doing another seek to the end.
* removed duplicate Length variables.
2018-03-11 13:26:30 +01:00
Christoph Oelckers
b14ee50d0d - transition to new FileReader interface complete, but untested. 2018-03-11 12:33:46 +01:00
Christoph Oelckers
6f8ca2eace - fixed a few issues from implicit FileReader conversion. 2018-03-10 20:47:17 +01:00
Christoph Oelckers
b315bc3be0 - added a few more FileRdr replacements
- fixed: The streaming music player must return the file reader if it fails to open, so that the next player can still use it.
- fixed: Timidity++'s Instruments class did not delete the sound font when it was destroyed.

..-
2018-03-10 20:33:49 +01:00
Christoph Oelckers
56991a9ace - Removed FileReader from SoundFont manager.
- renamed close_file to tf_close for consistency.
2018-03-10 20:10:17 +01:00
Christoph Oelckers
5fa63c396d - sound code and most of texture code converted to FileRdr.
This allowed to remove a lot of bad pointer voodoo in the music loader, because the new class does not allow duplication of the reader object
2018-03-10 18:45:11 +01:00
Christoph Oelckers
26e948357e - added an abstract FileReader wrapper.
The idea here is to decouple the actual reader creation from the code using them so that, for example, the Open function can decide if it wants to open the file regularly or memory mapped and return different readers as deemed useful. For that to work the exposed object needs to be an abstract wrapper so that this can be done without having to use pointers and all the drawbacks coming from that.
So far put to use in a few parts of the music code so the general functionality could be tested.
2018-03-10 13:46:35 +01:00
alexey.lysiuk
7f17121df8 Fixed crash in MIDI to wave writer 2018-03-08 11:38:02 +02:00
alexey.lysiuk
cea64ea092 Moved old Nuked and Java OPL3 to own namespaces
This helps to avoid clashing of OPL3 classes
2018-03-08 10:18:49 +02:00
alexey.lysiuk
114e56b334 Moved old NukedOPL to own namespace
This fixes linking issues on non-MSVC targets and improves code navigation
2018-03-08 09:51:37 +02:00
Christoph Oelckers
2d2d44baad - integrated ADL as a proper device in the MIDI device list.
- resorted the MIDI device menu option by device types (i.e. all SW synths first, FM synths second)
- allow setting the ADL bank.
2018-03-07 21:20:25 +01:00
Christoph Oelckers
fd801b8b94 Merge branch 'adlMIDI'
# Conflicts:
#	src/sound/musicformats/music_midistream.cpp
2018-03-07 20:31:32 +01:00
Christoph Oelckers
9b61ee9618 - fixed: The MIDI wave writer set the sample rate to save at too late.
This was done after the players had already been created. To ensure that everything gets set properly it is necessary to pass the desired sample rate to the device's constructor and let it make sure that a proper sample rate gets set.
2018-03-06 22:41:27 +01:00
Christoph Oelckers
4d4edcfbfb - fixed setup for Timidity++ playback frequency. 2018-03-06 19:52:29 +01:00
alexey.lysiuk
77e1a1d289 Replaced usages of fluid_settings_getstr() function
This function is deprecated since FluidSynth 1.1.9 and removed in upcoming 2.x
2018-03-05 12:31:50 +02:00
alexey.lysiuk
d0ec6ef1d4 TiMidity++ now loads SF2 soundfont with spaces in path 2018-03-04 13:09:29 +02:00
alexey.lysiuk
8145b52037 Added explicit fallback to default soundfont
With no soundfonts found the game crashed on startup
Local UNIX build had the same issue because $PROGDIR/soundfonts is not in search path
2018-03-03 15:17:30 +02:00
Christoph Oelckers
e1bb14803e - print an error message if the requested MIDI device cannot be started.
This will only be done the first time a given setup fails. Repeated messages will be muted.
2018-03-03 08:52:25 +01:00
Christoph Oelckers
4c0f68bcd4 Merge branch 'master' into timidity++
# Conflicts:
#	src/sound/musicformats/music_midistream.cpp
2018-03-02 00:08:12 +01:00
Christoph Oelckers
4ccbc4ea9e - Send a GM reset SYSEX event when music playback is started. 2018-02-28 09:46:28 +01:00
Christoph Oelckers
eb124f6160 - made the sound font loading a bit more error resistant.
- implemented a fallback both for sound font lookup and for MIDI device selection so that if some non-working combination is set up, the player will fall back to something that works.
2018-02-26 16:36:30 +01:00
alexey.lysiuk
6bc2be1ca4 Fixed GCC 6+ compilation error
In file included from /usr/include/c++/6/math.h:36:0,
                 from src/vectors.h:43,
                 from src/sound/i_soundinternal.h:7,
                 from src/sound/i_sound.h:39,
                 from src/sound/i_musicinterns.h:5,
                 from src/sound/timidity/timidity.cpp:36:
/usr/include/c++/6/cmath:407:11: error: ‘::pow’ has not been declared
2018-02-26 14:46:24 +02:00
alexey.lysiuk
22819e640a Fixed GCC 4.9 compilation error
src/sound/timiditypp/instrum.cpp:45:26: error: array used as initializer
2018-02-26 14:00:29 +02:00
alexey.lysiuk
4fdf488960 Fixed MSVC compilation warning
VC\include\type_traits(1468): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\musicformats\music_midistream.cpp(832): note: see reference to function template instantiation 'std::function<bool (int)>::function<MIDIStreamer::SetMIDISource::<lambda_...>,int,void>(_Fx)' being compiled
2018-02-26 13:22:36 +02:00
alexey.lysiuk
14802c0547 Fixed GCC compilation error
src/sound/timiditypp/reverb.h:467:6: error: declaration of ‘TimidityPlus::lfo TimidityPlus::<anonymous struct>::lfo’ [-fpermissive]
src/sound/timiditypp/reverb.h:61:8: error: changes meaning of ‘lfo’ from ‘struct TimidityPlus::lfo’ [-fpermissive]
2018-02-26 13:10:32 +02:00
Christoph Oelckers
f405d630df - Redid CVar synchronization for Timidity++. 2018-02-26 09:55:04 +01:00
Christoph Oelckers
47dbbeb65a Revert "- don't let the Timidity++ player directly access the CVARs."
This reverts commit 8f7a503561.

# Conflicts:
#	src/sound/timiditypp/playmidi.cpp

Something in here wasn't working as intended, and since it needs better synchronization let's redo it entirely.
2018-02-26 09:19:10 +01:00
Christoph Oelckers
36e8358763 - use submenus for soundfont selection both for better overview and avoiding a music restart for each selection change. 2018-02-26 08:52:40 +01:00
Christoph Oelckers
67a6ec01e1 - added a separate section for soundfont search paths. 2018-02-25 09:32:05 +01:00
Christoph Oelckers
2ac101fa51 - removed tmpfileplus, which was only used by the old Timidity++ player. 2018-02-24 23:01:55 +01:00
Christoph Oelckers
8f7a503561 - don't let the Timidity++ player directly access the CVARs.
This may cause problems because the player runs in a different thread than the input code.
Instead the play thread will now copy their values to local variables when it starts generating output.
2018-02-24 19:36:09 +01:00
Christoph Oelckers
27f9330c81 - reimplemented thr OPL dumoer for MIDI. 2018-02-24 18:55:42 +01:00
Christoph Oelckers
a5316c211d - Moved the MIDI WAVE writer device to its own source file. 2018-02-24 18:25:04 +01:00
Christoph Oelckers
2202a52840 - made the MIDI to WAVE dumper functional again, including the option of choosing the MIDI synth and sound font with which it should be rendered. 2018-02-24 18:19:27 +01:00
Christoph Oelckers
786f1b34be - did not save everything. 2018-02-24 13:33:28 +01:00
Christoph Oelckers
6e913bb032 - Timidity CVAR cleanup and removal of the more obscure options. 2018-02-24 13:06:17 +01:00
Christoph Oelckers
b1313d533a - changing reverb mode must reallocate the buffers because they are mode-dependent. 2018-02-24 12:41:16 +01:00
Christoph Oelckers
fa8cfa65c0 - fixed incomplete initialization of the chorus data. 2018-02-24 12:30:19 +01:00
Christoph Oelckers
88328b056d - removed 'register' keyword from reverb.cpp. 2018-02-23 22:01:00 +01:00
Christoph Oelckers
7a851fd3f1 libADL MIDI test. It sounds awful so obviously there's still something wrong here. Definitely not usable yet. 2018-02-23 21:56:34 +01:00
Christoph Oelckers
39f26028aa - reworked the advanced sound menu to take advantage of the new soundfont handling.
The text input field for the configs have been removed. Instead it will now present a list of soundfonts that are found in specific locations.
For that it will look in the 'soundfont' directories of the FileSearch.Directories entry of the config.
Acceptable file formats here are SF2 and zipped GUS patch sets. These zipped patch sets need to have a timidity.cfg at the root and refer to all containing data by relative path. References to outside files are not allowed here.
It is still possible to refer to sound fonts elsewhere on the hard drive by manually entering a path at the console - but these won't show in the menu and will get lost if one cycles through the list of available options.
Of the available softsynths, FluidSynth will only list SF", Wildmidi will only list GUS patch sets and Timidity++ and GUS will list both.

Please note that although the GUS synth can read SF2, the output appears to be broken die to some old bug.
2018-02-23 19:23:39 +01:00
Christoph Oelckers
5da1433c57 - fixed a memory leak and removed debug output. 2018-02-23 18:57:30 +01:00
Christoph Oelckers
88f9f0982c - fixed Timidity++ playback. 2018-02-23 18:33:54 +01:00
Christoph Oelckers
4a179954b1 - removed Timidity_mastervolume CVAR. The reason why this was added got addressed at a lower level with the new code (i.e. the EXE's output was far too loud) and if there need to be adjustments to evening out the volume of the different MIDI synths it should be done in the data generation step, not as an added factor to the system volume of the track. 2018-02-23 17:27:36 +01:00
Christoph Oelckers
d25cc1baa0 - Fixed today's work now that I'm able to hear some sound again. Also some reorganization 2018-02-23 17:01:17 +01:00
Christoph Oelckers
ddedcd9fc2 Removed all conditional checks on HAVE_FLUIDSYNTH
With the current setup it makes zero sense to exclude it. This was all a remnant of its introduction when it couldn't be taken for granted.
2018-02-23 14:36:26 +01:00
Christoph Oelckers
adebd644f2 Rewroter 'writemidi' CCMD to work independently of the currently playing song's data.
The first benefit of separating the MIDI data sources from the playback classes. :)
2018-02-23 14:26:29 +01:00
Christoph Oelckers
16f17deb0f We no longer have a sound system that can handle music playback, so the code for it can go away. 2018-02-23 13:23:03 +01:00
Christoph Oelckers
9a1479ab08 Separate MIDI streamer and source creation in the high level code. 2018-02-23 13:20:07 +01:00
Christoph Oelckers
9aa1199902 Split the different MIDI format implementations into a separate 'Source' class.
This is necessary to write a universal, device independent wave dumper for MIDIs.
With each format inheriting from the main player class it is not possible to create a generic dumper player.
2018-02-23 12:40:43 +01:00
Christoph Oelckers
8734511e80 Removed PathExpander and PseudoMidiDevice which are no longer being used
PathExpander has been integrated into the sound font manager and PseudoMidiDevice was only used as the base class for the old Timidity++ device with the external executable.
2018-02-23 09:21:42 +01:00
Christoph Oelckers
aae832386f Fixed warnings in Timidity++ code emitted by XCode, except one which cannot be eliminatet without compromising the code. 2018-02-23 09:07:42 +01:00
Christoph Oelckers
6618656e7c Adjusted Timidity++ to soundfint manager 2018-02-23 08:54:01 +01:00
Christoph Oelckers
f9893a700a - fixed some warnings. 2018-02-23 01:01:18 +01:00
Christoph Oelckers
d6fe1fb39f - simplified the sound font manager a bit.
- allow the GUS to change sound fonts at run time.
- implemented sound font manager support in the GUS synth. This works but also made me realize that the SF2 support of this synth has been rather broken, apparently forever.
2018-02-23 00:48:03 +01:00
Christoph Oelckers
c12c068355 - WildMidi now uses the soundfont manager.
- added the missing handler for reading Timidity configs from the lump directory.
- fixed incomplete init of the GUS synth when no soundfont can be located.
- fixed bad initialization of WildMidi sampling frequency. It would default to 11.025 kHz if no valid rate was set. Now it will use the sound device's native frequency.
2018-02-22 22:35:49 +01:00
Christoph Oelckers
1361956072 - Soundfont manager works for FluidSynth. 2018-02-22 18:03:22 +01:00
Christoph Oelckers
8b8a7e5e45 - sfmanager gets initialized 2018-02-22 14:30:43 +01:00
Christoph Oelckers
504d68e2f8 All compile errors on Mac fixed. 2018-02-22 13:50:41 +01:00
Christoph Oelckers
04344505c0 Soundfont header 2018-02-22 13:42:12 +01:00
Christoph Oelckers
a6fa906764 Framework for context independent sounffont management
Not tested yet!
2018-02-22 12:51:45 +01:00
Christoph Oelckers
542d3431ff - Start of soundfont refactoring. This does not compile yet! 2018-02-22 07:21:19 +01:00
Christoph Oelckers
0688d53ea8 - allow reloading the sound font for the GUS device. 2018-02-21 23:38:04 +01:00
Christoph Oelckers
e84ec2978a - plugged the pending memory leaks. 2018-02-21 21:33:56 +01:00
Christoph Oelckers
5219916de5 - there's no need to drag the event time around, this really was just an artifact of Timidity's original implementation which is no longer in use.
- plugged a few memory leaks.
2018-02-21 21:11:31 +01:00
Christoph Oelckers
af705d1c59 - silenced a few pointless console messages generated by Timidity++. 2018-02-21 20:44:51 +01:00
Christoph Oelckers
af1de8ddc9 - removed volume testing output.
- final tweak to volume adjustment: Do this upon extraction for better results.

If this is done via the synth's parameters it will affect channel balance.
The given factor of 5 is necessary to roughly match the output of FluidSynth.
2018-02-21 20:12:37 +01:00
Christoph Oelckers
59352af486 - Volume tweaking. 2018-02-21 19:05:14 +01:00
Christoph Oelckers
e6bae25423 - Timidity++ is now fully integrated into the softsynth interface.
The only thing left to do is tweaking the volume of the output to match the one from the EXE.
2018-02-21 17:35:44 +01:00
Christoph Oelckers
445e9451cb - Added the long event handler for Timidity++.
This will be hard to test because there's basically no material out there using the features this implements.
2018-02-21 02:02:29 +01:00
Christoph Oelckers
4813eeeb85 - Timidity++ now plays ZDoom's event stream, although still through the Windows output module.
This also means that readmidi.cpp is no longer needed.
2018-02-21 01:29:39 +01:00
Christoph Oelckers
57967a1033 - safety commit. 2018-02-20 23:36:59 +01:00
Christoph Oelckers
cbcfea99cb - use the intended interface to pass some data to the player. 2018-02-20 21:52:45 +01:00
Christoph Oelckers
a8283ffdd6 - something can be heard.
This doesn't pipe the audio through OpenAL yet but the fundamentals for further progress are done.
2018-02-20 20:50:01 +01:00
Christoph Oelckers
5ce3b00b90 - commented out the noisy debug messages in Timidity++ so that they do not waste execution time and memory for nothing - there are almost 300 of them. 2018-02-20 19:45:37 +01:00
alexey.lysiuk
ff897997d6 Fixed hang when TiMidity++ executable failed to launch
https://forum.zdoom.org/viewtopic.php?t=59539
2018-02-20 12:20:18 +02:00
Christoph Oelckers
d72b87f469 - skeleton of new player class for Timidity++ - not tested yet. 2018-02-20 01:23:56 +01:00
Christoph Oelckers
803369fb8d - make CMake happy 2018-02-19 23:33:42 +01:00
Christoph Oelckers
06a1730b8a - hooking in the PathExpander. 2018-02-19 22:48:13 +01:00
Christoph Oelckers
576932c47f - Timidity++ sources added. This compiles but isn't hooked into the engine yet.
This source has been heavily edited to remove the deep integration with the provided UI modules and to eliminate use of global variables and puts everything into a small number of C++ classes.
2018-02-19 22:14:22 +01:00
alexey.lysiuk
05538f2de8 Fixed compilation warnings reported by MSVC
src\sound\musicformats\music_libsndfile.cpp(119): warning C4267: 'argument': conversion from 'size_t' to 'long', possible loss of data
src\sound\musicformats\music_libsndfile.cpp(139): warning C4267: 'argument': conversion from 'size_t' to 'long', possible loss of data
src\sound\musicformats\music_libsndfile.cpp(145): warning C4267: 'argument': conversion from 'size_t' to 'long', possible loss of data
src\sound\musicformats\music_libsndfile.cpp(167): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\musicformats\music_libsndfile.cpp(178): warning C4267: 'argument': conversion from 'size_t' to 'long', possible loss of data
src\sound\musicformats\music_libsndfile.cpp(240): warning C4267: 'argument': conversion from 'size_t' to 'long', possible loss of data
2018-02-19 12:28:24 +02:00