| @@ -1166,13 +1166,23 @@ float tMBTriangle_tick(tMBTriangle* const osc) · 1165 unmodified lines |
| 1166 | 1166 | a = 0.5f; // when a = 1, LPfilter is disabled |
| 1167 | 1167 | |
| 1168 | 1168 | t = freq / leaf->sampleRate; |
| 1169 | | − if (t < 1e-5f) t = 1e-5f; |
| 1170 | | − if (t > 0.5f) t = 0.5f; |
| 1171 | | − dw = (t - w) ; |
| 1169 | + |
| 1170 | + if (t >= 0) |
| 1171 | + { |
| 1172 | + if (t < 1e-5f) t = 1e-5f; |
| 1173 | + if (t > 0.5f) t = 0.5f; |
| 1174 | + } |
| 1175 | + else |
| 1176 | + { |
| 1177 | + if (t > -1e-5f) t = -1e-5f; |
| 1178 | + if (t < -0.5f) t = -0.5f; |
| 1179 | + } |
| 1180 | + |
| 1181 | + dw = (t - w); |
| 1172 | 1182 | t = 0.5f * (1.0f + c->waveform ); |
| 1173 | 1183 | if (t < w) t = w; |
| 1174 | 1184 | if (t > 1.0f - w) t = 1.0f - w; |
| 1175 | | − db = (t - b) ; |
| 1185 | + db = (t - b); |
| 1176 | 1186 | |
| 1177 | 1187 | w += dw; |
| 1178 | 1188 | b += db; |
| @@ -1357,8 +1367,18 @@ float tMBSaw_tick(tMBSaw* const osc) · 178 unmodified lines |
| 1357 | 1367 | if (c->_init) { |
| 1358 | 1368 | p = 0.5f; |
| 1359 | 1369 | w = freq / leaf->sampleRate; |
| 1360 | | − if (w < 1e-5f) w = 1e-5f; |
| 1361 | | − if (w > 0.5f) w = 0.5f; |
| 1370 | + |
| 1371 | + if (w >= 0) |
| 1372 | + { |
| 1373 | + if (w < 1e-5f) w = 1e-5f; |
| 1374 | + if (w > 0.5f) w = 0.5f; |
| 1375 | + } |
| 1376 | + else |
| 1377 | + { |
| 1378 | + if (w > -1e-5f) w = -1e-5f; |
| 1379 | + if (w < -0.5f) w = -0.5f; |
| 1380 | + } |
| 1381 | + |
| 1362 | 1382 | /* if we valued alias-free startup over low startup time, we could do: |
| 1363 | 1383 | * p -= w; |
| 1364 | 1384 | * place_slope_dd(_f, j, 0.0f, w, -1.0f); */ |
| @@ -1369,8 +1389,18 @@ float tMBSaw_tick(tMBSaw* const osc) · 4 unmodified lines |
| 1369 | 1389 | a = 0.5f; // when a = 1, LPfilter is disabled |
| 1370 | 1390 | |
| 1371 | 1391 | t = freq / leaf->sampleRate; |
| 1372 | | − if (t < 1e-5f) t = 1e-5f; |
| 1373 | | − if (t > 0.5f) t = 0.5f; |
| 1392 | + |
| 1393 | + if (t >= 0) |
| 1394 | + { |
| 1395 | + if (t < 1e-5f) t = 1e-5f; |
| 1396 | + if (t > 0.5f) t = 0.5f; |
| 1397 | + } |
| 1398 | + else |
| 1399 | + { |
| 1400 | + if (t > -1e-5f) t = -1e-5f; |
| 1401 | + if (t < -0.5f) t = -0.5f; |
| 1402 | + } |
| 1403 | + |
| 1374 | 1404 | dw = (t - w); // n= 1 |
| 1375 | 1405 | w += dw; |
| 1376 | 1406 | p += w; |
| @@ -1398,8 +1428,12 @@ float tMBSaw_tick(tMBSaw* const osc) · 21 unmodified lines |
| 1398 | 1428 | c->syncout = p / w + 1e-20f; |
| 1399 | 1429 | place_step_dd(c->_f, j, p, w, 1.0f); |
| 1400 | 1430 | |
| 1401 | | − } else { |
| 1402 | | − |
| 1431 | + } else if (p < 0.0f) { |
| 1432 | + p += 1.0f; |
| 1433 | + c->syncout = p / w + 1e-20f; |
| 1434 | + place_step_dd(c->_f, j, 1.0f - p, -w, -1.0f); |
| 1435 | + } |
| 1436 | + else { |
| 1403 | 1437 | c->syncout = 0.0f; |
| 1404 | 1438 | } |
| 1405 | 1439 | c->_f[j + DD_SAMPLE_DELAY] += 0.5f - p; |