Commit graph

987 commits

Author SHA1 Message Date
Christoph Oelckers
b18faacab0 - 2D drawer cleanup. 2020-04-11 20:20:58 +02:00
Christoph Oelckers
7b292cca57 - split the serializer in two to keep the Doom specific parts out of the main file. 2020-04-11 20:20:53 +02:00
Christoph Oelckers
f74efcf721 - split the TObjPtr serializers into a separate file to avoid polluting everything that needs to use the serializer.
To use these it is necessary to include dobject.h and all its dependencies, so this should not be done unless necessary.
2020-04-11 20:20:53 +02:00
Christoph Oelckers
f8ac9a2662 - moved DObject and core parts of the VM to 'common'.
# Conflicts:
#	src/common/objects/dobject.h
2020-04-11 20:20:51 +02:00
Christoph Oelckers
be24023722 - split animation management out of the texture manager into a separate class. 2020-04-11 20:20:36 +02:00
Christoph Oelckers
a13c7bd053 - moved sound code to "common". 2020-04-11 20:20:35 +02:00
Christoph Oelckers
018794f1dd - moved game specific data out of the sound backend.
In Raze I already had a user data array for that so this gets used here, too, now.
Also copied a few other fixes.
2020-04-11 20:20:35 +02:00
Christoph Oelckers
50e1efa965 - minor sound code cleanup
# Conflicts:
#	src/sound/backend/oalsound.cpp
2020-04-11 20:20:34 +02:00
Christoph Oelckers
cd9e2d3795 - moved music code to "common". 2020-04-11 20:19:55 +02:00
Christoph Oelckers
7d36af8840 - put things in their proper place. 2020-04-11 20:19:55 +02:00
Christoph Oelckers
00bbc48e70 - music.cpp include cleanup
- use a TMap to store music volume settings instead of using a homegrown linked list.
2020-04-11 20:19:54 +02:00
Christoph Oelckers
f0534afde6 - separated the game-dependent music lookup parts from the core player. 2020-04-11 20:19:54 +02:00
Christoph Oelckers
4af96bab47 - some cleanup on music code.
* change the license of the main file because there is no more id-based code here licensed under the GPL.
* moved VM interface definition out of the implementation.
* moved idmus CCMD out of implementation because it is dependent on Doom level definitions.
* moved s_music.cpp into the music folder with the rest of the music code.
2020-04-11 20:19:54 +02:00
Christoph Oelckers
4a50f78bfe - more work on console code. 2020-04-11 20:19:24 +02:00
alexey.lysiuk
0d420a75b7 - fixed compilation for Linux and macOS 2020-04-11 20:36:36 +03:00
Christoph Oelckers
c713850dac - moved sc_man and palettecontainer to the 'common' folder. 2020-04-11 14:00:21 +02:00
Christoph Oelckers
05d8856fe0 - moved file system implementation to 'common'. 2020-04-11 14:00:20 +02:00
Christoph Oelckers
80c6d5b276 - renamed more stuff and also moved the Strife teaser voice handling out of the file system. 2020-04-11 14:00:19 +02:00
Christoph Oelckers
c1bb7de23a - more file system refactoring.
* moved the sprite renaming out of the file system entirely into a caller-provided callback.
* renamed several functions to closer match the terms of a file system.
* moved the VM interface out of the implementation.
2020-04-11 14:00:19 +02:00
Christoph Oelckers
6bccde3b51 - renamed the file system related classes to actually use the term "FileSystem". 2020-04-11 14:00:18 +02:00
Christoph Oelckers
1574799683 - moved most parts of the Doom specific lump setup out of the file format implementations into the main class.
This is to keep as much higher level logic out of these as possible. The presentation of the data should be a concern of the file system, not the data containers.
2020-04-11 14:00:16 +02:00
Christoph Oelckers
9ef6b15bfa - moved more stuff and split FRandom in two so that the high level baggage does not need to be pulled in to use the RNG. 2020-04-11 14:00:14 +02:00
Christoph Oelckers
fb1a7679ec - moved most basic utility code without any dependencies on the rest of the engine to 'common' directory.
Again the objective is easier sharing with Raze.
2020-04-11 14:00:13 +02:00
Christoph Oelckers
ace3e29473 - removed the implicit conversion operators from FName.
These were creating dangerous interdependencies. It is better to do explicit conversions when needed.
As an added plus, this means that zstring.h no longer depends on name.h which was very annoying.
2020-04-11 14:00:13 +02:00
alexey.lysiuk
13e6ea7796 - added line break to 'No GENMIDI lump' message
'ST_Init: Init startup screen.' is no longer concatenated with the given line
2020-03-13 13:33:11 +02:00
Rachael Alexanderson
178cf40428 - fix debug assertion, cleanup vestigial A_PlaySound addition 2020-03-03 22:50:01 -05:00
Rachael Alexanderson
5dfdac62ab - add checking in S_StartSound for startTime length 2020-03-02 22:15:37 +01:00
Rachael Alexanderson
1b80b7bf2f - ported over Nash's startTime for A_StartSound 2020-03-02 22:15:37 +01:00
Major Cooke
4cf7c6351d Added A_StopSounds(int chanmin, int chanmax).
- If both channels are 0, completely silences the actor.
- Adapted A_StopAllSounds to call A_StopSounds(0,0);
2020-03-01 19:42:21 +01:00
Major Cooke
55284d46bf Added A_StopAllSounds. 2020-02-29 19:19:51 +01:00
Rachael Alexanderson
04ce0b6ec6 - use GAMENAMELOWERCASE macro for music config defaults 2020-02-23 08:12:41 +01:00
alexey.lysiuk
45617043f8 - fixed arguments order for ZMusic_Start() function 2020-02-22 13:08:10 +02:00
Christoph Oelckers
5391382807 - removed CD audio support.
Mainly because this is an ancient deprecated feature on the system side that serves no good purpose anymore.
2020-02-18 21:53:30 +01:00
Christoph Oelckers
c485256c74 Merge remote-tracking branch 'remotes/origin/zmusic_dll' 2020-02-15 10:22:45 +01:00
Christoph Oelckers
85ff05c0b2 - missed these in the last commit. 2020-02-15 10:16:38 +01:00
Christoph Oelckers
6aed119403 - backported a few sound code fixes from Raze. 2020-02-15 09:32:05 +01:00
alexey.lysiuk
c80bfcf9f6 - added missing #include
src/sound/music/i_soundfont.cpp:121:12: error: no viable overloaded '='
src/sound/music/i_soundfont.cpp:127:12: error: no viable overloaded '='
src/sound/music/i_soundfont.cpp:140:14: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
2020-02-11 12:29:20 +02:00
Christoph Oelckers
2dd3c28d05 - transitioned engine to use ZMusic as a DLL. 2020-02-09 08:56:49 +01:00
Christoph Oelckers
77ed5b1fe8 - let freelook default to true. 2020-02-03 21:41:52 +01:00
Christoph Oelckers
2817bc5508 - backported fix for loading VOC files.
In NAM there is one that needed a bit of extra treatment.
2020-02-01 17:34:06 +01:00
Chris Robinson
5b4c9eb7f6 Remove FSoundLoadBuffer since it wasn't doing anything 2020-02-01 17:11:26 +01:00
Chris Robinson
3c975f18bc Remove LoadSoundBuffered since its no longer called 2020-02-01 17:11:26 +01:00
Chris Robinson
30bdd0c2d4 Get rid of the LoadSound3D method
It no longer does anything since there's no separate buffer for 3D sfx.
2020-02-01 17:11:26 +01:00
Chris Robinson
d823091446 Update a couple comments about monoized sounds 2020-02-01 17:11:26 +01:00
Chris Robinson
e88b1039a3 Stop sources immediately when the sound is forced to stop
The reason for the previous delay was to allow OpenAL Soft to fade the sound to
silence and avoid a sudden amplitude change, which can cause a "click" or "pop"
noise. However, with OpenAL Soft 1.20, this is a built-in feature of the mixer
so the extra complexity is unnecessary.
2020-02-01 17:11:26 +01:00
Chris Robinson
c095872b0a Remove the 'monoize' option from sound loading
Unnecessary with the AL_SOFT_source_spatialize extension, which has been
available for over a year.
2020-02-01 17:11:26 +01:00
Chris Robinson
42fd84a09d Remove the fallback for lack of AL_EXT_SOURCE_RADIUS
It's been available in OpenAL Soft for years and the fallback method wasn't very good.
2020-02-01 17:11:26 +01:00
alexey.lysiuk
f9fa07dca5 - restored old values for CHAN_... constants
https://forum.zdoom.org/viewtopic.php?t=66929
2020-01-11 13:27:10 +02:00
alexey.lysiuk
cad14d1c93 - fixed resolving of music aliases with full filenames
https://forum.zdoom.org/viewtopic.php?t=66815
2020-01-06 11:15:17 +02:00
Petr Mrázek
3c20d5fe88 - Run the Alsa MIDI thread every 40ms or so, use non-blocking sequencer 2020-01-04 20:19:36 +01:00
Chronos Ouroboros
a588c24c4f Fixed some incorrect parentheses in S_PlaySoundPitch. 2020-01-04 15:34:43 -03:00
Christoph Oelckers
b7e1a35e6f - cleaned up the parameters of A_StartSound.
There were two booleans that could be merged into the flag word.
This also fixes a bug with CHAN_NOSTOP not working for local sounds because it checked the wrong sound source for the playing sound.
2020-01-04 14:25:55 +01:00
alexey.lysiuk
651dfbc49f - fixed a few compilation warnings
src/d_main.cpp:280:18: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
src/rendering/r_videoscale.cpp:147:22: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
src/sound/s_reverbedit.cpp:250:18: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
2020-01-04 12:59:26 +02:00
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
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
Marisa Kirisame
55e482d0fc Additional CHAN_OVERLAP awareness for StartSound and ChangeSoundVolume/Pitch. 2019-12-30 13:01:59 +01:00
Christoph Oelckers
d08bb93b84 - elimintated all cases from the ZScript code where channel indices and flags were combined into one parameter and removed all remnants of CHAN_PICKUP. 2019-12-30 09:47:25 +01:00
Christoph Oelckers
d79c6c1c0a - fixed: A_StartSound was still masking the sound channel value for checking if it plays something. 2019-12-30 09:09:56 +01:00
Christoph Oelckers
318da33e39 - sound engine update.
Notable changes:
* IsSourcePlayingSomething had undefined behavior when checking unattached and unpositioned sounds.
* loading Blood RAW sounds with different sample rates but the same backing lump may not use the same hardware sound buffer.
* when playing an unpositioned sound the attenuation is irrelevant and must be ignored. This resulted in a 3D sound being started which was mostly inaudible due to lack of valid origin.
2019-12-19 11:57:58 +01:00
Marisa Kirisame
9430e1556f Change IsSourcePlayingSomething to handle overlapping sounds. 2019-12-17 15:53:56 +01:00
Christoph Oelckers
0ba6816622 - made FSoundChan::EntChannel a full int and reordered the structure for better packing. 2019-12-17 11:43:13 +01:00
Christoph Oelckers
0a8effaf9e - fixed inverted listener check when using compatibility options. 2019-12-17 08:49:50 +01:00
Christoph Oelckers
3808e85c3e - the old bit masking for the channel needs to go, of course. 2019-12-17 00:28:32 +01:00
Christoph Oelckers
639e9d3cd4 - fixed VOC loader. Its 16 bit code did not work because it set the variable to -16 instead of 16.
- removed a few MAX calls with std::max.
2019-12-17 00:05:35 +01:00
Christoph Oelckers
e82565373f - separated the channel number from the flags in the sound interface so that the 8 channel limit can be eliminated.
- added Marisa Kirisame's CHAN_OVERLAP flag.
- exported S_IsActorPlayingSomething to ZScript.

The sound API change required deprecating A_PlaySound and S_Sound. There are now new variants S_StartSound and A_StartSound which have two distinct parameters for channel and flags.
2019-12-16 23:52:39 +01:00
Christoph Oelckers
b09e9f10ed - sound engine update. 2019-12-16 21:45:34 +01:00
alexey.lysiuk
c3ede69d16 - fixed linked sound resolving
Hash indices and sound ids were used interchangeably but they are different entities

https://forum.zdoom.org/viewtopic.php?t=66618
2019-12-12 17:37:10 +01:00
Christoph Oelckers
165d9951aa - made the sound resolving a virtual method
This way the player sounds can be done in the proper place without infesting the core.
2019-12-12 01:31:41 +01:00
alexey.lysiuk
3cb571c1d5 - rewrote test for occupied sound channel without special types
https://forum.zdoom.org/viewtopic.php?t=66613
2019-12-10 13:36:05 +02:00
alexey.lysiuk
f050a23541 - restored stopping of channel by new sound
If source actor/sector/polyobject is playing something on the selected channel, stop it before playing a new sound

https://forum.zdoom.org/viewtopic.php?t=66613
2019-12-10 11:40:32 +02:00
alexey.lysiuk
5e35077364 - remove redundant call to SoundRenderer::UpdateSounds()
At that point SoundEngine::StopAllChannels() did this already
2019-12-09 16:09:07 +02:00
alexey.lysiuk
5966391108 - moved sound engine cleanup calls to own function
https://forum.zdoom.org/viewtopic.php?t=66605#p1127457
2019-12-09 16:06:41 +02:00
alexey.lysiuk
430a6f3247 - fixed crash when exiting before sound engine initialization
https://forum.zdoom.org/viewtopic.php?t=66605
2019-12-09 15:43:01 +02:00
Magnus Norddahl
61036dfdca Fix include error 2019-12-09 03:10:37 +01:00
Christoph Oelckers
6725cfcca5 - cleaned the includes of the sound backend code of unwanted content.
Also simplified the sound init decision making. With FMod gone there is no reason to be pedantic here. Even the check of snd_backend for the Null device could be omitted here, its only realistic use is '-nosound'.
2019-12-08 22:17:19 +01:00
Christoph Oelckers
83349bee1b - separated reverb data and reverb editor.
Again, isolating the part that is game independent from parts that are specific to GZDoom.
2019-12-08 21:45:45 +01:00
Christoph Oelckers
b9582cc98e - continued refactoring on sound code.
The game independent part of the code has been mostly isolated.
2019-12-08 21:22:53 +01:00
Christoph Oelckers
fd181f469d - reduced the dependency of the sound system on game state.
Many of the simple wrappers have been moved to a separate file and the sound source handling has been abstracted.
This is only the first phase, the work is not complete yet.
Also changed the license of the sound code to BSD after verifying that this code bears no similarity to id's original sound code anymore, save for a few function names (which are due to be refactored out anyway.)
2019-12-08 13:28:52 +01:00
Christoph Oelckers
22e692e21c - started separating the sound engine code from game dependent parts.
First step: Split the header. Todo: Abstract listener and sound source specifics out of the sound engine.
2019-12-08 10:07:26 +01:00
alexey.lysiuk
33fb2a7856 - pass master volume to ZMusic library on startup
MIDI devices that don't output music through the sound system (like WinMM) ignored master volume setting

https://forum.zdoom.org/viewtopic.php?t=66510
2019-11-29 11:13:03 +02:00
alexey.lysiuk
c3dc8ea837 - fixed selection of system MIDI device on startup
https://forum.zdoom.org/viewtopic.php?t=66150
2019-10-18 15:22:58 +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
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
bfa8e25100 - fixed crash on exiting from IWAD selector
https://forum.zdoom.org/viewtopic.php?t=66073
2019-10-09 15:05:20 +03:00
Christoph Oelckers
2e7af1338c - the big cleanup of the exit cleanup is done!
atterm is gone and only a few system-side functions use atexit.
All game side cleanup is performed in D_DoomMain now.
2019-10-07 20:28:55 +02:00
Christoph Oelckers
5a72e0bfb7 - added a new texture class using stb_image to read a more formats.
This implementation only reads GIF, BMP and PIC formats. No animated GIF support because stb_image does not handle that.
PNG, JPG and TGA are still being handled by the existing dedicated implementations.
PSD and HDR are impractical for reading texture data and thus are disabled.
PnM could be enabled, if its identification semantics were stronger. stb_image only checks the first two characters which simply would falsely identify several flats with the right colors in the first two bytes.

This is more or less a waste product of getting stb_image to work with something actually testable, so it is just provided as-is.
2019-10-06 08:37:23 +02:00
Christoph Oelckers
b9d4e77214 - eliminate a little bit of redundancy. 2019-10-01 20:13:40 +02: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
Christoph Oelckers
a2883cdf39 - added missing return to the GENMIDI loader. 2019-10-01 00:11:41 +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
c61e8ada86 - removed the remains of the FModEx-style stream implementation
FMod had MP3/Ogg playback integrated right into itself, and the OpenAL backend tried to replicate this functionality.

This functionality, however, has been removed over two years ago when FMod started breaking things more and more, it was only this backing implementation that was left in.
2019-09-30 03:01:33 +02:00