LMMS
Loading...
Searching...
No Matches
CallbackRepeater.cpp
Go to the documentation of this file.
1/*
2 ZynAddSubFX - a software synthesizer
3
4 CallbackRepeater.cpp - Timed Callback Container
5 Copyright (C) 2016 Mark McCurry
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11*/
12#include "CallbackRepeater.h"
13
14namespace zyncarla {
15
17 :last(time(0)), dt(interval), cb(cb_)
18{}
19
21{
22 auto now = time(0);
23 if(now-last > dt && dt >= 0) {
24 cb();
25 last = now;
26 }
27}
28
29}
Definition zynaddsubfx-src.cpp:569
const AbsTime * time
Definition PADnoteParameters.h:189
void tick(void)
Definition CallbackRepeater.cpp:20
std::time_t dt
Definition CallbackRepeater.h:29
CallbackRepeater(int interval, cb_t cb_)
Definition CallbackRepeater.cpp:16
cb_t cb
Definition CallbackRepeater.h:30
std::time_t last
Definition CallbackRepeater.h:28
std::function< void(void)> cb_t
Definition CallbackRepeater.h:20