,XX support for global tempo

master
zetaPRIME 2022-03-15 19:54:57 -04:00
parent c168ed95d3
commit 9455834b2a
2 changed files with 15 additions and 3 deletions

2
notes
View File

@ -41,7 +41,7 @@ TODO {
distortion effect
add ,XX support to global tempo
- add ,XX support to global tempo
}
qt update causing some patchboard artifacting on mouse movement

View File

@ -476,8 +476,20 @@ void AudioEngine::nextTick() {
// process global commands first
for (int c = 0; c < static_cast<int>(p->numChannels()); c++) {
if (auto& row = p->rowAt(c, curRow); row.port == -2 && row.params) {
for (auto p : *row.params) {
if (p[0] == 't' && p[1] > 0) tempo = p[1];
auto& p = *row.params;
auto n = p.size();
for (size_t i = 0; i < n; i++) {
if (p[i][0] == 't') { // tempo
auto ot = tempo;
tempo = p[i][1];
double m = 1.0;
while (i < n-1 && p[i+1][0] == ',') { // param notation: little-endian
m *= 256.0;
tempo += m*p[i+1][1];
i++;
}
if (tempo <= 1) tempo = ot; // reject tempo changes below 1bpm for safety
}
}
}
}