,XX support for global tempo
parent
c168ed95d3
commit
9455834b2a
2
notes
2
notes
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue