Go to the documentation of this file.
8 unsigned newMinInts,
unsigned newMaxInts, std::string_view name)
9 : min_ints(std::
max(newMinInts, 1u))
10 , max_ints(std::
max(newMaxInts, min_ints + 1))
11 , speedSetting(commandController, name,
12 "controls the speed of this autofire circuit", 0, 0, 100)
13 , clock(EmuTime::zero())
16 speedSetting.
attach(*
this);
21 speedSetting.
detach(*
this);
24 void Autofire::setClock()
26 int speed = speedSetting.
getInt();
28 (2 * 50 * 60) / (max_ints - (speed * (max_ints - min_ints)) / 100));
31 void Autofire::update(
const Setting& setting)
34 assert(&setting == &speedSetting);
40 return speedSetting.
getInt() == 0 ?
void setFreq(unsigned freq)
Change the frequency at which this clock ticks.
void detach(Observer< T > &observer)
constexpr vecN< N, T > max(const vecN< N, T > &x, const vecN< N, T > &y)
void attach(Observer< T > &observer)
bool getSignal(EmuTime::param time)
Get the output signal in negative logic.
int getInt() const noexcept
Autofire(CommandController &commandController, unsigned newMinInts, unsigned newMaxInts, std::string_view name)
unsigned getTicksTill(EmuTime::param e) const
Calculate the number of ticks for this clock until the given time.
This file implemented 3 utility functions: