22 Commits

Author SHA1 Message Date
jpernst
d931f75d93
Activate OPL3 chips on-demand based on voice pressure (#1911)
* Remove opl_sample_rate variable since it has no practical effect

* Deactivate idle OPL chips
Allocate free OPL voices from active chips before inactive ones

* Add comments for new constants

* Ensure OPL chip LFOs are kept in sync after dormancy

* Check for chip activations before sample generation to preserve sync
2024-09-17 07:47:29 +02:00
jpernst
3bee945f2f
OPL3 Improvements (#1907)
* Use correct OPL3 channel polarity by default

* Support multiple OPL3 chips

* Use native OPL sample rate and allow OpenAL to resample it

* Bind DMX OPL stereo correction to a config variable; default to vanilla

* Consolidate num_opl_chips variables; remove menu item
Use BETWEEN macro for mix clamping

* Disable upper register banks when dmx is in OPL2 mode
2024-09-15 12:18:56 +07:00
dbalsom
c0d3ae55bf fix reference to timer2.enabled 2024-09-12 15:59:25 +02:00
Roman Fomin
1f957567a6
use compile_commands.json for Cppcheck (#1716)
* suppress memleak warnings only for u_scanner.c
2024-05-29 18:07:46 +07:00
Roman Fomin
26ce44b216
remove extern from *.c files (#1686) 2024-05-13 16:43:07 +07:00
Roman Fomin
7bc4f24c7c
fix Thread Sanitizer warnings, music modules refactoring (#1531)
* Fix TSan warnings with Fluidsynth backend

* Convert Fluidsynth and OPL modules to stream_module_t interface

* Remove mutexes from OPL module

* Remove I_OAL_HookMusic/callback

* Move extern declarations to headers
2024-03-01 18:22:04 +07:00
Roman Fomin
a6836b314f
header cleanup using IWYU tool (#1467)
* Forward declaration of structures in headers where possible

* Use M_snprinf instead of sprintf

* Remove D_INTMAX D_INTMIN

* Don't change libtextscreen files

* Add miniz and win32 include directories
2024-02-20 19:26:28 +07:00
Roman Fomin
4b0cb33234
add initialization checks to music modules (#1051)
Now, for example, if OpenAL fails to initialize, Win Native MIDI can still
work.
2023-05-12 14:15:42 +07:00
Roman Fomin
4463f86dea split i_oalmusic.h into two files, do not link OPL with OpenAL 2023-04-29 10:19:42 +07:00
Roman Fomin
8058a800d3
implement modplug stream module (#976)
* update workflows

* implement stream_module_t interface, use it for sndfile and modplug

This way we got the proper pause, loop and gain for the modplug module.
2023-04-06 18:59:53 +07:00
Roman Fomin
639069d399 OAL stream: actually use buffer samples instead of buffer size
This was the idea from the beginning. Also reduce the buffer length to about
half a second.

* cosmetic changes
2023-04-05 12:46:56 +07:00
Roman Fomin
1a278d6105
switch to OpenAl for sound mixing (#967)
* switch to OpeanAl for sound mixing

* Rewrote Load_SNDFile() to use float format. Made libsndfile mandatory.

* update main.yml workflow

* implement OpeanAl music streaming

* remove i_sdlmusic.c and SDL_Mixer dependecy

* enable mpeg support in libsndfile

* require SndFile 1.1.0

* check SF_FORMAT_MPEG_LAYER_III symbol

* use AL_GAIN for opl_gain
2023-04-04 19:46:58 +07:00
Fabian Greffrath
36060400fa sort source files alphabetically in CMakeLists.txt files 2023-01-05 09:57:52 +01:00
Roman Fomin
b69852fb07
switch to vcpkg for MSVC build (#855)
* switch to vcpkg for MSVC build

* Remove library downloads and install in MSYS2 environment.

* Add vcpkg.json with dependencies.

* add vcpkg to CI

* fix parallel linking conflict (files with the same name)

* use vcpkg targets (fix debug build)

* delete cross compilation toolchain files, update README.md

* switch to ninja for MSVC build

* turn off MSYS2 update

* use binary caching feature, save to GitHub using NuGet backend

* This works much more robust, also it's recommended method:
  https://github.com/microsoft/vcpkg/blob/master/docs/users/binarycaching.md

* move MSVC workflow to separate file, don't run it on pull request
2022-12-30 20:44:59 +07:00
Roman Fomin
fa2398109e
OPL output gain (#829)
* crude OPL volume gain

* replace SDL_MixAudioFormat with MixAudioFormat with added gain

* remove unnecessary code path, set default gain = 2

* fix gain calculation

* apply gain only to `src1`

* cosmetic changes
2022-12-09 17:11:09 +07:00
Roman Fomin
b230c1481f
hot-swappable music modules, list of Windows MIDI devices (#824)
* hot swap of music modules

* get a list of Windows MIDI devices

* move "MIDI Player" menu item only on Windows build

* increase MAX_MIDI_PLAYERS, index fixes

* fix hot swapping with UMAPINFO music, init OPL on song change

* initialize OPL only when necessary

* call I_ShutdownMusic in exit sequence

* don't send SysEx reset for MS GS Synth

* introduce `I_DeviceList` function, rearrange code

* `midi_player_strings` must be NULL at the end
2022-12-07 15:44:05 +07:00
Roman Fomin
000bcd5e72
implement M_getenv for compatibility with non-Latin paths on Windows (#667)
* implement M_getenv for compatibility with non-Latin paths on Windows

* use regular wcslen

SDL_wcslen is undocumented

* fix memory leak

* cache the `wenv == NULL` case
2022-07-18 21:07:33 +07:00
Roman Fomin
a075557421
remove win32/stdint.h, add CI build compatible with Windows XP (#617)
* remove win32/stdint.h

* add win32 build to CI

* attempt to fix main.yml

* simplify Build step

* fix syntax

* fix syntax again

* fix indent

* fix cpack directory

* build release configuration

* don't upload SDL libs

* download official FluidSynth library for MSVC WIN32 build

* clean up old MSVC #defines/resources

* set FluidSynth_DIR only on MSVC 32-bit build

* set -verbosity:minimal for msbuild

* fix syntax

* cosmetic changes
2022-06-23 11:56:09 +07:00
Roman Fomin
59edb68106
fix all MSVC warnings (#606)
* fix all MSVC warnings

* fix -mapangle

* clarify comments

* fix mapangle again
2022-06-18 11:59:54 +02:00
Roman Fomin
30c99dd1a5
old compilers support (#400)
* better support of C89 standart

* VC6 fixes

* __pragma attribute works for _MSC_VER > 1400

* use intptr_t for char*

* C89 has no designated initializers

* correct _MSC_VER versions

* fix check

* add stdint.h for old MSVC versions

Taken from https://github.com/mattn/gntp-send/blob/master/include/msinttypes/stdint.h

* add stdint.h to miniz.h

* make packaging work without Python

* fix window_position initialization

* replace PACKED_STRUCT with i_packed_start.h i_packed_end.h

Thus, we do not use variadic macros from C99.

* undo cmake install changes

* fix icon for VC6

* remove DESCRIPTION and HOMEPAGE_URL from project()

* remove i_packed_start.h and i_packed_end.h

* whitespace fixes

* rename PACKEDPREFIX->PACKED_PREFIX and PACKEDATTR->PACKED_SUFFIX

* MINGW check doesn't work this early

* add check for minimum cmake version for MINGW targets
2021-12-29 08:41:30 +01:00
Fabian Greffrath
c8b2fbd531
remove native OPL access implementations (#262) 2021-09-01 08:37:54 +02:00
Fabian Greffrath
3af836ec2e
add OPL emulation from Chocolate Doom (#258)
* add OPL emulation from Chocolate Doom

* get rid of detect_voices

* split the SDL music backend into a separate source file

* add post-realloc() check

* add OPL emulation copyright holders

* add some minimal comments

* add config variable and menu item

* sacrifice PCX format screenshot menu entry
2021-08-25 14:31:12 +02:00