joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.81k stars 383 forks source link

OPL wave select not working in BeniTracker #2809

Open sagamusix opened 3 years ago

sagamusix commented 3 years ago

Describe the bug

The OPL wave select is not working in BeniTracker, causing all FM operators to use a sine wave. On my AWE64, the different waves work correctly. Vanilla DOSBox has the same issue.

To Reproduce Steps to reproduce the behavior:

  1. Download and run BeniTracker from https://ftp.modland.com/pub/software/trackers/DOS/Beni%20Tracker/ (both 1.3 and 1.8 have this problem)
  2. Open instrument editor with F3
  3. Navigate using cursor keys and enter "70" into both "Att/Dec" fields (use Tab to switch between left/right column)
  4. Navigate using cursor keys and tab to the both Waveform fields, choose different waveforms. Press space to preview the instrument each time and observe that the instrument keeps sounding the same despite changing the operators' waveforms.

Expected behavior Operator waveforms should change the sound like on my AWE64.

Environment (please complete the following information):

Additional context I tried editing the OPL output code (QuickBasic source code is included with the tracker) to increase the delay between port writes (in case port writes were too fast) but that didn't help.

sagamusix commented 3 years ago

After playing around a bit more, it seems like BeniTracker doesn't write to the test / waveform select enable register at all, which then causes all subsequent waveform select commands to be ignored. Adding opl.out 1, 32 at the beginning of the program makes it work in DOSBox(-X).

Now I guess the question remains - does this mean that Creative's OPL3 clone ignores this register entirely, or does it enable it by default? Is there a way to emulate this DOSBox-X? Do other variants of the OPL2/OPL3 do the same?

Edit: According to https://moddingwiki.shikadi.net/wiki/OPL_chip#01:_Test_Register_.2F_Waveform_Select_Enable

OPL3 does not implement WSE bit, and it should be left clear.

So I assume a real OPL3 chip would behave just like the AWE64, and BeniTracker simply assumes that an OPL3 chip is present (despite using OPL2 features exclusively). Should DOSBox-X maybe follow the observed OPL3 behavior here if it's configured to use a SB16 (which it does by default)?

sagamusix commented 2 years ago

Some work is being done on this in DOSBox: https://sourceforge.net/p/dosbox/code-0/4468/

Wengier commented 2 years ago

Perhaps @Allofich will port the latest SVN commits too?

Allofich commented 2 years ago

I'll try to do it soon.