Commit graph

746 commits

Author SHA1 Message Date
Christoph Oelckers
e091369a38 - removed FCriticalSection and replaced all of its uses with std::mutex.
There's really no need for a non-standard solution here anymore with C++11.
This also fixes an unreleased lock in the WildMidi code.
2019-02-22 20:24:24 +01:00
Christoph Oelckers
868ac5adf8 - switched the Windows backend to use the Windows Unicode API.
With localization for non-Latin languages on the support list the multibyte API doesn't cut it anymore. It neither can handle system text output outside the local code page nor can an ANSI window receive text input outside its own code page.
Similar problems exist for file names. With the multibyte API it is impossible to handle any file containing characters outside the active local code page.

So as of now, everything that may pass along some Unicode text will use the Unicode API with some text conversion functions. The only places where calls to the multibyte API were left are those where known string literals are passed or where the information is not used for anything but comparing it to other return values from the same API.
2019-02-14 22:23:33 +01:00
Christoph Oelckers
979f1df281 Merge remote-tracking branch 'remotes/origin/master' into new_level_refactor
# Conflicts:
#	src/g_level.cpp
#	src/p_user.cpp
2019-02-05 13:49:07 +01:00
alexey.lysiuk
69492b1e27 - fixed ambient sounds "leaking" into reverb environment
Set speed of sound to 343.3 and init scale to 1 according to @kcat suggestion

https://forum.zdoom.org/viewtopic.php?t=63185
https://forum.zdoom.org/viewtopic.php?t=63524
2019-02-05 13:13:52 +02:00
alexey.lysiuk
e400137ffe - fixed compilation of Windows Debug targets
src\sound\mididevices\music_opl_mididevice.cpp(112): error C3861: 'I_DebugPrint': identifier not found
src\sound\mididevices\music_opl_mididevice.cpp(206): error C3861: 'I_DebugPrint': identifier not found
src\sound\mididevices\music_opl_mididevice.cpp(234): error C3861: 'I_DebugPrint': identifier not found
src\sound\mididevices\music_opl_mididevice.cpp(244): error C3861: 'I_DebugPrint': identifier not found
2019-02-01 10:09:36 +02:00
Christoph Oelckers
c77487dab8 - moved the menu.h include from oalsound.h to oalsound.cpp.
The menu is a very 'dirty' header, and forcing it to be pulled in with something entirely unrelated is not good - even though only two files include oalsound.h.
2019-01-31 19:44:04 +01:00
Christoph Oelckers
f6a91e1722 - moved the I_Error prototypes to doomerrors.h to avoid having to include the low level system header for this. 2019-01-31 19:38:04 +01:00
Christoph Oelckers
22939aade7 Merge branch 'master' into new_level_refactor
# Conflicts:
#	src/c_dispatch.cpp
2019-01-27 10:26:23 +01:00
Christoph Oelckers
39f53a4de0 - took the delayed console command execution out of the thinker management.
Doing this intermingled with the thinkers is highly unsafe because there are absolutely no guarantees about order of execution.
Effectively it ran these commands right in the middle of the playsim which could cause all sorts of synchronization issues, because CCMDs are part of the UI, not the playsim.

- pass a const string to AddCommandString.

This function manipulated the input buffer, leading to all sorts of code contortions to make sure that the passed parameter is clean for that.
This function will now create a copy of the passed parameter which it can manipulate without complicating its calling code.

# Conflicts:
#	src/c_dispatch.cpp
2019-01-27 10:24:49 +01:00
Christoph Oelckers
2623fbb54b - deleted unused mus2midi.cpp file. 2019-01-24 20:40:31 +01:00
Christoph Oelckers
1a3df8dfba - moved all shutdown handling for sound related resources to I_ShutdownSound instead of registering separate atterm handlers. 2018-12-19 09:39:06 +01:00
alexey.lysiuk
4a83f4d251 - disable music playback if WinMM stream cannot be opened
https://forum.zdoom.org/viewtopic.php?t=62888
2018-12-14 15:58:08 +02:00
Christoph Oelckers
a3265c2963 - more direct native entry points. 2018-12-04 23:12:16 +01:00
Christoph Oelckers
25ad71a113 - Changed a few allocations into usin TArrays
S_SoundCurve in particular looked like a candidate for leaking memory.
2018-11-30 17:07:42 +01:00
Christoph Oelckers
1ccbbcb81d - added a method to FileReader to read the contents into an array and used it on the MIDI sources for testing. 2018-11-02 10:20:12 +01:00
Christoph Oelckers
c5153ca095 - fixed: Do not pass Sysex messages to Windows's GS Wavetable synth.
This will totally refuse to play a MIDI if that happens.
Duke Nukem's Alienz.mid, which did not play before works after this change.
2018-11-01 10:22:21 +01:00
Vitaly Novichkov
59c8d8ff64 Upgrade libADLMIDI and libOPNMIDI
Added full-panning stereo, improvement of channel management, and many other things.

Also, I have implemented an ability to use custom WOPL (for libADLMIDI) and WOPN (for libOPNMIDI) banks from the same path as "soundfonts", but also, in the same environment, the "fm_banks" folder was added for WOPL/WOPN storing purposes.
To toggle usage of embedded or custom bank, I have added togglable booleans. When bank fails to be loaded, the default embedded bank is getting to be used as fallback.

ADLMIDI 1.4.0   2018-10-01
 * Implemented a full support for Portamento! (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * Added support for SysEx event handling! (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * Added support for GS way of custom drum channels (through SysEx events)
 * Ignore some NRPN events and lsb bank number when using GS standard (after catching of GS Reset SysEx call)
 * Added support for CC66-Sostenuto controller (Pedal hold of currently-pressed notes only while CC64 holds also all next notes)
 * Added support for CC67-SoftPedal controller (SoftPedal lowers the volume of notes played)
 * Fixed correctness of CMF files playing
 * Fixed unnecessary overuse of chip channels by blank notes
 * Added API to disable specific MIDI tracks or play one of MIDI tracks solo
 * Added support for more complex loop (loopStart=XX, loopEnd=0). Where XX - count of loops, or 0 - infinite. Nested loops are supported without of any limits.
 * Added working implementation of TMB's velocity offset
 * Added support for full-panning stereo option (Thanks to [Christopher Snowhill](https://github.com/kode54) for a work!)
 * Fixed inability to play high notes due physical tone frequency out of range on the OPL3 chip

OPNMIDI 1.4.0   2018-10-01
 * Implemented a full support for Portamento! (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * Added support for SysEx event handling! (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * Added support for GS way of custom drum channels (through SysEx events)
 * Ignore some NRPN events and lsb bank number when using GS standard (after catching of GS Reset SysEx call)
 * Added support for CC66-Sostenuto controller (Pedal hold of currently-pressed notes only while CC64 holds also all next notes)
 * Added support for CC67-SoftPedal controller (SoftPedal lowers the volume of notes played)
 * Resolved a trouble which sometimes makes a junk noise sound and unnecessary overuse of chip channels
 * Volume models support taken from libADLMIDI has been adapted to OPN2's chip speficis
 * Fixed inability to play high notes due physical tone frequency out of range on the OPN2 chip
 * Added support for full-panning stereo option

ADL&OPN Hotfix: re-calculated default banks
The fix on side of measurer of OPL3-BE and OPN2-BE where some instruments getting zero releasing time.
2018-10-04 08:58:47 -04:00
Christoph Oelckers
840c2c8958 - fixed warning in ADLMidi. 2018-06-24 10:48:04 +02:00
Vitaly Novichkov
a5b4d9d9a9 ADLMIDI: Fix one small MSVC Win64 warning 2018-06-22 17:30:51 +02:00
Vitaly Novichkov
ceec12056a Upgrade libADLMIDI and libOPNMIDI
Added ability to switch emulator and it's accuracy level ("enabling of 'run at PCM rate' reduces accuracy, and also reduces CPU usage")
Added draft code for future external banks support (WOPL format for ADLMIDI and WOPN format for OPNMIDI)

ADLMIDI 1.3.3   2018-06-19
 * Fixed an inability to load another custom bank without of library re-initialization
 * Optimizing the MIDI banks management system for MultiBanks (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * Fixed incorrect 4-op counter which is still catch 4-op instruments on 2-op banks
 * Fixed an incorrect processing of auto-flags
 * Fixed incorrect initial MIDI tempo when MIDI file doesn't includes the tempo event
 * Channel and Note Aftertouch features are now supported correctly! Aftertouch is the tremolo / vibrato, NOT A VOLUME!
 * Updated DosBox OPL3 emulator up to r4111 of official DosBox trunk (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * The automatical choosing of 4 operator channels count has been improved (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * Added optional HQ resampler for Nuked OPL3 emulators which does usage of Zita-Resampler library (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)

ADLMIDI 1.3.2   2018-04-24
 * Added ability to disable MUS and XMI converters
 * Added ability to disable embedded MIDI sequencer to use library as RealTime synthesizer only or use any custom MIDI sequencer plugins.
 * Fixed blank instruments fallback in multi-bank support. When using non-zero bank, if instrument is blank, then, instrument will be taken from a root (I.e. zero bank).
 * Added support for real-time switching the emulator
 * Added support for CC-120 - "All sound off" on the MIDI channel
 * Changed logic of CC-74 Brightness to affect sound only between 0 and 64 like real XG synthesizers. Ability to turn on a full-ranged brightness (to use full 0...127 range) is kept.
 * Added support for different output sample formats (PCM8, PCM8U, PCM16, PCM16U, PCM32, PCM32U, Float32, and Float64) (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * Reworked MIDI channels management to avoid any memory reallocations while music processing for a hard real time. (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)

OPNMIDI 1.3.0   2018-06-19
 * Optimizing the MIDI banks management system for MultiBanks (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * Fixed incorrect initial MIDI tempo when MIDI file doesn't includes the tempo event
 * Fixed an incorrect processing of auto-flags
 * MAME YM2612 now results a more accurate sound as internal using of native sample rate makes more correct sound generation
 * Channel and Note Aftertouch features are now supported correctly! Aftertouch is the tremolo / vibrato, NOT A VOLUME!
 * Added optional HQ resampler for Nuked OPL3 emulators which does usage of Zita-Resampler library (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)

OPNMIDI 1.2.0   2018-04-24
 * Added ability to disable MUS and XMI converters
 * Added ability to disable embedded MIDI sequencer to use library as RealTime synthesizer only or use any custom MIDI sequencer plugins.
 * Fixed blank instruments fallback in multi-bank support. When using non-zero bank, if instrument is blank, then, instrument will be taken from a root (I.e. zero bank).
 * Added support for real-time switching the emulator
 * Added support for MAME YM2612 Emulator
 * Added support for CC-120 - "All sound off" on the MIDI channel
 * Changed logic of CC-74 Brightness to affect sound only between 0 and 64 like real XG synthesizers. Ability to turn on a full-ranged brightness (to use full 0...127 range) is kept.
 * Added support for different output sample formats (PCM8, PCM8U, PCM16, PCM16U, PCM32, PCM32U, Float32, and Float64) (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
 * Reworked MIDI channels management to avoid any memory reallocations while music processing for a hard real time. (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
2018-06-22 17:30:51 +02:00
alexey.lysiuk
f17f8c9359 - added end line to various messages
so they don't screw up further output anymore
2018-05-11 18:03:57 +03:00
landfillbaby
ba9a340c1f fix highlighting in snd_listmididevices 2018-05-10 11:51:23 +03:00
Hisymak
583da7f6cf OPL Synth fix: Double-voice instruments randomly don't play second voice 2018-05-03 21:10:17 +02:00
Hisymak
07586af6d1 Fix OPL Synth note cutoffs and issues after removal of MusLib
This should fix bug reported in https://forum.zdoom.org/viewtopic.php?
f=104&t=56682.
There were two problems:
1. Algorithm to select a free voice was not appropriate. Changed to a
simple "least-recently-freed voice" algorithm.
2. Sustained voices were treated as used voices and never got replaced.
Now sustained voices are preferentially replaced when there are no free
voices.
2018-04-30 18:21:30 +02:00
alexey.lysiuk
2ae8d39441 Removed all superfluous #include's
Automatically optimized by CLion IDE with manual corrections
2018-04-24 14:30:35 +03:00
alexey.lysiuk
671736ecdc Disabled annoying MSVC 2015 warnings in ADL and OPN files
src\sound\adlmidi\adlmidi_private.hpp(457): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) (compiling source file src\sound\adlmidi\adlmidi.cpp)
src\sound\opnmidi\opnmidi_private.hpp(404): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) (compiling source file src\sound\opnmidi\opnmidi.cpp)
src\sound\adlmidi\adlmidi_private.hpp(457): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) (compiling source file src\sound\adlmidi\adlmidi_midiplay.cpp)
src\sound\adlmidi\adlmidi_private.hpp(457): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) (compiling source file src\sound\adlmidi\adlmidi_load.cpp)
src\sound\adlmidi\adlmidi_private.hpp(457): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) (compiling source file src\sound\adlmidi\adlmidi_private.cpp)
src\sound\adlmidi\adlmidi_private.hpp(457): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) (compiling source file src\sound\adlmidi\adlmidi_opl3.cpp)
src\sound\opnmidi\opnmidi.cpp(132): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\opnmidi\opnmidi.cpp(147): warning C4800: 'unsigned int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\adlmidi\adlmidi.cpp(168): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\adlmidi\adlmidi.cpp(177): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\adlmidi\adlmidi.cpp(186): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\adlmidi\adlmidi.cpp(195): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\adlmidi\adlmidi.cpp(209): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\adlmidi\adlmidi_midiplay.cpp(740): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\adlmidi\adlmidi_midiplay.cpp(741): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\adlmidi\adlmidi_midiplay.cpp(742): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\adlmidi\adlmidi_midiplay.cpp(743): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\opnmidi\opnmidi_private.hpp(404): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) (compiling source file src\sound\opnmidi\opnmidi_midiplay.cpp)
src\sound\opnmidi\opnmidi_private.hpp(404): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) (compiling source file src\sound\opnmidi\opnmidi_load.cpp)
src\sound\opnmidi\opnmidi_midiplay.cpp(697): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\opnmidi\opnmidi_midiplay.cpp(698): warning C4800: 'unsigned int': forcing value to bool 'true' or 'false' (performance warning)
src\sound\opnmidi\opnmidi_private.hpp(404): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) (compiling source file src\sound\opnmidi\opnmidi_opn2.cpp)
src\sound\opnmidi\opnmidi_private.hpp(404): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) (compiling source file src\sound\opnmidi\opnmidi_private.cpp)
2018-04-19 11:12:20 +03:00
Wohlstand
2d79d187d5 OPNMIDI: Remove std:: from all snprintf calls 2018-03-28 20:37:55 +03:00
Wohlstand
6a497a0b92 ADLMIDI: Update latest update of DMXOPL3 bank by @sneakernets
And a small polishing of bank names to keep the informative, but much shorter
2018-03-28 20:34:28 +03:00
Wohlstand
99e24efc2c ADLMIDI: Remove std:: from all snprintf-s 2018-03-28 20:33:02 +03:00
Vitaly Novichkov
38156b9243 ADL&OPL: Added a fallback for a blank instruments in GS/XG banks 2018-03-27 07:36:07 +02:00
Christoph Oelckers
3c3c2f03e8 The missing parts of last commit. 2018-03-26 20:44:25 +02:00
Christoph Oelckers
7c333b1fd1 - changed the default settings for fluid_patchset, timidity_config and midi_config to point to the default sound font.
wildmidi_config has not been changed because it cannot read .sf2 files.
2018-03-26 20:43:44 +02:00
Christoph Oelckers
c0893027da - added a band-aid fix in case Timidity has both chorus and reverb active.
This merely addresses the crashing issue, it does nothing about the faulty initialization logic here that causes the chorus not to get initialized properly if reverb is active.
The issue needs more in-detail investigation but for now this has to suffice.
2018-03-25 12:12:14 +02:00
Vitaly Novichkov
27b9b67d68 ADL&OPN: More setup: Chips count and Volume model!
Notes:
* ADL: The DMX volume model was set as default to unify volumes on all bank. Otherwise, if you will use 'Generic' or 'Win9x', the sound will became too loud than wanted. Each bank has own default volume model which is used when 'Auto' is set.
* ADL: 6 chips is optimal to work with default banks
* OPN: 8 chips are set to provide 48 polyphony channels. (each OPN2 chip has 6 channels only)
* Text files: junk spaces from end of lines are was auto-removed.
2018-03-25 08:14:35 +02:00
Vitaly Novichkov
79d7067f07 Fixed typo in the error message: it's YM2612 is OPN2 which is not OPL 2018-03-25 08:14:35 +02:00
Vitaly Novichkov
a60dc64e71 ADL&OPN: Fix long vs int64 conflict in 'CalcChGoodness' 2018-03-25 01:37:44 +03:00
Vitaly Novichkov
d202ef9e68 Merge branch 'master' of git@github.com:coelckers/gzdoom.git
# Conflicts:
#	src/sound/opnmidi/opnmidi_private.hpp
2018-03-25 00:41:11 +03:00
Vitaly Novichkov
15e133afb9 ADLMIDI & OPNMIDI: Little clean and MSVC warnings muting 2018-03-25 00:38:26 +03:00
Christoph Oelckers
73f9300c2b - disable MSVC warnings in OPNMidi. 2018-03-24 21:53:37 +01:00
Vitaly Novichkov
5acffa693f Merge branch 'master' of git@github.com:coelckers/gzdoom.git
# Conflicts:
#	src/sound/adlmidi/adlmidi.cpp
2018-03-24 23:51:36 +03:00
Vitaly Novichkov
be1b884a04 OPNMIDI: Natively disable embedded MUS and XMI, and MIDI sequencer 2018-03-24 23:46:05 +03:00
Vitaly Novichkov
0816018d36 ADLMIDI: Another warning fix 2018-03-24 23:33:39 +03:00
Christoph Oelckers
77a2101c06 - re-applied my changes to ADLMIDI code:
* disable sstream. No point pulling in such a large piece of code for two error messages.
* disable MSVC warnings which get emitted by the code.
2018-03-24 21:30:59 +01:00
Vitaly Novichkov
e31830e8be ADLMIDI: Tiny warning fix 2018-03-24 21:26:30 +01:00
Vitaly Novichkov
be81e00722 ADLMIDI: Added built-in ability to disable unneeded MUS and XMI converters
Also embedded MIDI sequencer has been disabled too as it is not needed in GZDoom

I made that to allow easier updates of ADLMIDI into newer versions without of any future troubles and conflicts
2018-03-24 21:26:30 +01:00
Vitaly Novichkov
c65a004e08 ADLMIDI: Tiny warning fix 2018-03-24 23:19:50 +03:00
Christoph Oelckers
4e012e3765 - fill in the ADL bank menu from the internal table. Some of the names had to be shortened to prevent it from getting too confusing. 2018-03-24 21:19:10 +01:00
Vitaly Novichkov
b6302f5fc9 ADLMIDI: Added built-in ability to disable unneeded MUS and XMI converters
Also embedded MIDI sequencer has been disabled too as it is not needed in GZDoom

I made that to allow easier updates of ADLMIDI into newer versions without of any future troubles and conflicts
2018-03-24 22:45:54 +03:00
Christoph Oelckers
49ab99a383 Merge branch 'master' of https://github.com/coelckers/gzdoom 2018-03-24 19:40:52 +01:00
Christoph Oelckers
b8f2d1fc06 - better CVAR control for Timidity++ reverb. 2018-03-24 19:40:39 +01:00