Skip to content

Ignore speaker-output enable/disable commands on the SB16 #3105

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

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

johnnovak
Copy link
Member

@johnnovak johnnovak commented Nov 9, 2023

Description

The speaker-output is always enabled on the SB16; speaker enable/disable commands are simply ignored. Only the SB Pro and earlier models can toggle the speaker-output via speaker enable/disable commands.

This fixes the muted digital speech issue in "Monkey Island 2: LeChuck's Revenge Ultimate Talkie Edition" (speech works in all other DOSBox variants).

Proof

  • DOSBox SVN just ignores speaker enable/disable commands for the SB16:
    https://github.com/joncampbell123/dosbox-svn/blob/master/src/hardware/sblaster.cpp#L240

  • The DOSBox-X documentation mentions that the speaker enable/disable commands only work on SB Pro and earlier models and have no effect on the SB16 where the speaker is always enabled.

  • The MIDIto r12 "Swiss Army Knife" MIDI & OPL tool has a special "DSP fix" option to emulate the speaker enable/disable commands for the SB16 and later models where they're not implemented:

    -dsp or /dsp will provide some fixes for SB16/32/AWE. Fixes at the moment include:
    * Fix Turn On/OFF Speaker commands by setting voice volume to zero when
      Turn OFF Speaker command is sent. Volume will be restored by Turn On Speaker
      command.
    

Manual testing

Tested "Monkey Island 2: LeChuck's Revenge Ultimate Talkie Edition" from eXoDOS v5 and digital speech works fine in the intro sequence.

Tested Gods with SBPro 2 and SB16; digital audio samples work fine in the intro music.

Tested a couple of MOD players with SBPro 2 and SB16.

@kcgen let me know if you think this change breaks the click & pop prevention in any way. I haven't specifically tested that because I think it should be fine.

Checklist

Please tick the items as you have addressed them. Don't remove items; leave the ones that are not applicable unchecked.

I have:

  • followed the project's contributing guidelines and code of conduct.
  • performed a self-review of my code.
  • commented on the particularly hard-to-understand areas of my code.
  • split my work into well-defined, bisectable commits, and I named my commits well.
  • applied the appropriate labels (bug, enhancement, refactoring, documentation, etc.)
  • checked that all my commits can be built.
  • confirmed that my code does not cause performance regressions (e.g., by running the Quake benchmark).
  • added unit tests where applicable to prove the correctness of my code and to avoid future regressions.
  • made corresponding changes to the documentation or the website according to the documentation guidelines.
  • locally verified my website or documentation changes.

@johnnovak johnnovak self-assigned this Nov 9, 2023
@johnnovak johnnovak added regression We broke something 😊 audio Audio related issues or enhancements labels Nov 9, 2023
@johnnovak johnnovak requested a review from kcgen November 9, 2023 13:14
@johnnovak johnnovak force-pushed the jn/fix-sb-setspeaker branch 3 times, most recently from 511a537 to 2087022 Compare November 9, 2023 13:16
@johnnovak johnnovak marked this pull request as ready for review November 9, 2023 13:16
The speaker-output is always enabled on the SB16; speaker enable/disable
commands are simply ignored. Only the SB Pro and earlier models can
toggle the speaker-output via speaker enable/disable commands.

This fixes the muted digital speech issue in "Monkey Island 2: LeChuck's
Revenge Ultimate Talkie Edition" (speech works in all other DOSBox
variants).
@johnnovak johnnovak force-pushed the jn/fix-sb-setspeaker branch from 2087022 to a1f00cd Compare November 9, 2023 13:22
Copy link
Member

@kcgen kcgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, @johnnovak. Looks good to me!

A lot of games always send speaker off and on events (no matter what card they're using), so it's possible (and likely) this technique avoided clicks and pops during these 'off' periods (on sbpro2 and prior cards).

So a new rule of thumb is to recommend users try sbtype = sbpro2 if they hear pops; maybe the game is trying to turn off the speaker during these poppy events :-)

@kcgen kcgen merged commit 40fb9b3 into main Nov 9, 2023
@johnnovak
Copy link
Member Author

You have more context than me on this one @kcgen, but if the clicks'n'pops happen due to "stuck" DC offset, the master high-pass filter would take care of that (which was introduced later than your click'n'pop prevention method).

@kcgen kcgen deleted the jn/fix-sb-setspeaker branch November 14, 2023 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audio Audio related issues or enhancements regression We broke something 😊
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants