mirror of
https://github.com/libretro/Mesen.git
synced 2024-12-14 21:08:44 +00:00
32 lines
575 B
C++
32 lines
575 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) override
|
|
{
|
|
Stream(_clocksNeeded);
|
|
}
|
|
|
|
public:
|
|
void Clock()
|
|
{
|
|
if(EmulationSettings::GetOverclockRate(true) == 100) {
|
|
ClockAudio();
|
|
} else {
|
|
_clocksNeeded += 1.0 / ((double)EmulationSettings::GetOverclockRate(true) / 100);
|
|
while(_clocksNeeded >= 1.0) {
|
|
ClockAudio();
|
|
_clocksNeeded--;
|
|
}
|
|
}
|
|
}
|
|
}; |