Question about the audio

Support and general discussion.
Post Reply
User avatar
Commander Keen
Posts: 10
Joined: Sun 15 Mar, 2015 8:26 am

Question about the audio

Post by Commander Keen »

Hi Tom:

As always, thanks for your excellent contribution to the open-source world. I'd argue that PCem is Bochs "done right" in every way imaginable.

Curious... is it possible to run the audio stream on its own thread? I'm trying to find a way to eliminate stuttering any time the emulated CPU dips below 100%.
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Question about the audio

Post by SarahWalker »

No, because the audio emulation deliberately runs in sync with the emulated CPU. Hence it runs out of data when the CPU drops below 100%. The obvious workaround is to slow the emulated system so that it doesn't drop below 100%!

It's a bit more like a SNES emulator or something rather than a traditional virtual machine, in that you're aiming to achieve a fixed specification and if your host machine isn't running the emulator fast enough then everything slows down - including sound.
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: Question about the audio

Post by Battler »

Is there any way to modify the audio emulated code to not run out of data when the CPU drops below 100%?
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Question about the audio

Post by SarahWalker »

Not without rewriting the entire audio system, which will result in breaking anything which requires synchronisation between CPU and audio device.

Even if this was done, you'd likely still end up with slowdown when playing MIDI, which varied with the speed of the emulator. Not worth it.

In any case, when the speed drops below 100% everything slows down, sound is just the most obvious. So why insist on trying to push it beyond what your machine can actually do?
ecksemmess
Posts: 183
Joined: Wed 18 Mar, 2015 5:27 am

Re: Question about the audio

Post by ecksemmess »

I totally agree, Tom. Actually, I consider the audio stuttering upon slowdown to be a feature, not a bug. I strongly value accuracy and authenticity, so I like to avoid running below 100% whenever possible. It's very convenient to have an unmistakable cue to alert me to the fact that that's happening, without having to constantly keep an eye on the title bar (especially given that I spend most of my time in fullscreen). If the audio stuttering were somehow smoothed over, that'd actually be a big pain.
User avatar
Commander Keen
Posts: 10
Joined: Sun 15 Mar, 2015 8:26 am

Re: Question about the audio

Post by Commander Keen »

Hi Tom,

Thanks for your explanation on this point. It makes perfect sense. I'll try emulating a slower CPU, like a 486 DX2 and see what happens.
Post Reply