Comments (14)
@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.
Compared to a YouTube video, it does indeed run the same amount slow.
from cannonball.
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.
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.
Verified as an issue.
I have not, as yet, been able to track down what is causing this.
from cannonball.
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.
What about comparing to the original arcade hardware?
from cannonball.
Based on the numbers, my guess is that something is counting to 64 instead of 60.
from cannonball.
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.
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.
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.
@J1mbo Thanks for fixing this :-)
from cannonball.
@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.
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)
- Do you need some "royalty-free" assets for this Engine in order to make a pseudo open-source remake of OutRun?
- Unable to build on arch linux HOT 2
- Simple Dunno ?
- src/main/engine/ocrash.cpp:863: possible bad expression ?
- No 32 Bits version ?
- Incorrect aspect ratio in widescreen mode
- Game crashed
- Wheel & Pedal Analog Axis not detecting / working properly (Thrustmaster T-GT) HOT 2
- sound/music stutters when leaving road HOT 1
- roms.txt typo
- Changing radio stations is wrong HOT 2
- Game hangs on high score screen HOT 2
- View Change not showing up on Redefine Keys screen/Default View Change key does not work HOT 1
- Refuses to use vJoy device HOT 1
- Phantom cars HOT 1
- Feature Request: What about extending this code to Super Hang-On, etc.?
- Is this project abandoned? HOT 1
- Music changes automatically in Continuous mode HOT 1
- Last Wave doesn't play for full length if no name is input in the high score table
- Command Line option to Play Game without displaying menu
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cannonball.