Menu

Strange behaviour vsync and 22050 audio sample rate on Raspberry Pi 3

Yami
2016-11-12
2016-11-20
  • Yami

    Yami - 2016-11-12

    Hi,
    since I had a lot of tearing in Advancemame 1.5 on Raspberry Pi 3 and since I have read that to enable Vsync on Linux it's necessary to run the emulator as root, I typed:

    chown root:root /usr/local/bin/advmame
    chmod u+s /usr/local/bin/advmame
    

    But when I try to run advmame as root (or with "sudo") it stops after copyright notice (that of Nicola Salmoria etc...). If I don't call any rom, I get the "regular" error of missing rom name, so I guess the emulator is properly started... but for some reason I cannot run any game.

    Of course I can run advmame normally as a regular user (pi).

    I've also found that if I lower the sound sampling rate to 22050, tearing is greatly reduced but sound has a visible delay (almost 1 second).

    Any suggestion?
    Thanks

     

    Last edit: Yami 2016-11-13
  • Yami

    Yami - 2016-11-13

    I may have found a fix for the audio delay issue on lower sampling rates. Setting

    debug_rawsound yes
    

    It seems to give correct audio timing in 22050 sampling rate on Raspberry (but I have not found any additional information about this option).

    BTW, I'm really impressed on how AdvanceMAME runs on Raspberry Pi 3 without any optimization: I get a fix 100% - 100% (so, no frameskip) on many games (Final Fight, Golden Axe, Undercover Cops, Night Slashers etc.) with Magnify 2, Fractional scaling, Mean filtering and Triad6dot RGB effect on my LCD at 1920x1080@60!

    I wonder if performance will be furter improved with next SDL2-2.0.4 (that uses a hardware accelerated OpenGLES2 renderer for the frame buffer to speed up screen drawing).

    Now I have to figure out how to avoid the (sporadic) tearing without activating Vsync (still I can't run AdvanceMAME as root).

    Thanks

     

    Last edit: Yami 2016-11-13
  • Andrea Mazzoleni

    Hi Yami,

    The "rawsound" option disable the syncronism between audio and video. If it works for you OK, but in general it could result in garbled sound.

    Maybe try using the "-log" option to get an advmame.log file. This could help in both the audio and video issue.

    Alternative approaches could be to select a different audio driver, with "-device_sound alsa/oss/sdl" and play with other options, like the "-sound_latency 0.1"
    and "-device_sdl_samples 2048" (when using SDL)

    About the video, what driver are you using ? SDL or FrameBuffer ? Are you starting it from Xwindow ?
    From discussion with other users, the FrameBuffer should be already able to scale the image, avoiding the need for AdvanceMAME to use fractional scaling.

    Anyway, I ordered my first Raspberry, so I suppose that AdvanceMAME will get beffer support for it in the near future :)

    Ciao,
    Andrea

     
    • Yami

      Yami - 2016-11-14

      Ciao Andrea,
      great news, welcome to the Raspberry community! :D
      AdvanceMAME (as AdvanceMENU) already runs well on Raspberry Pi 3, but I suspect it would benefit a lot in terms of performance with a little bit of "love" and optimization.

      Actually:

      • there is this strange "delay" issue with audio sampling rate lower than 44100 (no changes with different audio driver or sound latency value). In "rawsound" it is OK but also a bit garbled.

      • in AdvanceMENU audio (MP3) is garbled too (no workaround discovered until now...)

      Topics of interests:

      Really I can't wait to read your findings about an "official support" of Advance Projects on Raspberry. Thank you very much (please keep us informed!)

       
      • Andrea Mazzoleni

        Hi Yami,

        OK, I made a first bunch of changes. It's a kind of pre-release for Raspberry.

        You can get it from git, or downloading it from: http://beta.advancemame.it/

        It fixes the build problem, the garbled sound in AdvanceMENU, and I hope also the sound delay in AdvanceMAME. There are also a bit of other minor issues fixed.

        Please let me know if this address the issues you found. If not, please provide the log produced with "advmame -log".

        I've also updated some docs to include Raspberry

        https://github.com/amadvance/advancemame/blob/master/doc/build.d
        https://github.com/amadvance/advancemame/blob/master/doc/install.d

        It's all still work in progress, but it's definitively better than before.

        Next things to work out is the vsync, and the real-time resolution switch.

        Ciao,
        Andrea

         

Log in to post a comment.