diff --git a/src/emucore/EmulationTiming.cxx b/src/emucore/EmulationTiming.cxx index 80f29e084..3d74194a0 100644 --- a/src/emucore/EmulationTiming.cxx +++ b/src/emucore/EmulationTiming.cxx @@ -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, diff --git a/src/emucore/EmulationTiming.hxx b/src/emucore/EmulationTiming.hxx index 578844e4e..f0bc9cfaa 100644 --- a/src/emucore/EmulationTiming.hxx +++ b/src/emucore/EmulationTiming.hxx @@ -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; diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 6b620d6c6..638f43579 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -34,6 +34,7 @@ #include "Console.hxx" #include "Vec.hxx" +#include "TIA.hxx" /* * TODO list