39 Commits
Author SHA1 Message Date
obligaron 45f8647892 Fix MSVC warnings in utils\* 2023-11-08 21:34:48 +00:00
obligaron 9bf1fd48b0 Fix a few MSVC warnings (#6782) 2023-11-05 18:23:53 +01:00
Gleb Mazovetskiy 5bf0b8bc96 Add more missing <cstdint> includes
https://github.com/diasurgical/devilutionX/pull/6095 only added includes
for `uint32_t`, this PR also adds the includes for the remaining
integral types.
2023-05-10 16:29:27 +01:00
Gleb Mazovetskiy 0e0cc9d1b0 Reduce to just STREAM_ALL_AUDIO_MIN_FILE_SIZE
This does result in a bit more code and RAM usage for soundsample when
`STREAM_ALL_AUDIO` is on, but not by much.
2023-01-22 15:19:50 +00:00
Gleb Mazovetskiy 0dd95adcd1 Add a minimum threshold for STREAM_ALL_AUDIO 2023-01-22 15:19:50 +00:00
Gleb Mazovetskiy 3ab2f49a92 Audio: Avoid creating same-rate resamplers
Each resampler allocates an input buffer and an output buffer.

Since we create ~100 audio stream objects (1 per `sfx_MISC` effect),
the memory cost of these buffers adds up.

Avoids creating a resampler when the audio sampler rate matches the
output sample rate. This is mostly the case when the output sample
rate is 22050.
2023-01-19 13:09:31 +01:00
Gleb Mazovetskiy f20c58c8a0 SoundSample::SetChunkStream: Log filename on error 2023-01-17 21:17:37 +00:00
Gleb Mazovetskiy 9db80ef5d7 Assets: Load files directly for UNPACKED_MPQS
When using `UNPACKED_MPQS`, avoid all the SDL machinery for reading
files.

This is beneficial not only due to reduced indirection but also because
we can test for the file's existence and get the file size without
opening it, which is much faster.
2022-11-22 02:44:25 +01:00
Gleb Mazovetskiy 4cdbd358dd Audio: Use SDL resampler where available 2022-04-16 04:20:47 +02:00
Gleb Mazovetskiy 7f695c2835 Use SoundSample for music
Unifies audio handling between sound effects and music.
2022-04-14 03:11:37 +02:00
Gleb Mazovetskiy 5645456537 Support MP3 playback 2022-04-09 14:15:55 +02:00
obligaron 8a4d4b6375 Add OptionEntries for Audio 2021-12-14 04:10:16 +01:00
Gleb MazovetskiyandAnders Jenbo 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 <[email protected]>
2021-11-24 23:44:12 +01:00
Gleb Mazovetskiy fa90679416 game_assets.* -> assets.* 2021-11-17 11:49:57 +01: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
Anders Jenbo 8df5912dc6 Always use SDL wrapper for file access 2021-10-20 21:52:59 +02:00
obligaron 837ddc0396 Fix a warning in soundsample.cpp 2021-07-17 14:35:21 +02:00
Anders Jenbo 9ebdb6db69 General clean up 2021-07-08 03:30:25 -07:00
ephphatha 3520dc4201 Update numeric literals to use appropriate suffix
Mainly things like .F for floats instead of doubles in float context.
2021-07-05 08:52:05 -07:00
Anders Jenbo 8e07ef8fe5 Clang-tidy: misc-unused-parameters 2021-06-27 17:34:32 +02:00
Anders Jenbo fa54499aeb Clang-tidy: readability-uppercase-literal-suffix
Strip suffixes
2021-06-27 03:17:36 +02:00
Anders Jenbo 51d5c8bcab Clang-tidy: performance-unnecessary-value-param 2021-06-27 01:48:19 +02:00
Anders Jenbo f167bd4dfb Clang-tidy: llvm-include-order 2021-06-27 01:45:49 +02:00
Anders Jenbo ec8d7bebe2 Clang-tidy: modernize-use-auto 2021-06-27 01:18:31 +02: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
Anders Jenbo 4a7ba94702 🎨 Run clang-format 2021-05-07 23:26:39 +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 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
Anders Jenbo f884ba5340 🔥 Remove more miniwin dependencies 2021-04-29 23:04:56 +02:00
Anders Jenbo 916a12ff3d 🐛 Fix missing sounds
When playing the same sound twice with in a short duration then the
sound it self, the secound request would go unfulfilled. The solution is
to simply rewind the stream pointer before requesting a playback.
2021-04-29 18:39:59 +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 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 7912e510f0 🎨 Clean up overuse of SDL types 2021-04-24 17:07:07 +02:00
thebigMuh 281533e82d This fixes exclusively the panning bug, where after a certain distance is exceeded, sound samples get played without panning. 2021-04-23 23:08:57 +02:00
Anders Jenbo cc164985a3 🎨 Correct type checks in src sub-folder 2021-04-22 20:33:24 +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