don't click here

Need help with Gens/GS II AV sync

Discussion in 'Technical Discussion' started by GerbilSoft, Mar 29, 2015.

  1. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,971
    76
    28
    USA
    rom-properties
    For a while now, I've been stuck on AV sync issues with Gens/GS II. The current Qt UI is a terrible offender, mostly caused by PortAudio being awful: once it starts stuttering, it gets progressively worse.

    Yesterday, I wrote a simple SDL frontend to see if I could clear it up. The massive stuttering went away, but in its place is audio lag. The audio's at least 4 frames behind video. Reducing the audio buffer causes dropped frames. Also, I need a good way to implement frameskipping.

    I'm looking to see if anyone here has written emulator frontends before and can help me out with the sync issues. The simple SDL frontend is available in my git repository, and it requires cmake, SDL 1.2, and a recent gcc or MSVC (2010+). If using MSVC, make sure you specify: -G "NMake Makefiles" when running CMake, since I'm not sure if the Visual Studio project generator will work correctly.

    Git URLs:
    - git URL for cloning: git://dusers.drexel.edu/srv/git/~korth/gens-gs-ii.git
    - gitweb for gens-sdl-basic-frontend branch: http://www.dusers.drexel.edu/gitweb/gitweb.cgi/~korth/gens-gs-ii.git/shortlog/refs/heads/gens-sdl-basic-frontend

    EDIT: The SDL frontend doesn't have controller input functionality right now, but that isn't needed to tell that there's audio lag. Sonic 1's intro demo should be enough.

    EDIT 2: Added a mapping for one controller. 6BTN on port 1:
    Code (Text):
    1.  
    2. Key mapping:
    3. - MD:  | Up | Down | Left | Right | Start | A | B | C |  Mode  | X | Y | Z |
    4. - Kbd: | Up | Down | Left | Right | Enter | A | S | D | RShift | Q | W | E |
    5.