openMSX
SpeedManager.cc
Go to the documentation of this file.
1 #include "SpeedManager.hh"
2 
3 namespace openmsx {
4 
5 // class SpeedManager:
6 
8  : speedSetting(commandController, "speed",
9  "controls the emulation speed: higher is faster, 100 is normal",
10  100, 1, 10000, Setting::DONT_SAVE)
11  , fastforwardSpeedSetting(commandController, "fastforwardspeed",
12  "controls the emulation speed in fastforward mode: "
13  "higher is faster, 100 is normal",
14  2000, 1, 10000)
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::DONT_SAVE)
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 
33 void SpeedManager::updateSpeed()
34 {
35  speed = (fastforwardSetting.getBoolean() ? fastforwardSpeedSetting : speedSetting)
36  .getInt() / 100.0;
37  notify();
38 }
39 
40 void SpeedManager::update(const Setting& /*setting*/) noexcept
41 {
42  updateSpeed();
43 }
44 
45 } // namespace openmsx
bool getBoolean() const noexcept
SpeedManager(CommandController &commandController)
Definition: SpeedManager.cc:7
void detach(Observer< T > &observer)
Definition: Subject.hh:56
void attach(Observer< T > &observer)
Definition: Subject.hh:50
This file implemented 3 utility functions:
Definition: Autofire.cc:9