Skip to content
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

SDL support for floating point audio #5449

Open
2 tasks done
joncampbell123 opened this issue Feb 1, 2025 · 2 comments
Open
2 tasks done

SDL support for floating point audio #5449

joncampbell123 opened this issue Feb 1, 2025 · 2 comments
Labels

Comments

@joncampbell123
Copy link
Owner

Describe the bug

Apparently recent versions of SDL2 and SDL3 are only able to provide floating point audio (something to do with Pipewire?).

If you ask for 16-bit PCM, it will still return float. Previous versions of DOSBox-X don't check if it changed.

Fortunately the mixer callback in DOSBox-X is a simple function and could be copies to make a 32-bit float version easily enough.

Steps to reproduce the behaviour

Run DOSBox-X in an environment that doesn't provide 16-bit PCM, observe loud distorted noise.

Expected behavior

No response

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

Linux, with Pipewire

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

All previous and current versions.

Used configuration

Output log


Additional information

No response

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

  • I have searched and didn't find any similar bug report.

Code of Conduct & Contributing Guidelines

  • I agree to follow the code of conduct and the contributing guidelines.
@joncampbell123
Copy link
Owner Author

While we're at it, the mixer code should probably also validate that SDL chose the number of channels requested (stereo) as well.

@Jookia
Copy link
Contributor

Jookia commented Feb 1, 2025

SDL will automatically convert your requested audio to the host's audio, so you can ask for any rate/frequency/format and it will do the conversion. But you can also ask it to give you a rate/frequency/format and it will give you the best option available within your constraints. As of 75aa320 the DOSBox-X code requests 16-bit PCM with any frequency/sample rate and gets back a stream that's converted by SDL to 32-bit float internally.

DOSBox-X was previously asking for ANY format, not just 16-bit PCM. So it got float instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants