Comments (2)
I'll continue our discussion from #3629 here. We probably want to add the flag SDL_AUDIO_ALLOW_FREQUENCY_CHANGE
when we open the SDL audio device.
int sdl_allow_flags = 0;
if (negotiate) {
// We allow chunk size changes (if supported), but don't allow
// frequency changes because we've only seen them go beyond
// SDL's desired 48 Khz limit
#if defined(SDL_AUDIO_ALLOW_SAMPLES_CHANGE)
sdl_allow_flags |= SDL_AUDIO_ALLOW_SAMPLES_CHANGE;
#endif
That's a bit crap. I'd expect to to simply fail with negotiation off if the driver doesn't support that requested rate, and with negotiation on, it should just find the closest driver-supported rate.
The behavior if we add the flag is that it will return the closest thing the platform can do and we have to do the resampling ourselves. With the flag off we're saying "OK SDL this is the type of audio we have, deal with it!" and it will automatically convert the audio if it needs to.
I'd really like disallow any SDL-side resampling whatsoever. Is that possible with some flags? I want it to work as per above, and I want to keep all resampling business in our hands.
I believe this is enough to avoid resampling for our use-case but I'd really have to check the SDL source code to be sure. If we ever use the SDL audio streams, it's a bit different but I'd probably recommend staying away from those and continue using the lower-level callback like we currently are.
There is also some SDL_Hint
flags (which can also be set as environment variables). One of which can use a third-party re-sampler library if available (I think it had "rabbit" in the name or something).
from dosbox-staging.
The behavior if we add the flag is that it will return the closest thing the platform can do and we have to do the resampling ourselves.
That's absolutely what we want! We handle the resampling of all the individual mixer channels to the host rate.
With the flag off we're saying "OK SDL this is the type of audio we have, deal with it!" and it will automatically convert the audio if it needs to.
That's what we absolutely do not want! 😅 No second resampling pass please using some shitty linear interpolation or sample dropping algo 🥶
I believe this is enough to avoid resampling for our use-case but I'd really have to check the SDL source code to be sure.
Great, I'd appreciate that.
If we ever use the SDL audio streams, ...
Extremely unlikely.
...it's a bit different but I'd probably recommend staying away from those and continue using the lower-level callback like we currently are.
Absolutely. We only need a callback that allows us to fill a stereo DAC buffer—and thank you very much SDL, yourd audio duties stop right there 😆
There is also some SDL_Hint flags (which can also be set as environment variables). One of which can use a third-party re-sampler library if available (I think it had "rabbit" in the name or something).
That's good to know, but there's no need for that. We'll just keep using Speex. It does the job very well and has low latency figures, which is super important. I've done a comparison of various resampling libraries, and while, for example, libsamplerate consumes less CPU power, it introduces unacceptably high latencies (in the 30-50ms+ range, from memory—that's a no-go for games).
from dosbox-staging.
Related Issues (20)
- Consider adding Tandy "Direct DAC" patch
- Loadfix command does not work on batch files HOT 4
- Disappears mouse of the Debian HOT 5
- Strange video mode switching in Wing Commander III HOT 2
- Command line history saving can't be disabled HOT 2
- Dunkle Schatten 2 freezes dosbox HOT 10
- Dosbox closed during emulator initialization. HOT 7
- Implement `MODE` Command HOT 3
- MAD TV 2 freezes dosbox HOT 4
- 200 USD bounty for DOSBox Staging Debian package HOT 3
- Add Ghostbusters II to "Game Issues" wiki HOT 2
- Reboot Handler causes a crash
- Blackthorne freezes on startup if Sound Blaster / Sound Blaster Pro is selected for digitized sounds HOT 4
- SIGSEV if the code is compiled with PIE HOT 21
- Dosbox-Staging Linux - Error CDROM: GetTrack at sector 36902 is outside the playable range HOT 8
- On CRT VGA display, Psycho Pinball freezes on high res mode with aspect ratio set to off HOT 7
- Keyboard input delay/locking/queuing in Gods (Bitmap Brothers) HOT 23
- Incremental builds failing
- DOS programs crash from inside Windows 3.1 (Regression from SFT commit) HOT 3
- Flight Simulator 5 Flight Shop Addon fails to install (regression from v0.80.1) HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dosbox-staging.