mirror of
https://github.com/libretro/Mesen.git
synced 2024-12-14 21:08:44 +00:00
32 lines
605 B
C++
32 lines
605 B
C++
#pragma once
|
|
#include "stdafx.h"
|
|
#include "Snapshotable.h"
|
|
#include "EmulationSettings.h"
|
|
|
|
class BaseExpansionAudio : public Snapshotable
|
|
{
|
|
private:
|
|
double _clocksNeeded = 0;
|
|
|
|
protected:
|
|
virtual void ClockAudio() = 0;
|
|
|
|
void StreamState(bool saving)
|
|
{
|
|
Stream(_clocksNeeded);
|
|
}
|
|
|
|
public:
|
|
void Clock()
|
|
{
|
|
if(EmulationSettings::GetOverclockRate() == 100 || !EmulationSettings::GetOverclockAdjustApu()) {
|
|
ClockAudio();
|
|
} else {
|
|
_clocksNeeded += 1.0 / ((double)EmulationSettings::GetOverclockRate() / 100);
|
|
while(_clocksNeeded >= 1.0) {
|
|
ClockAudio();
|
|
_clocksNeeded--;
|
|
}
|
|
}
|
|
}
|
|
}; |