#ifndef SCHEDULE_H_EF7B9D12 #define SCHEDULE_H_EF7B9D12 class Schedule { public: explicit Schedule( size_t bpm) : bpm_(bpm), tick_(60.0 / static_cast(bpm_)) { } size_t getBPM() const { return bpm_; } void accumulate(double dt) { accum_ += dt; } bool step() { if (accum_ > tick_) { accum_ -= tick_; return true; } else { return false; } } private: size_t bpm_; double tick_; double accum_ = 0.0; }; #endif /* end of include guard: SCHEDULE_H_EF7B9D12 */