[Partially-Solved] PCem v12 and Sound Lag

Support and general discussion.
Malik
Posts: 17
Joined: Sat 20 May, 2017 2:43 am

[Partially-Solved] PCem v12 and Sound Lag

Postby Malik » Tue 23 May, 2017 5:23 am

I have tried running the v12 PCem on 2 of my machines : i7 4790K Desktop and Core M Dell Tablet, both running Windows 10 Pro, and on both I face the audio lags which seem to be distracting in an otherwise, a very good effort of emulating the older PCs.

I'm running the 430VX configuration and installed Win95 OSR2 on a 8GB virtual drive. Dynamic Recompile is ticked and greyed out.
RAM - 128MB
AWE32 with 28MB RAM
Video - S3 Virge DX 4MB
Voodoo2 - Enabled
Using Daemon Tools virtual CD drive for the CD emulation

Emulation speed hovers around 100% (99% - 101%)

I have read over here about these lags, but couldn't get a conclusive outcome yet if this issue is solved. There was a thread here https://pcem-emulator.co.uk/phpBB3/viewtopic.php?f=2&t=612&start=30&hilit=audio+lag regarding compiling again with two modified files by the admin, SarahWalker, and not sure if those have been implemented in this latest build.

I have tried compiling but as I have never compiled in windows before (all I used to compile were just MUNT and Timidity in TinyCore Linux), I face one hurdle after another when it comes to compiling pcem (a long story - spent 4 days without success but many errors - before coming here for help). I also grabbed the all-in-one compiling file, where I just run the batch file after placing the downloaded files into the source directory, with the 2 modified files replaced in the src dir, taken from the above link. But that resulting, built executable had worse audio skipping... :(

Is this problem completely solved yet? Or the audio lag is still persistent? If it has been successfully recompiled, will it help if I can try that built binary on my systems?

MIDI music and CD audio in games (playing Entomorph: Plague of the Darkfall) plays nice. No skipping and smooth. Just the sound effects are lagging a few microseconds, I think. It's quite distracting. And more apparent in dialogues - the lip syncing is out (Philip Marlowe - Private Eye).

Thank you for any info.


And thank you for this great emulator. It brings back lots of good memories for installing and playing around with DOS in classic machines and Windows95. If only the audio lag is solved, it would be perfect. (I have some Windows 95 games that I would love to continue playing in Win95 setup , and so far PCem is the only one that could make this happen, speed-wise and accuracy-wise, and my focus is the 430VX with Win95 gaming.
Last edited by Malik on Wed 07 Jun, 2017 4:29 am, edited 2 times in total.
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: PCem v12 and Sound Lag

Postby Battler » Tue 23 May, 2017 3:03 pm

It might be the really old GCC Sarah is still compiling with, since it does seem that her builds have this lag, while builds compiled with newer GCC (eg. 5.x or 6.x) do not have that lag.
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

Re: PCem v12 and Sound Lag

Postby basic2004 » Tue 23 May, 2017 4:03 pm

I felt audio latency sometimes, so I want change audio buffer(milisecond) with sound configuration. (and change sample rates, audio out device too)

Malik, can you test with current development version?
You can compile this source with compiling tools (gcc 5.3.0-3)
viewtopic.php?t=615#p4364

But current development version need... move your .cfg files to 'configs' folder before execute PCem because this changed pcem.cfg with configuration manager. (current development version only)

Stable PCem v12 has src folder, too. you can compile stable version's source and compare them.
Katakis
Posts: 66
Joined: Thu 05 Mar, 2015 6:42 am

Re: PCem v12 and Sound Lag

Postby Katakis » Wed 24 May, 2017 2:25 am

Malik wrote:I face one hurdle after another when it comes to compiling pcem (a long story - spent 4 days without success but many errors - before coming here for help).

Yes, compiling PCem is a bit scary for those who are new to the emulator, especially when there is a lot of files involved, you have no idea what file you should start with.

Battler wrote:It might be the really old GCC Sarah is still compiling with, since it does seem that her builds have this lag, while builds compiled with newer GCC (eg. 5.x or 6.x) do not have that lag.

Well, Sarah reduced the audio buffer so that it would not be noticeable enough, and I doubt that she will change it again just to benefit one user.

This may be irrelevant, but I was told it depends on how powerful your host machine is. I have a Intel Core i7 with 16GB RAM installed, and I can run most games in PCem at a reasonable speed, but I am not sure if I can run a lot of FPSes with 3DFX/Voodoo enabled.
Malik
Posts: 17
Joined: Sat 20 May, 2017 2:43 am

Re: PCem v12 and Sound Lag

Postby Malik » Wed 24 May, 2017 9:23 am

Thanks, I will try to compile again with the latest gcc.
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: PCem v12 and Sound Lag

Postby Battler » Wed 24 May, 2017 1:51 pm

- Katakis: He said the emulator runs on 100%, so the emulation speed is not the problem here. I think it has to do with old GCC and the probably more buggy OpenAL library it has.
Malik
Posts: 17
Joined: Sat 20 May, 2017 2:43 am

Re: PCem v12 and Sound Lag

Postby Malik » Sun 28 May, 2017 10:54 am

I have successfully compiled it on my desktop.

I still notice the lag. I tried DoomII and Gods. A very small lag, but still noticeable. About ½ or ¾ of a second lag. I tried this in a i486DX2-66 configuration with SB16 card.

If anyone does NOT have any lag, is it possible to share the executable so that I may try it on my machine?

I'm just wondering if this problem is only faced by a few or is prevalent throughout.

I guess only those game will notice the lag?

Thanks.


Edit: Pre-rendered screens seem to be okay. The intro in Chaos Overlords seem to play accordingly. The voice comes and stops with the speaking character in that cutscene. I've yet to try to play some movies to check.

Edit 2: Yes, I tried with the latest gcc 5.3.. with the src folder from the main pcem download here.
Katakis
Posts: 66
Joined: Thu 05 Mar, 2015 6:42 am

Re: PCem v12 and Sound Lag

Postby Katakis » Sun 28 May, 2017 12:14 pm

In src/ibm.h, there is a line that reads "#define SOUNDBUFLEN 48000/20". The first number indicates the bit rate, while the second is the number of milliseconds that pass before the sound is played.

Try reducing the second number down to 10 or 15, then compile again. See if this works.
szadycbr
Posts: 185
Joined: Mon 21 Nov, 2016 6:23 pm

Re: PCem v12 and Sound Lag

Postby szadycbr » Sun 28 May, 2017 1:08 pm

@Katakis, The first number is not bit rate but Words divided by that second number, i thought that it was bit rate too, but we covered that topic extensively in here viewtopic.php?f=2&t=612&hilit=sound+lag#p4322 and kindly people (Battler) explained everything to me, i advice you to read all of this.
Katakis
Posts: 66
Joined: Thu 05 Mar, 2015 6:42 am

Re: PCem v12 and Sound Lag

Postby Katakis » Sun 28 May, 2017 1:50 pm

szadycbr wrote:@Katakis, The first number is not bit rate but Words divided by that second number

OK, I stand corrected.
szadycbr
Posts: 185
Joined: Mon 21 Nov, 2016 6:23 pm

Re: PCem v12 and Sound Lag

Postby szadycbr » Sun 28 May, 2017 3:40 pm

@Katakis , no worries , i did not know that either.
Malik
Posts: 17
Joined: Sat 20 May, 2017 2:43 am

Re: [Solved] PCem v12 and Sound Lag

Postby Malik » Mon 29 May, 2017 6:57 am

Thank you everyone.

I looked back at the previous link once more, and took the hint and tried deleting the OpenAL32.dll in the PCem folder, the one that comes with the official PCem release here.

And since I am using my own compiled executable, it doesn't need the version that is included with the release, I guess.

Now there is no more lag.

Thank you!

P.S. Is it possible to fix this on the next release so that end-users (like me, who are not very experienced in compiling on our own) can directly experience PCem without the need to re-compile and use the newer OpenAL? Thanks again.
User avatar
omarsis81
Posts: 545
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Solved] PCem v12 and Sound Lag

Postby omarsis81 » Mon 29 May, 2017 12:35 pm

Malik wrote:P.S. Is it possible to fix this on the next release so that end-users (like me, who are not very experienced in compiling on our own) can directly experience PCem without the need to re-compile and use the newer OpenAL? Thanks again.


That would be great! Provided there's no disadvantage on using the newer version... what do you say Sarah?
User avatar
James-F
Posts: 69
Joined: Tue 30 May, 2017 10:26 am

Re: [Solved] PCem v12 and Sound Lag

Postby James-F » Tue 30 May, 2017 5:49 pm

Hi.
I experience the audio lag too.
I've tried to to compile the latest build but with no success.

I've tried this method: https://pcem-emulator.co.uk/phpBB3/viewtopic.php?t=615#p4364
It compiles but the executable crashes with an error.
error.jpg
error.jpg (27.33 KiB) Viewed 1779 times


When I try to compile the normal way with mingw32-make.exe -f Makefile.mingw I get this error:

Code: Select all

gcc.exe -O3 -march=i686 -fomit-frame-pointer -msse2 -mstackrealign -Wall -Werror -fno-strict-aliasing -c soundopenal.c
soundopenal.c:6:19: fatal error: AL/al.h: No such file or directory
compilation terminated.
Makefile.mingw:41: recipe for target 'soundopenal.o' failed
mingw32-make.exe: *** [soundopenal.o] Error 1
mingw32-make.exe: *** Waiting for unfinished jobs....
C:\MinGW\msys\1.0\home\TESTER\pcem\src>pause
Press any key to continue . . .



Is there any other simple way to compile the latest dev build?
Last edited by James-F on Tue 30 May, 2017 6:30 pm, edited 1 time in total.
AnnaWu
Posts: 37
Joined: Mon 12 May, 2014 6:10 pm
Location: Germany
Contact:

Re: [Solved] PCem v12 and Sound Lag

Postby AnnaWu » Tue 30 May, 2017 6:29 pm

James-F wrote:Hi.
I experience the audio lag too.
I've tried to to compile the latest build but with no success.

I've tried this method: https://pcem-emulator.co.uk/phpBB3/viewtopic.php?t=615#p4364
It compiles but the executable crashes with an error.
error.jpg

Is there any other simple way to compile the latest dev build?


I guess you tried commit 5e03bfb
Try the commit f49399a
https://bitbucket.org/pcem_emulator/pce ... af48e7.zip
User avatar
James-F
Posts: 69
Joined: Tue 30 May, 2017 10:26 am

Re: [Solved] PCem v12 and Sound Lag

Postby James-F » Tue 30 May, 2017 6:40 pm

Yes I downloaded the newest source from Bitbucket, why you say it wouldn't work?

EDIT:
I get the same dll errors with the link with the source you provided.
I just place the compiled exe intot the V12 PCem directory.

EDIT2:
Alright, it works!
I had to copy the same dll's form minGW\bin because the ones with V12 are older.

EDIT3:
There is still dependency on OpenAL32.dll, and I still hear huge sound lag and clicks.
I still can't delete OpenAL32.dll, the latest dev compiled cries for this file...
Any suggestions?
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

Re: [Solved] PCem v12 and Sound Lag

Postby basic2004 » Wed 31 May, 2017 7:54 am

James-F wrote:Yes I downloaded the newest source from Bitbucket, why you say it wouldn't work?

EDIT:
I get the same dll errors with the link with the source you provided.
I just place the compiled exe intot the V12 PCem directory.

EDIT2:
Alright, it works!
I had to copy the same dll's form minGW\bin because the ones with V12 are older.

EDIT3:
There is still dependency on OpenAL32.dll, and I still hear huge sound lag and clicks.
I still can't delete OpenAL32.dll, the latest dev compiled cries for this file...
Any suggestions?


libstdc dll error
this was different between sjlj and dwarf.
PCem v12 stable used sjlj, this development compiled with dwarf.
You should copy libstdc*.dll to PCem which you compiled.
User avatar
James-F
Posts: 69
Joined: Tue 30 May, 2017 10:26 am

Re: [Solved] PCem v12 and Sound Lag

Postby James-F » Wed 31 May, 2017 9:15 am

basic2004 wrote:You should copy libstdc*.dll to PCem which you compiled.

Thanks, this part I already figured out in edit #2 of the previous post.
But this is good piece of information for future users.

Now the problem is I can't delete OpenAL32.dll from PCem directory to lower the latency, the compiled executable it is still dependent on it.
I read people delete OpenAL32.dll without problems after compiling the latest dev source.
What do you think can be the problem?

EDIT:
Okay, the stuttering was actually gone with the compiled dev version but it still had some lag compared to dosbox that I'm used to.
Ive lowered the buffers to 48000/50 in imb.h and now everything is perfect.

I don't know if it is already been mentioned by the buffers should undoubtedly be part of the configurations for the end user, without having to tweak the source code learning to compile it.
AnnaWu
Posts: 37
Joined: Mon 12 May, 2014 6:10 pm
Location: Germany
Contact:

Re: [Solved] PCem v12 and Sound Lag

Postby AnnaWu » Wed 31 May, 2017 10:46 am

Check my PM
User avatar
James-F
Posts: 69
Joined: Tue 30 May, 2017 10:26 am

Re: [Solved] PCem v12 and Sound Lag

Postby James-F » Wed 31 May, 2017 10:50 am

Thanks.
I managed to lower latency, so it's not an issue anymore.
But I still want to know why my compiled version cries for OpenAL32.dll, I followed the compilation guide 1:1.
openal32 cry.jpg
openal32 cry.jpg (20.77 KiB) Viewed 1662 times
AnnaWu
Posts: 37
Joined: Mon 12 May, 2014 6:10 pm
Location: Germany
Contact:

Re: [Solved] PCem v12 and Sound Lag

Postby AnnaWu » Wed 31 May, 2017 10:56 am

Check my PM again.
User avatar
James-F
Posts: 69
Joined: Tue 30 May, 2017 10:26 am

Re: [Solved] PCem v12 and Sound Lag

Postby James-F » Wed 31 May, 2017 1:50 pm

Okay the OpenAL32.dll actually exist but in the MinGW or Windows directory somewhere and the PATH environment variable points to it.
So users who delete OpenAL32.dll from PCem folder actually use a newer OpernAL32.dll from MinGW that does not stutter.

So everything seems to be in order, just compile the latest dev build and lower the buffers to 48000/50 in ibm.h and the delay will be negligible.
Note that I had to include the newer OpenAL32.dll from mingw\gcc-5.3.0-3\bin to PCem provided with the all-in=one compilation.
User avatar
leilei
Posts: 435
Joined: Fri 25 Apr, 2014 4:47 pm

Re: [Solved] PCem v12 and Sound Lag

Postby leilei » Sat 03 Jun, 2017 12:18 pm

In my case, just using a recent OpenAL-Soft DLL in place helped latency issues, and that's probably where that dll came from anyway (i'm still using an older GCC/MinGW)
Malik
Posts: 17
Joined: Sat 20 May, 2017 2:43 am

Re: [Solved] PCem v12 and Sound Lag

Postby Malik » Sat 03 Jun, 2017 3:30 pm

I would like to add that, as a newbie, like me, I HIGHLY recommend Batttler's latest 86Box build (preferably the "Optimized Builds" by Battler.

His build is a fork of PCem but has many improvements including no-lag audio from the download, and will save many, many headaches of compiling and getting the dependencies for the compilers and so on, for the sound lag issues.

His build is even better than my own compiling, I think, for eliminating the audio lags. I feel it's as good as playing the games in Dosbox.

And there are many desperately needed shortcuts included in Battler's 86Box, like Ctrl-Alt-Del shortcut and switch to full-screen shortcut, and the ability of directing MIDI to MUNT - the MT-32 Emulator, even if using any sound card lower than a SB16. (In official PCem, you can't select MIDI out if the sound card is from a previous generation from a SB16).

Thanks a lot, Battler! I'm now using solely your build now (Haswell optimized - in both my desktop and laptop)

(Sorry Sarah, that I needed to recommend Battler's 86Box build here. But I still would like to suggest to update on the sound lags in the official PCem. It's an excellent emulator btw, and I can safely retire my actual 486 and Win9x machines, thanks to you too and Tom(?).)
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: [Solved] PCem v12 and Sound Lag

Postby Battler » Sat 03 Jun, 2017 3:37 pm

Malik wrote:And there are many desperately needed shortcuts included in Battler's 86Box, like Ctrl-Alt-Del shortcut and switch to full-screen shortcut, and the ability of directing MIDI to MUNT - the MT-32 Emulator, even if using any sound card lower than a SB16. (In official PCem, you can't select MIDI out if the sound card is from a previous generation from a SB16).

While you get the selection in 86Box for any card, the MPU-401 is still only active if you use the SB16 or AWE32. Now maybe I should add a checkbox for MPU-401 so that you can use it as an add-on device with other cards as well, but of course that would be ignored when the SB16 or AWE32 is selected.
User avatar
James-F
Posts: 69
Joined: Tue 30 May, 2017 10:26 am

Re: [Solved] PCem v12 and Sound Lag

Postby James-F » Sat 03 Jun, 2017 4:01 pm

Do it Battler.
MPU-401 is an ISA card in itself, and should live happy along side a SBPro.
SarahWalker
Site Admin
Posts: 1332
Joined: Thu 24 Apr, 2014 4:18 pm

Re: [Solved] PCem v12 and Sound Lag

Postby SarahWalker » Sat 03 Jun, 2017 5:25 pm

Malik wrote:I would like to add that, as a newbie, like me, I HIGHLY recommend Batttler's latest 86Box build (preferably the "Optimized Builds" by Battler.

Want to see Battler's changes in mainline? Convince him to start working with me again, instead of being an utter tit. I gave up on anything being submitted back a long time ago.
User avatar
omarsis81
Posts: 545
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Solved] PCem v12 and Sound Lag

Postby omarsis81 » Sat 03 Jun, 2017 6:20 pm

SarahWalker wrote:
Malik wrote:I would like to add that, as a newbie, like me, I HIGHLY recommend Batttler's latest 86Box build (preferably the "Optimized Builds" by Battler.

Want to see Battler's changes in mainline? Convince him to start working with me again, instead of being an utter tit. I gave up on anything being submitted back a long time ago.


I suspect you don't like Battler's fork.
I don't know what happened between you both, but I'm sure both want the best for PCem.

Maybe he has bad temper some days but is a valuable programmer.
User avatar
James-F
Posts: 69
Joined: Tue 30 May, 2017 10:26 am

Re: [Solved] PCem v12 and Sound Lag

Postby James-F » Sat 03 Jun, 2017 6:31 pm

Indeed, I don't want to see two forks go different ways, this is indeed bad for the future of this great PC emulator.
Please make up, and know that fights also happen in the best of families. :)
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: [Solved] PCem v12 and Sound Lag

Postby Battler » Sat 03 Jun, 2017 6:41 pm

SarahWalker wrote:Want to see Battler's changes in mainline? Convince him to start working with me again, instead of being an utter tit.

I thought I said just today in another thread that I was going to make a NukedOPL diff later today in another thread, so how am I refusing to contribute?

Return to “General”

Who is online

Users browsing this forum: Bing [Bot] and 5 guests