fix certain issues with TimeMicros
This commit is contained in:
parent
93f2e638cc
commit
0bae94ad2c
2 changed files with 18 additions and 7 deletions
|
|
@ -2136,9 +2136,8 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
|
|||
// advance tempo accumulator (for virtual tempo) unless we are step playing and waiting for the next step (stepPlay==2)
|
||||
// then advance tick counter and then call nextRow()
|
||||
if (stepPlay!=1) {
|
||||
// fast-forward the accumulator if we are "skipping" (seeking to a position)
|
||||
// otherwise increase accumulator by virtual tempo numerator
|
||||
tempoAccum+=(skipping && virtualTempoN<virtualTempoD)?virtualTempoD:virtualTempoN;
|
||||
// increase accumulator by virtual tempo numerator
|
||||
tempoAccum+=virtualTempoN;
|
||||
// while accumulator is higher than virtual tempo denominator
|
||||
while (tempoAccum>=virtualTempoD) {
|
||||
// wrap the accumulator back
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ struct TimeMicros {
|
|||
}
|
||||
|
||||
// operators
|
||||
inline TimeMicros& operator+(TimeMicros& other) {
|
||||
inline TimeMicros& operator+=(TimeMicros& other) {
|
||||
seconds+=other.seconds;
|
||||
micros+=other.micros;
|
||||
while (micros>=1000000) {
|
||||
|
|
@ -64,11 +64,11 @@ struct TimeMicros {
|
|||
}
|
||||
return *this;
|
||||
}
|
||||
inline TimeMicros& operator+(int other) {
|
||||
inline TimeMicros& operator+=(int other) {
|
||||
seconds+=other;
|
||||
return *this;
|
||||
}
|
||||
inline TimeMicros& operator-(TimeMicros& other) {
|
||||
inline TimeMicros& operator-=(TimeMicros& other) {
|
||||
seconds-=other.seconds;
|
||||
micros-=other.micros;
|
||||
while (micros<0) {
|
||||
|
|
@ -77,7 +77,7 @@ struct TimeMicros {
|
|||
}
|
||||
return *this;
|
||||
}
|
||||
inline TimeMicros& operator-(int other) {
|
||||
inline TimeMicros& operator-=(int other) {
|
||||
seconds-=other;
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -124,4 +124,16 @@ struct TimeMicros {
|
|||
seconds(0), micros(0) {}
|
||||
};
|
||||
|
||||
inline TimeMicros operator+(TimeMicros& t1, TimeMicros t2) {
|
||||
TimeMicros result=t1;
|
||||
result+=t2;
|
||||
return result;
|
||||
}
|
||||
|
||||
inline TimeMicros operator-(TimeMicros& t1, TimeMicros t2) {
|
||||
TimeMicros result=t1;
|
||||
result-=t2;
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue