2 ZynAddSubFX - a software synthesizer
5 Copyright (C) 2016 Mark McCurry
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.
14 #include "../globals.h"
21 AbsTime(const SYNTH_T
&synth
)
24 void operator++(){++frames
;};
25 void operator++(int){frames
++;};
26 int64_t time() const {return frames
;};
28 float dt() const { return s
.dt(); }
29 float framesPerSec() const { return 1/s
.dt();}
30 int samplesPerFrame() const {return s
.buffersize
;}
37 //Marker for an event relative to some position of the absolute timer
41 RelTime(const AbsTime
&t_
, float sec
)
44 //Calculate time of event
45 float deltaFrames
= sec
*t
.framesPerSec();
46 int64_t tmp
= (int64_t)deltaFrames
;
47 frame
= t
.time() + tmp
;
48 sample
= (int32_t)(t
.samplesPerFrame()*(deltaFrames
-tmp
));
50 bool inThisFrame() {return t
.time() == frame
;};
51 bool inPast() {return t
.time() > frame
;}
52 bool inFuture() {return t
.time() < frame
;}