Giter Club home page Giter Club logo

Comments (14)

J1mbo avatar J1mbo commented on August 17, 2024 2

@zenzero-2001 I have posted a fixed version in my fork: https://github.com/J1mbo/cannonball

The main change is to run the sound and game in seperate threads, as on the the original hardware which decouples the timing. In the sound / music test menu there is a 'Playback Speed' option, which defaults to 125 and gives an exact speed match to the OutRun 20 years CD rips on YouTube. This gives a sound 'tick' period of exactly 8ms which seems plausible.

from cannonball.

J1mbo avatar J1mbo commented on August 17, 2024 1

Compared to a YouTube video, it does indeed run the same amount slow.

from cannonball.

TwoLeaves avatar TwoLeaves commented on August 17, 2024 1

Hi all. J1mbo, do you mean by the above comment that the Cannonball engine runs the music at the same speed as the original arcade machine (i.e. both "slow" compared to the CD)? If so I'm not sure that's correct, or perhaps there are multiple versions of the arcade machine. When I look at videos of the original machine on YouTube the music seems to run at 126bpm as opposed to this engine which runs at about 120bpm. That is on the "Passing Breeze" track, a good example of which (on original hardware) is here: https://youtu.be/8kM467EHDxE?t=622.

from cannonball.

J1mbo avatar J1mbo commented on August 17, 2024 1

Sorry for the lack of clarity. Yes I agree, the arcade cab is the same as the CD based on what I can find on YouTube.

from cannonball.

djyt avatar djyt commented on August 17, 2024

Verified as an issue.

I have not, as yet, been able to track down what is causing this.

from cannonball.

J1mbo avatar J1mbo commented on August 17, 2024

I think the CDs must have been re-mastered. The speed can be matched by increasing the sample rate to about 45KHz, but the pitch is then quite a lot out (maybe a semi-tone).

from cannonball.

gingerbeardman avatar gingerbeardman commented on August 17, 2024

What about comparing to the original arcade hardware?

from cannonball.

J1mbo avatar J1mbo commented on August 17, 2024

Based on the numbers, my guess is that something is counting to 64 instead of 60.

from cannonball.

J1mbo avatar J1mbo commented on August 17, 2024

The game timers (without fixed applied) appear to be true to the arcade. I haven't been able to alter the music playback speed at all, this one remains a mystery.

from cannonball.

zenzero-2001 avatar zenzero-2001 commented on August 17, 2024

Maybe it is something to do with the segapcm driver? The comment in the code says it is altered from the MAME version to output at a fixed rate of 44.1kHz, maybe there is an issue here? Also, I notice that the clock parameter for the SegaPCM constructor appears to be unused.

It is just an idea, I'm probably barking up the wrong tree.

from cannonball.

J1mbo avatar J1mbo commented on August 17, 2024

The bug was first noted in 2008 in MAME and noone has been able to fix it yet according to this: https://mametesters.org/view.php?id=7211

But I'm not convinced the error is in the Yamaha emulation. I'm wondering if the program sync between the 68k and Z80 might be to blame, I don't really understand enough about what does what on the system board. I was finally able to being the music (broadly) up to speed by adding an audio tick every 20 frames like so:

void OSoundInt::tick()
{
    if (config.fps == 30)
    {
        play_queued_sound(); // Process audio commands from main program code
        osound.tick();
        play_queued_sound();
        osound.tick();
        play_queued_sound();
        osound.tick();
        play_queued_sound();
        osound.tick();
        current_sound_frame += 4;
    }
    else if (config.fps == 60)
    {
        play_queued_sound(); // Process audio commands from main program code
        osound.tick();
        osound.tick();
        current_sound_frame += 2;
    }
    if (current_sound_frame == 20) {
        play_queued_sound(); // JJP - increase music by ~5%
        osound.tick();       // JJP
        current_sound_frame = 0;
   }
}

It might be better to put osound.tick() in a seperate thread then more granular control of the speed could be achieved.

from cannonball.

zenzero-2001 avatar zenzero-2001 commented on August 17, 2024

@J1mbo Thanks for fixing this :-)

from cannonball.

J1mbo avatar J1mbo commented on August 17, 2024

@zenzero-2001 no problem, I have further updated my fork today which I believe 'correctly' fixes this issue as I think it gets the cannonball emulator a bit closer to the way I think the arcade system board works. There are numerous other changes and performance improvements too, most significantly decoupling the game video and SDL2 video rendering (building without SDL2 is almost certainly broken).

from cannonball.

djyt avatar djyt commented on August 17, 2024

This is now fixed in the latest source chcek-in. And I really wish I'd read this thread first. :)

from cannonball.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.