Commit graph

862 commits

Author SHA1 Message Date
Christoph Oelckers
38aa6c4281 - the old bit masking for the channel needs to go, of course. 2020-01-06 15:08:22 +01:00
Christoph Oelckers
9c825ea090 - 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.
2020-01-06 15:08:20 +01:00
Christoph Oelckers
c3759f389c - 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.

# Conflicts:
#	src/bbannouncer.cpp
#	src/fragglescript/t_func.cpp
#	src/g_shared/a_lightning.cpp
#	src/p_effect.cpp
#	src/p_mobj.cpp
#	src/p_switch.cpp
#	src/playsim/p_spec.cpp
#	src/sound/s_doomsound.cpp
#	src/sound/s_doomsound.h
#	wadsrc/static/zscript/base.zs

# Conflicts:
#	src/intermission/intermission.cpp
#	src/sound/s_doomsound.cpp
2020-01-06 15:00:05 +01:00
Christoph Oelckers
ba006cbc5c - sound engine update. 2020-01-06 14:50:50 +01:00
alexey.lysiuk
7277717b32 - 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
2020-01-06 14:50:48 +01:00
Christoph Oelckers
b0d38adb25 - made the sound resolving a virtual method
This way the player sounds can be done in the proper place without infesting the core.

# Conflicts:
#	src/sound/s_doomsound.cpp
2020-01-06 14:50:46 +01:00
alexey.lysiuk
179c4dd238 - rewrote test for occupied sound channel without special types
https://forum.zdoom.org/viewtopic.php?t=66613
2020-01-06 14:38:39 +01:00
alexey.lysiuk
3c157a4f2c - 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
2020-01-06 14:38:37 +01:00
alexey.lysiuk
ea85cd18dd - remove redundant call to SoundRenderer::UpdateSounds()
At that point SoundEngine::StopAllChannels() did this already
2020-01-06 14:38:35 +01:00
alexey.lysiuk
da7515c0ce - moved sound engine cleanup calls to own function
https://forum.zdoom.org/viewtopic.php?t=66605#p1127457
2020-01-06 14:38:33 +01:00
alexey.lysiuk
9b2054ad4d - fixed crash when exiting before sound engine initialization
https://forum.zdoom.org/viewtopic.php?t=66605
2020-01-06 14:38:30 +01:00
Magnus Norddahl
bd80a16312 Fix include error 2020-01-06 14:32:33 +01:00
Christoph Oelckers
6c4a6def62 - 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'.

# Conflicts:
#	src/sound/s_environment.cpp
2020-01-06 13:55:51 +01:00
Christoph Oelckers
fb42e6d92e - separated reverb data and reverb editor.
Again, isolating the part that is game independent from parts that are specific to GZDoom.
2020-01-06 13:45:37 +01:00
Christoph Oelckers
8adf2c34cd - continued refactoring on sound code.
The game independent part of the code has been mostly isolated.

# Conflicts:
#	src/sound/s_doomsound.cpp
#	src/sound/s_sound.cpp
#	src/sound/s_sound.h

# Conflicts:
#	src/sound/s_sound.cpp
2020-01-06 13:45:19 +01:00
Christoph Oelckers
89bffd17bc - 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.)

# Conflicts:
#	src/sound/s_sound.cpp
#	src/sound/s_sound.h
2020-01-06 13:35:40 +01:00
Christoph Oelckers
3501ffd743 - 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.
2020-01-06 13:35:38 +01:00
alexey.lysiuk
2535b4ef63 - 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
2020-01-06 01:32:08 +01:00
alexey.lysiuk
505902b141 - fixed selection of system MIDI device on startup
https://forum.zdoom.org/viewtopic.php?t=66150
2020-01-06 01:30:51 +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
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
a5d3be2569 - fixed crash on exiting from IWAD selector
https://forum.zdoom.org/viewtopic.php?t=66073
2020-01-06 00:55:49 +01:00
Christoph Oelckers
191b958791 - 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.

# Conflicts:
#	src/CMakeLists.txt
#	src/atterm.cpp
#	src/atterm.h
#	src/d_main.cpp
#	src/dobjtype.cpp
#	src/g_mapinfo.cpp
#	src/g_statusbar/sbarinfo.cpp
#	src/gamedata/g_mapinfo.h
#	src/i_net.cpp
#	src/p_setup.cpp
#	src/posix/cocoa/i_video.mm
#	src/posix/sdl/hardware.cpp
#	src/posix/sdl/i_main.cpp
#	src/r_utility.cpp
#	src/rendering/v_video.cpp
#	src/sound/s_advsound.cpp
#	src/sound/s_sound.cpp
#	src/swrenderer/r_swcolormaps.cpp
#	src/win32/hardware.cpp
#	src/win32/i_input.cpp

# Conflicts:
#	src/CMakeLists.txt
#	src/i_net.cpp
#	src/posix/sdl/i_system.cpp
#	src/r_utility.cpp
#	src/win32/i_system.cpp
2020-01-05 23:57:44 +01:00
drfrag
5b31393b90 - Fixed compilation.
# Conflicts:
#	src/win32/st_start.cpp
2020-01-05 21:19:07 +01:00
Christoph Oelckers
ba071d7044 - eliminate a little bit of redundancy. 2020-01-05 21:04:12 +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
Christoph Oelckers
55831a264a - some reformatting on exit code, mainly to make searching for the content easier.
# Conflicts:
#	libraries/asmjit/asmjit/core/compiler.h
#	libraries/glslang/spirv/SpvBuilder.h
#	src/posix/sdl/hardware.cpp
#	src/rendering/v_video.cpp
#	src/win32/hardware.cpp
#	src/win32/i_main.cpp
2020-01-05 21:03:41 +01:00
drfrag
fce7af81af - Try to fix compilation on POSIX targets, i mean for real compilers thanks again to the broken VS preprocessor. 2020-01-05 19:44:18 +01:00
Christoph Oelckers
ed0e671281 - added missing return to the GENMIDI loader. 2020-01-05 14:39:14 +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
555b847323 - 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.
2020-01-05 14:39:04 +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
fce866054e - reordering code a bit to see where the stream must be started. 2020-01-05 12:56:37 +01:00
Christoph Oelckers
e3bb9332d0 - a bit of cleanup - moving internal class declarations into the sources.
Now i_musicinterns.h doesn't bleed the entire implementation everywhere anymore.
2020-01-05 12:56:35 +01:00
Christoph Oelckers
0f7886326d - renamed the configuration file. 2020-01-05 12:56:33 +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
d44d3b353d - did a bit of reordering on I_RegisterSong.
The way CDDA was treated as an afterthought made handling of stream songs somewhat problematic, because the state could be unclear.
CDDA is an easily identifiable format so it should be tested first.
2020-01-05 12:33:51 +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
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
Christoph Oelckers
f3f2ec5cb1 - 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.

# Conflicts:
#	src/CMakeLists.txt

# Conflicts:
#	libraries/zmusic/decoder/mpg123_decoder.cpp
#	libraries/zmusic/decoder/sndfile_decoder.cpp
#	src/CMakeLists.txt
2020-01-05 12:29:15 +01:00