AGI: add --pcjr-noise option to set shift register#6754
AGI: add --pcjr-noise option to set shift register#6754bluegr merged 8 commits intoscummvm:masterfrom
Conversation
The standard SN76489 sound chip found in PCjr machines uses a 15-bit shift register for its periodic noise generator. When the noise channel "borrows" a tone channel's frequency, it sounds awfully out of key. Some SEGA consoles, however, use a version of the chip with a 16-bit shift register, generating periodic noise with a resonant frequency in key with the borrowed one, thus allowing for using the periodic noise as a bass instrument. On a 15-bit shifting chip, using noise for music can only be achieved by premultiplying all the borrowed frequencies by 15/16ths, a workaround not entirely convenient. With --pcjr-noise=16, the chip emulation is set to generate properly resonant noise.
|
Since this option can basically have two values (15 and 16), it makes sense to simplify it to a boolean, to make it easier to use for casual users. Something like "Improve PCjr chip emulation", perhaps? This can be added as a game feature flag for fan made games, which can then be toggled as a checkbox by the ScummVM GUI |
|
Oh, definitely - it's just that it's a more substantial, more user-facing
change I didn't want to throw out there with only my second PR. It would
certainly make sense to move into AGI-specific UI options as a checkbox, as
soon as I figure out how to do that.
I'll get on fiddling with the UI. :)
…On Sat, 21 Jun 2025, 01:24 Filippos Karapetis, ***@***.***> wrote:
*bluegr* left a comment (scummvm/scummvm#6754)
<#6754 (comment)>
Since this option can basically have two values (15 and 16), it makes
sense to simplify it to a boolean, to make it easier to use for casual
users. Something like "Improve PCjr chip emulation", perhaps?
This can be added as a game feature flag for fan made games, which can
then be toggled as a checkbox by the ScummVM GUI
—
Reply to this email directly, view it on GitHub
<#6754 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB3QELJRMHMNWYB6QCXOBJ33ESJ2JAVCNFSM6AAAAAB7XT26XOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSOJTGA4TINBZGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
Should it be a checkbox, then, only enabled when PCjr is selected? Or, rather, a separate entry in the sound engines' list, like, "PCjr (SEGA compatible)", or something like that? There would be less of a UI impact this way. |
|
Hmmm, wait, you said "game feature flag". So far I'm not aware of how game feature flags work in ScummVM. So what's the proper procedure here - do I need to make my option into something like that, and build the GUI option for it (like the Adlib OPL emulator choice)? Or does it go somewhere else then? Or should I simplify this PR to just the implementation of the 16-bit shifter, and save actual options to enable it for a later PR, so as to compartmentalize properly? Please advise. |
|
GUI options for AGI engine are defined in
On adding or running a game, the game options become visible in the Game tab in the "Game Options" in the main GUI and in the General Main Menu (Ctrl+F5 in-game) |
|
Very well - I thought it would fit in better as a "sound" option, but if "game" option it is, then game option it is. |
|
There we go. Option added to game's custom settings. |
|
|
||
| namespace Agi { | ||
|
|
||
| #define GAMEOPTIONS_DEFAULT GUIO5(GAMEOPTION_ORIGINAL_SAVELOAD,GAMEOPTION_ENABLE_MOUSE,GAMEOPTION_ENABLE_PREDICTIVE_FOR_MOUSE,GAMEOPTION_USE_HERCULES_FONT,GAMEOPTION_COMMAND_PROMPT_WINDOW) |
There was a problem hiding this comment.
Should that option be available in commercial AGI games as well, or only for fan made games?
There was a problem hiding this comment.
I don't have enough commercial games to test, but indeed I'd go with fanmades only, as I'm not sure any commercial one used noise for music.
There was a problem hiding this comment.
Option removed from commercial games.
engines/agi/sound_pcjr.cpp
Outdated
| Common::String cfgPCjrNoise = ConfMan.get("pcjr_16bitnoise"); | ||
| if (cfgPCjrNoise == "true") | ||
| periodicNoiseMask = 0x10000; |
engines/agi/sound_pcjr.cpp
Outdated
| -100 | ||
| }; | ||
|
|
||
| int32 periodicNoiseMask = 0x08000; // default 15-bit periodic noise mask |
There was a problem hiding this comment.
Add this as a member variable of the SoundGenPCJr class. As per our code formatting guidelines, it should be prepended with an underscore, i.e. _periodicNoiseMask
|
Nice work, thanks! Squashing |
The standard SN76489 sound chip found in PCjr machines uses a 15-bit shift register for its periodic noise generator. When the noise channel "borrows" a tone channel's frequency, it sounds awfully out of key. Some SEGA consoles, however, use a version of the chip with a 16-bit shift register, generating periodic noise with a resonant frequency in key with the borrowed one, thus allowing for using the periodic noise as a bass instrument. On a 15-bit shifting chip, using noise for music can only be achieved by premultiplying all the borrowed frequencies by 15/16ths, a workaround very much inconvenient.
With --pcjr-noise=16, the chip emulation is set to generate properly resonant noise.
Now, admittedly, original Sierra games rarely use that feature in their music files. Homebrew games may, though, and it's better to have the option rather than not have it.