Compile fix, more accurate timing.

This commit is contained in:
Christian Speckner 2018-07-02 00:23:07 +02:00
parent c270a45409
commit 621e0d9d79
3 changed files with 7 additions and 14 deletions

View File

@ -118,12 +118,6 @@ uInt32 EmulationTiming::cyclesPerFrame() const
return myCyclesPerFrame;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 EmulationTiming::framesPerSecond() const
{
return myFramesPerSecond;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 EmulationTiming::cyclesPerSecond() const
{
@ -170,13 +164,14 @@ void EmulationTiming::recalculate()
throw runtime_error("invalid frame layout");
}
switch (myFrameLayout) {
float framesPerSecond;
switch (myFrameLayout) {
case FrameLayout::ntsc:
myFramesPerSecond = round(mySpeedFactor * 60);
framesPerSecond = mySpeedFactor * 60;
break;
case FrameLayout::pal:
myFramesPerSecond = round(mySpeedFactor * 50);
framesPerSecond = mySpeedFactor * 50;
break;
default:
@ -186,9 +181,9 @@ void EmulationTiming::recalculate()
myCyclesPerFrame = 76 * myLinesPerFrame;
myMaxCyclesPerTimeslice = round(mySpeedFactor * myCyclesPerFrame * 2);
myMinCyclesPerTimeslice = round(mySpeedFactor * myCyclesPerFrame / 2);
myCyclesPerSecond = myCyclesPerFrame * myFramesPerSecond;
myCyclesPerSecond = (round(myCyclesPerFrame * framesPerSecond) / 38) * 38;
myAudioFragmentSize = round(mySpeedFactor * AUDIO_HALF_FRAMES_PER_FRAGMENT * myLinesPerFrame);
myAudioSampleRate = 2 * myLinesPerFrame * myFramesPerSecond;
myAudioSampleRate = myCyclesPerSecond / 38;
myPrebufferFragmentCount = discreteDivCeil(
myPlaybackPeriod * myAudioSampleRate,

View File

@ -46,8 +46,6 @@ class EmulationTiming {
uInt32 cyclesPerFrame() const;
uInt32 framesPerSecond() const;
uInt32 cyclesPerSecond() const;
uInt32 audioFragmentSize() const;
@ -75,7 +73,6 @@ class EmulationTiming {
uInt32 myMinCyclesPerTimeslice;
uInt32 myLinesPerFrame;
uInt32 myCyclesPerFrame;
uInt32 myFramesPerSecond;
uInt32 myCyclesPerSecond;
uInt32 myAudioFragmentSize;
uInt32 myAudioSampleRate;

View File

@ -34,6 +34,7 @@
#include "Console.hxx"
#include "Vec.hxx"
#include "TIA.hxx"
/*
* TODO list