Commit graph

99 commits

Author SHA1 Message Date
obligaron
8a4d4b6375 Add OptionEntries for Audio 2021-12-14 04:10:16 +01:00
Gleb Mazovetskiy
7e1fea6f76 clang-format all files in {Source,test}/
Also includes a few manual tweaks to comments and newlines for better results.

Co-authored-by: Anders Jenbo <anders@jenbo.dk>
2021-11-24 23:44:12 +01:00
Gleb Mazovetskiy
fa90679416 game_assets.* -> assets.* 2021-11-17 11:49:57 +01:00
Gleb Mazovetskiy
b4aa0a2093 Open music assets with threadsafe=true
Missed during #3354
2021-11-07 13:16:20 +00:00
Gleb Mazovetskiy
3d308983a8 Migrate to libmpq
libmpq is a much simpler alternative to StormLib for reading MPQ archives.

We use our own fork of libmpq: https://github.com/diasurgical/libmpq

Impact:

* DevilutionX is now a lot more portable. Unlike StormLib, libmpq only
  needs platform-specific code for Windows.
* Locks around file access **removed** (instead we duplicate the file descriptor for streamed audio only).
* RAM usage is **300 KiB** lower than StormLib.
* Stripped release linux_x86_64 binary is **32 KiB** smaller.
* Amiga build now hangs instead of crashing.
2021-11-06 23:51:42 +00:00
qndel
47561716b3
fix sound crashes (#3403) 2021-11-06 13:03:00 +01:00
Anders Jenbo
8df5912dc6 Always use SDL wrapper for file access 2021-10-20 21:52:59 +02:00
Anders Jenbo
7cb73a6717 Minimize impact of NOSOUND 2021-08-30 10:57:59 +02:00
Vladimir Olteanu
8fcd21e0b5 music.cpp: make musicBuffer a unique_ptr 2021-08-17 17:47:07 +02:00
Anders Jenbo
de0b3a38b8 Apply code style 2021-07-20 02:51:39 +02:00
Anders Jenbo
e5fc7fd17c Move remaning symbols in to anonymous namespaces 2021-07-20 02:51:39 +02:00
Anders Jenbo
0889780923 Remove more usage of miniwin types 2021-07-18 02:11:58 +02:00
JoBergeron
be3f1ba928
Pause game and mute music when game window loses focus (#2337) 2021-07-10 04:21:27 +02:00
Anders Jenbo
9ebdb6db69 General clean up 2021-07-08 03:30:25 -07:00
Anders Jenbo
a7c7fa0030 Fully apply clang-tidy/format to all files 2021-07-03 16:41:43 -07:00
Anders Jenbo
129342d07a Clang-tidy: GlobalConstantCase 2021-07-02 22:56:56 +02:00
Anders Jenbo
f167bd4dfb Clang-tidy: llvm-include-order 2021-06-27 01:45:49 +02:00
Gleb Mazovetskiy
f9f301b054 🚚 engine.h: Extract Point, Direction, clamp
`engine.h` is getting quite bloated. Moves this code to their own files.
2021-06-21 01:36:20 -07:00
Gleb Mazovetskiy
e72def02e6 🔨 Add STREAM_ALL_AUDIO build setting
For extremely memory-constrained devices. Gets into town on RG99 (18 FPS -> 14 FPS).
2021-05-23 05:03:14 +02:00
Gleb Mazovetskiy
c79ec673f4 ♻️ Implement std's Lockable for SDL mutex wrapper
Rather than rolling our own lock guard, implement the requirements for
using `std::lock_guard` et al and use that.
2021-05-17 12:00:09 +02:00
Anders Jenbo
a095bc0bf7 ♻️Migrate more code away from miniwin 2021-05-13 02:30:18 +02:00
staphen
3e5e5b2696 Synchronize SFileCloseFile() access 2021-05-08 04:01:07 +02:00
Anders Jenbo
4a7ba94702 🎨 Run clang-format 2021-05-07 23:26:39 +02:00
Gleb Mazovetskiy
0f95c3cbac 🧹 Fix a TSAN warning in DuplicateSound
This is likely a false positive from TSAN but good to fix nevertheless

Fixes #1849
2021-05-05 03:38:14 +02:00
Gleb Mazovetskiy
987ab2533b 🐞 Synchronize SFileReadFile access
StormLib read function is not thread-safe: https://github.com/ladislav-zezula/StormLib/issues/175
2021-05-03 02:35:22 +02:00
thebigMuh
24f32a1d53
Fix sound volume/panning attenuation (#1789)
* Fixing volume adjustment and scaling
2021-05-03 02:11:22 +02:00
Gleb Mazovetskiy
9980b77d23 🐞 ClearDuplicateSounds: Also lock the mutex 2021-05-02 15:04:05 +01:00
Gleb Mazovetskiy
559229dea1 🐞 Duplicate sounds: Fix data race
This fixes a data race by deleting the sound exactly when it finishes
playing.

Previously, a data race could happen in
`CleanupFinishedDuplicateSounds`, where the sound would be destroyed
while Aulib was reading from its buffer.
2021-05-02 14:15:35 +01:00
Gleb Mazovetskiy
0bfc147b78
🧹 Remove DiabloAllocPtr and friends (#1824) 2021-05-02 07:06:18 +02:00
Gleb Mazovetskiy
5820948761 ♻️ Make SFileRw own the Storm file handle
All of our use-cases for `SDL_RWops` Storm file require closing the file
when closing the `SDL_RWops` -- doing this automatically simplifies the
code.
2021-05-02 02:34:16 +02:00
Gleb Mazovetskiy
7bdfb0655c 🐞 Support multiple playback of the same sound 2021-05-02 00:36:36 +02:00
Vladimir Olteanu
7aad72f96d
Use automatic memory management for sound stuff (#1771) 2021-04-30 09:02:07 +02:00
Gleb Mazovetskiy
0dd9aeea69 ♻️ Cleanup DISABLE_STREAMING_MUSIC handling
Extracts `LoadMusic` and `CleanupMusic` functions.
2021-04-28 12:51:24 +02:00
Gleb Mazovetskiy
4b7409a8bf 🎶 Loop the music
Follow-up to #1651
2021-04-27 20:06:18 +02:00
Gleb Mazovetskiy
acee2ef14c 🎉 Switch from SDL_mixer to SDL_audiolib
SDL_mixer can only stream a single music track
SDL_audiolib has unlimited streams.

With this change, we finally have streaming sounds (respecting
sfx_STREAM).

Audio options can now also be set via diablo.ini, which should help us
better diagnose the static noise issues.
2021-04-27 00:54:50 +01:00
Jmgr
1b7e0d2cb3 Migrate existing log entries 2021-04-25 02:39:42 +02:00
Anders Jenbo
a32ac83090 🎨 cleanup trivial trype comparisons 2021-04-23 02:48:25 +02:00
Anders Jenbo
bb4e1960e7 🎨 modernize-use-nullptr 2021-04-19 16:02:05 +02:00
Anders Jenbo
8c821e98d3 🚚 Restructure files 2021-04-16 03:57:22 +02:00
Anders Jenbo
997c1dba55 🚚 Split up all.h in to proper header relations 2021-04-16 01:04:54 +02:00
Anders Jenbo
6e1a106a38 🚚 Move header we implement into the project 2021-04-16 01:04:54 +02:00
Anders Jenbo
67a7ff98c5 🚨 Clean up compiler warnings 2021-04-16 01:04:54 +02:00
Anders Jenbo
52401c9677 💚 Correct include headers 2021-04-10 14:31:05 +02:00
Anders Jenbo
dc84643fe6 🚚 Move dx.cpp and sound.cpp back in to Source now that the name space is clean 2021-04-10 14:30:22 +02:00
Anders Jenbo
5ff14b59da Remove unused source 2019-09-13 03:56:32 +02:00
Anders Jenbo
98ab9b9600 Merge branch 'master' of github.com:diasurgical/devilution 2019-08-18 08:07:33 +02:00
Anders Jenbo
68d51e7d27 Implementing Spawned Shareware version 2019-08-12 16:04:20 +02:00
Anders Jenbo
2fcf8dab70 Merge branch 'master' of github.com:diasurgical/devilution 2019-07-21 19:39:17 +02:00
Anders Jenbo
6fba17eec5 Correct GLOBAL types based on PSX SYM 3 2019-07-21 04:10:31 +02:00
Anders Jenbo
e6f4e21631 Merge branch 'master' of github.com:diasurgical/devilution 2019-06-16 19:18:19 +02:00