joncampbell123 / dosbox-x

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

PC Speaker distorts when sample accurate is set to true #4196

Open scrutinizer80 opened 1 year ago

scrutinizer80 commented 1 year ago

Describe the bug

Whenever the "sample accurate" option is set to true in the [mixer] section, most games using the PC Speaker distort badly. I've used the game Tapper as an example.

Steps to reproduce the behaviour

Run Tapper (for example) with the "sample accurate" option set to true, then run it while set to false & compare.

Expected behavior

PC speaker should sound the same in both cases.

What operating system(s) this bug have occurred on?

Windows 11 X64

What version(s) of DOSBox-X have this bug?

2023.03.31 SDL2

Used configuration

No response

Output log

No response

Additional information

No response

Have you checked that no similar bug report(s) exist?

Code of Conduct & Contributing Guidelines

joncampbell123 commented 1 year ago

This is a long standing bug since "sample accurate" was added and it has to do with how PC speaker samples are "stretched" to fit the render time.

If I had frankly written the PC speaker emulation I would have just done a lazy square wave render whenever PC speaker state changes and the "event queue" thing inherited from SVN wouldn't be there.

I haven't been able to squash this bug yet.

scrutinizer80 commented 1 year ago

This is a long standing bug since "sample accurate" was added and it has to do with how PC speaker samples are "stretched" to fit the render time.

If I had frankly written the PC speaker emulation I would have just done a lazy square wave render whenever PC speaker state changes and the "event queue" thing inherited from SVN wouldn't be there.

I haven't been able to squash this bug yet.

Oh I see, Correct me if I'm wrong, but I haven't seen any open issues regarding this matter. Should I leave this report open for now?

joncampbell123 commented 1 year ago

That's fine. If only to stop others from opening the same bug.