openMSX
SpeedManager.cc
Go to the documentation of this file.
1#include "SpeedManager.hh"
2
3namespace openmsx {
4
5// class SpeedManager:
6
8 : speedSetting(commandController, "speed",
9 "controls the emulation speed: higher is faster, 100 is normal",
10 100.0, 0.01, 10000.0, Setting::Save::NO)
11 , fastforwardSpeedSetting(commandController, "fastforwardspeed",
12 "controls the emulation speed in fastforward mode: "
13 "higher is faster, 100 is normal speed",
14 2000.0, 0.01, 10000.0)
15 , fastforwardSetting(commandController, "fastforward",
16 "select emulation speed:\n"
17 " on -> fastforward speed ('fastforwardspeed' setting)\n"
18 " off -> normal speed ('speed' setting)",
19 false, Setting::Save::NO)
20{
21 speedSetting.attach(*this);
22 fastforwardSpeedSetting.attach(*this);
23 fastforwardSetting.attach(*this);
24}
25
27{
28 fastforwardSetting.detach(*this);
29 fastforwardSpeedSetting.detach(*this);
30 speedSetting.detach(*this);
31}
32
33void SpeedManager::updateSpeed()
34{
35 speed = (fastforwardSetting.getBoolean() ? fastforwardSpeedSetting : speedSetting)
36 .getDouble() * (1.0 / 100.0);
37 notify();
38}
39
40void SpeedManager::update(const Setting& /*setting*/) noexcept
41{
42 updateSpeed();
43}
44
45} // namespace openmsx
bool getBoolean() const noexcept
SpeedManager(CommandController &commandController)
void detach(Observer< T > &observer)
Definition Subject.hh:60
void attach(Observer< T > &observer)
Definition Subject.hh:54
This file implemented 3 utility functions:
Definition Autofire.cc:11