Closed donnierussellii closed 6 years ago
This is sounding a lot better! I think we can merge this in soon. A few issues I noticed:
Audiologs should duck the music volume when playing, didn't notice this in my testing. This all happens here: https://github.com/Interrupt/systemshock/blob/b7018ffd4ca6ee2e063a87d84dff71e5775bd842/src/GameSrc/audiolog.c#L210
The logs are super chatty with this on right now, should probably remove the logging when a new track starts or move it down from INFO to TRACE
Totally forgot the volume ducking. It seems to work now.
The AppVeyor CI build is failing for some reason on this PR, the error is:
C:/projects/systemshock/src/Libraries/adlmidi/chips/dosbox/dbopl.cpp:1584:65: error: 'INT16_MAX' was not declared in this scope
out[i] = static_cast<Bit16s>(DBOPL_CLAMP(out32[i], INT16_MIN, INT16_MAX));
Doing some searching online it sounds like we may need to specifically add -D__STDC_LIMIT_MACROS
to the cmake DCMAKE_CXX_FLAGS
I'm sure there is more we can do to make the music playback even better, but for now this is a solid start! ✨ 🎧 ✨
This work is based on Interrupt's adl-mark-2 branch and my multithreaded ReadXMI code, which is based on SSPLAYER ( https://wenchy.net/old/shock.html ).
The music ai is preserved from master, with tweaked adl code added in and a rewritten/cleaned up setup.c for looping title and credits music.
This reads midi messages from XMI files (and track numbers from BIN files), sends the messages to adlmidi, which fills a stream buffer that is sent to SDL audio. Buffer size is 2048. 4096 causes uneven notes.
Added code to repeat shorter pieces while longer superchunk plays.
Note that setup.c is heavily edited, but care was taken.