-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
SCI: Fix _dontRemap handling in SciMusic::soundInitSnd #4876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
https://moral.net.au/misc/pq1sci.006 - example save game, tested with ScummVM's builtin MT-32 support
|
48173c0
to
4cc3584
Compare
I have checked LSL6 disasm. The original code will only make changes to the flag if it is set in the resource. So this fix is correct. I have added a commit which also extends this to other flags and settings, since the original also does that... |
@moralrecordings thanks for figuring this out. And impressive! SCI audio is... intense. Can you test these latest changes to make sure you're still hearing what you expect? Then we can merge. |
I think the changes have introduced some problems in pq1sci.
My guess is the mute flag, but will try and figure out which ones it is. |
Okay, _dontMap is responsible for all the glitches; our sound mapper uses it as a cue to just skip the track entirely, which could be quite different from the original sound mapper. With everything else left in, music tracks now fade out properly when they didn't before. There is one sound glitch left that I could spot in pq1sci; https://moral.net.au/misc/pq1sci.009 - when you pull into the jail and you arrive on the next screen, the driving music is meant to fade out and be replaced with another track. From what I can tell:
This might be more invasive to fix and is less jarring a glitch compared to the percussion stuff, so maybe that's best left alone for now. |
Thanks for your tests and for the fix. If this gets rid of the glitches I guess we could merge the PR now as its is. The revert is kind of masking a bug with another bug, but it allows fixing the dontMap flag without any pressure... The dontMap flag is rarely used. I have seen it only in KQV so far. So it wouldn't come as a big surprise if the handling is bugged in our code. |
You're right that _dontMap is probably masking a more integral issue with the feature... that said, given it's rarely used and not a regression per se, I'm happy with merging it now. |
Hmm, now I did a little debugging and I actually did not find a single use case of the _dontMap flag in any track. My impression is that the '|=' just revealed the fact that we did not initialize these values. So, for _dontMap I had a random value of true (which would then remain true due to the '|=' and for _dontRemap I had a random value of false. Could you please check what happens to the glitches that you noticed if you re-add the '|=' for the dontMap, but add after line 501? |
6cc8be9
to
de27445
Compare
Hah, yep it turned out to be uninitialized values (isn't C++ great??). All good in pq1sci. Good catch, I've reworked my commit to include the changes. |
de27445
to
f886f42
Compare
@moralrecordings Let's squash this thrilling drama into one commit and merge. @athrxx It's Been 0xCCCCCCCC Days Since Our Last Accident |
It is possible in SCI to have a MIDI track which defines _dontRemap twice for the same channel. _dontRemap is needed for devices like the Roland MT-32, where percussion sounds are only available on MIDI channel 10. As such, we must assume that any use of _dontRemap in successsion is legitimate, not just the final use. athrxx checked the LSL6 disassembly and confirmed that all of the flags follow this rule. In addition, we need to initialize the flags before use. Fixes the percussion track on various bits of music in pq1sci when played back on the MT-32 (e.g. the musical transition after handing the ticket to the woman, followed by the music when driving in the car). Also fixes some volume fade outs between driving and parking.
f886f42
to
94d3fd3
Compare
All done, feel free to merge. |
Great, thanks! |
It is possible in SCI to have a MIDI track which defines _dontRemap twice for the same channel. _dontRemap is needed for devices like the Roland MT-32, where percussion sounds are only available on MIDI channel 10. As such, we must assume that any use of _dontRemap in successsion is legitimate, not just the final use.
Fixes various bits of music in pq1sci when played back on the MT-32 (e.g. the musical transition after handing the ticket to the woman, followed by the music when driving in the car).