Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Screen tearing + ArcadeVGA  (Read 7103 times)

0 Members and 1 Guest are viewing this topic.

technocop

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 22
  • Last login:November 03, 2009, 04:55:45 pm
Screen tearing + ArcadeVGA
« on: July 17, 2009, 04:23:07 pm »
Hi,

I've been reading some of the threads about screen tearing, and there seems to be a lot of info, but some contradictory, and nothing that has really helped me fix my screen tearing.

This is how I see it (please correct any wrongness!)

I have a PC running MAME 0.132 with an arcadeVGA card hooked up to my arcade monitor (via a JPAC), Looks prety great, but a lot of games suffer from screen tear, some unbearably so.

I understand that this is because the games are expecting to run at a refresh rate different to that of my video mode, so they are drawing the screen out of sync with my monitor. Most of the acadeVGA modes are 60Hz, but many games run at slightly different rates (Rolling thunder for example runs at 60.606060Hz)

Enabling v-sync or triblebuffering fixes this problem by causing MAME to redraw the screen in sync with what the game expects. However this causes sound glitches as sound data is lost.

There is basically nothing I can do about this??

It seems a shame that I spend so much time and effort getting a proper cab set up, only to find I can't play some of my faves! Has anyone with a similar setup  managed to sort all this out?

I've heard about the "refreshspeed" option whcih is supposed to make MAME adjust the speed of the game to the current video mode's refresh rate. I've not had much luck setting this. Does it work?

Also read something about a major code change between mame version 0.113 and 0.114, and that the older version handled things better. Can anyone explain this to me?

comments appreciated :cheers:

GaryMcT

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 745
  • Last login:September 24, 2014, 11:19:27 am
    • GaryMcT's arcade blog
Re: Screen tearing + ArcadeVGA
« Reply #1 on: July 17, 2009, 04:34:55 pm »
Try -refreshspeed -waitvsync .

The problem that you are running into with the sound skipping is that your monitor refresh rate isn't the same as the original game.  I certain number of sound samples are generated during a frame, and if the time per frame isn't correct, you'll either have too many samples or not enough.  To work around this, -refreshspeed resamples the audio to a different rate which should cause a bit of pitch shifting depending on how far the refresh rate is off.  This should work for all games to get rid of sound overflows and underflows, but it doesn't seem to work in all cases.  I basically try to run games without -waitvsync, and if it's a game where the tearing is noticeable, I try "-refreshspeed -waitvsync".  If that doesn't work, then I try to program a new video mode using power strip that has the proper refresh rate for the game.  I haven't gotten this to work in all cases yet.

I'm a little bummed to hear that this is a problem with ArcadeVGA. . this is the sort of thing that they should be solving.  I'm anal enough about this sort of stuff that I'll probably keep on working on solutions (ie. figuring out why -refreshspeed doesn't always fix the problem in Mame.)
My blog on learning how to develop FPGA versions of arcade boards: http://garymct.blogspot.com


GaryMcT

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 745
  • Last login:September 24, 2014, 11:19:27 am
    • GaryMcT's arcade blog
Re: Screen tearing + ArcadeVGA
« Reply #2 on: July 17, 2009, 04:38:20 pm »
Also, I'd be very interested to hear how the old version dealt with it better.  Maybe the new version could be patched to do the same thing.  Did they do a different resample of the audio?  Would also be interesting to hear if anyone has done anything to make it resample without pitch-shifting.
My blog on learning how to develop FPGA versions of arcade boards: http://garymct.blogspot.com


u_rebelscum

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3633
  • Last login:April 21, 2010, 03:06:26 pm
  • You rebel scum
    • Mame:Analog+
Re: Screen tearing + ArcadeVGA
« Reply #3 on: July 17, 2009, 07:26:03 pm »
Also, I'd be very interested to hear how the old version dealt with it better.  Maybe the new version could be patched to do the same thing.  Did they do a different resample of the audio?  Would also be interesting to hear if anyone has done anything to make it resample without pitch-shifting.

As for new vs old, the old way did have problems, but not as noticeable.  Syncing of the sound to the the video could get off, or produce echos.  The current way locks the sound closer to the video, so there is less un-syncing, and emulation is closer to reality, but resulting in sound cracking.  It is closer to reality emulation, so mamedev will not go back to the less accurate way, period.

Maybe a derivative can come out, but I doubt it.
Robin
Knowledge is Power

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:50:09 pm
    • For Amusement Only e.V.
Re: Screen tearing + ArcadeVGA
« Reply #4 on: July 18, 2009, 06:00:09 am »
cabmame and mameuifx fix this.
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


technocop

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 22
  • Last login:November 03, 2009, 04:55:45 pm
Re: Screen tearing + ArcadeVGA
« Reply #5 on: July 18, 2009, 02:17:27 pm »
Thanks for all those replies - really useful clear info

I tried using refreshspeed in conjunciton with vsync, and it didn't seem to work. I'm not 100% sure though. The sound errors seemed less frequent, but that could have been my imagination. I haven't tried it on many games as yet though

SailorSat - your sound hack in mameuifx works great! The pitch change is unnoticable.  :applaud:

so going to switch to mameuifx, and set vsync and the soundsync option for badly tearing games..

job done

cheers

GaryMcT

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 745
  • Last login:September 24, 2014, 11:19:27 am
    • GaryMcT's arcade blog
Re: Screen tearing + ArcadeVGA
« Reply #6 on: July 19, 2009, 08:50:53 pm »
cabmame and mameuifx fix this.

Hey thanks!  I'll give your patch a try as well.  Yay for not having to fix this myself! :)

Is it true statement that refreshspeed simply changes the games frame-time to match the monitor refresh without changing the audio playback rate?

With a multisync monitor (D9500 in my case), are there any XP restrictions that keep the ArcadeVGA drivers and/or soft15KHz from supporting multiple refresh rates at the same resolution?  I did a little bit of this with PowerStrip, but it is very tedious. :)

Thanks!
Gary
My blog on learning how to develop FPGA versions of arcade boards: http://garymct.blogspot.com


SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:50:09 pm
    • For Amusement Only e.V.
Re: Screen tearing + ArcadeVGA
« Reply #7 on: July 20, 2009, 07:22:47 am »
Depends on your video card.
NVidia is limited to 32 resolution/refresh rates.
ATI has a way higher limit on those. (I think 72)

Another "limit" is that windows lists all refresh rates as rounded values.
So if you have 59.2Hz it will show up as 59Hz, and if you try to add 58.8Hz, it would ALSO show up as 59Hz.

Other than that I see no real limitations.
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


GaryMcT

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 745
  • Last login:September 24, 2014, 11:19:27 am
    • GaryMcT's arcade blog
Re: Screen tearing + ArcadeVGA
« Reply #8 on: July 20, 2009, 01:11:04 pm »
Depends on your video card.
NVidia is limited to 32 resolution/refresh rates.
ATI has a way higher limit on those. (I think 72)

Another "limit" is that windows lists all refresh rates as rounded values.
So if you have 59.2Hz it will show up as 59Hz, and if you try to add 58.8Hz, it would ALSO show up as 59Hz.

Other than that I see no real limitations.


I know driver guys at both ATI and NVidia.  I'll check with them to see if there is any way to basically feed a modeline to the driver dynamically.  I'm set up to run the low resolution mode calculator (lrmc) before launching mame to compute the correct modeline.  I just need a way to tell Windows and/or the display driver what mode to switch to.  Hopefully there is a way to do this.  I really don't want to have to switch to linux to get this all working. :)
My blog on learning how to develop FPGA versions of arcade boards: http://garymct.blogspot.com


SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:50:09 pm
    • For Amusement Only e.V.
Re: Screen tearing + ArcadeVGA
« Reply #9 on: July 20, 2009, 02:17:54 pm »
You could feed the modeline to the registry, and then "reload" the driver while windows is running.
However that doesn't work most times.
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


GaryMcT

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 745
  • Last login:September 24, 2014, 11:19:27 am
    • GaryMcT's arcade blog
Re: Screen tearing + ArcadeVGA
« Reply #10 on: July 20, 2009, 02:35:44 pm »
You could feed the modeline to the registry, and then "reload" the driver while windows is running.
However that doesn't work most times.

There may be some back doors for this sort of thing.  I'll see what I can find out.  I'll start with ATI since a lot of people use their cards for Mame.
My blog on learning how to develop FPGA versions of arcade boards: http://garymct.blogspot.com


GaryMcT

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 745
  • Last login:September 24, 2014, 11:19:27 am
    • GaryMcT's arcade blog
Re: Screen tearing + ArcadeVGA
« Reply #11 on: July 20, 2009, 02:39:39 pm »
On a different note, how well would the sound frequency changing code work if it computed the frequency once and didn't dynamically adjust it?  On my crappy laptop, any system-wide hitch causes the pitch to change fairly dramatically in such a way that it's worse than just dropping audio, etc.  I'll try it out on a faster machine at work.

Also, the audio is Pacman is hugely pitch shifted when the difference between the desired and actual refresh rate is tiny.  What am I doing wrong here?

thanks!
Gary
My blog on learning how to develop FPGA versions of arcade boards: http://garymct.blogspot.com


SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:50:09 pm
    • For Amusement Only e.V.
Re: Screen tearing + ArcadeVGA
« Reply #12 on: July 20, 2009, 05:01:55 pm »
You may want to reduce the sound frequency from 48000 to 44100.
Not every audio chip like frequencies over 48000 (and cause hiccups).
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


GaryMcT

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 745
  • Last login:September 24, 2014, 11:19:27 am
    • GaryMcT's arcade blog
Re: Screen tearing + ArcadeVGA
« Reply #13 on: July 20, 2009, 05:14:31 pm »
You may want to reduce the sound frequency from 48000 to 44100.
Not every audio chip like frequencies over 48000 (and cause hiccups).

Thanks!  I'll give that a try.
My blog on learning how to develop FPGA versions of arcade boards: http://garymct.blogspot.com


zorrobandito

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 134
  • Last login:November 22, 2015, 07:19:44 am
    • Zorro's Classic Games
Re: Screen tearing + ArcadeVGA
« Reply #14 on: July 28, 2009, 08:37:10 am »
I was reading this thread with interest but hadn't got around to testing it yet. I noticed some artefacts in the display for Rolling Thunder and decided to try a few of your suggestions. I fixed it just by running some simple tests. I'm using an original arcade monitor and I've found all games a lot better with these settings. I didn't experience any sound skipping issues.

Thanks for the tips!

[EDIT: Although everything looked good, there were too many games coming up with speed issues to make this a perfect solution. I've reverted back to the old settings and will instead watch out for screen-tearing and create .inis for those titles using the settings below.]]

Here's what works for me (from MAME 0.99):

### Windows video options ###
autoframeskip           1
frameskip               0
waitvsync               1
triplebuffer            0
window                  0
ddraw                   1
direct3d                1
hwstretch               0
# screen                <NULL> (not set)
cleanstretch            auto
resolution              auto
refresh                 0
scanlines               0
switchres               1
switchbpp               1
maximize                1
keepaspect              1
matchrefresh            0
syncrefresh             1
throttle                1
full_screen_brightness   0.000000
frames_to_run           0
effect                  none
screen_aspect           4:3
« Last Edit: July 28, 2009, 10:18:50 am by zorrobandito »

DashRendar

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 488
  • Last login:November 06, 2015, 05:46:52 pm
  • "Don't get your servos in a twist pal."
Re: Screen tearing + ArcadeVGA
« Reply #15 on: September 01, 2009, 04:16:16 pm »
This is a great thread with lots of useful info-  could we add this info to the wiki?
WANTED: Somebody to go back in time with me. This is not a joke. P.O. Box 322, Oakview, CA 93022. You'll get paid after we get back. Must bring your own weapons. Safety not guaranteed. I have only done this once before.