| 1 |
#ifndef SPEEDMANAGER_HH |
| 2 |
#define SPEEDMANAGER_HH |
| 3 |
|
| 4 |
#include "BooleanSetting.hh" |
| 5 |
#include "FloatSetting.hh" |
| 6 |
|
| 7 |
#include "Subject.hh" |
| 8 |
|
| 9 |
namespace openmsx { |
| 10 |
|
| 11 |
class CommandController; |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
class SpeedManager final : public Subject<SpeedManager> |
| 18 |
, private Observer<Setting> |
| 19 |
{ |
| 20 |
public: |
| 21 |
explicit SpeedManager(CommandController& commandController); |
| 22 |
~SpeedManager(); |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
[[nodiscard]] double getSpeed() const { return speed; } |
| 28 |
|
| 29 |
[[nodiscard]] auto& getSpeedSetting() { return speedSetting; } |
| 30 |
[[nodiscard]] auto& getFastForwardSetting() { return fastforwardSetting; } |
| 31 |
[[nodiscard]] auto& getFastForwardSpeedSetting() { return fastforwardSpeedSetting; } |
| 32 |
|
| 33 |
private: |
| 34 |
void updateSpeed(); |
| 35 |
|
| 36 |
|
| 37 |
void update(const Setting& setting) noexcept override; |
| 38 |
|
| 39 |
private: |
| 40 |
FloatSetting speedSetting; |
| 41 |
FloatSetting fastforwardSpeedSetting; |
| 42 |
BooleanSetting fastforwardSetting; |
| 43 |
double speed = 1.0; |
| 44 |
}; |
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
#endif |