12 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
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
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
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
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