| @@ -1002,7 +1002,7 @@ float tMBPulse_tick(tMBPulse* const osc) · 1001 unmodified lines |
| 1002 | if (sync > 0.0f && c->softsync > 0) c->syncdir = -c->syncdir; | 1002 | if (sync > 0.0f && c->softsync > 0) c->syncdir = -c->syncdir; |
| 1003 | | 1003 | |
| 1004 | sw = w * c->syncdir; | 1004 | sw = w * c->syncdir; |
| 1005 | p += sw - rintf(sw - 0.5f); | 1005 | p += sw - (int)sw; |
| 1006 | | 1006 | |
| 1007 | if (sync > 0.0f && c->softsync == 0) { /* sync to master */ | 1007 | if (sync > 0.0f && c->softsync == 0) { /* sync to master */ |
| 1008 | float eof_offset = sync * sw; | 1008 | float eof_offset = sync * sw; |
| @@ -1212,6 +1212,12 @@ float tMBPulse_sync(tMBPulse* const osc, float value) · 203 unmodified lines |
| 1212 | return value; | 1212 | return value; |
| 1213 | } | 1213 | } |
| 1214 | | 1214 | |
| | 1215 | void tMBPulse_setPhase(tMBPulse* const osc, float phase) |
| | 1216 | { |
| | 1217 | _tMBPulse* c = *osc; |
| | 1218 | c->_p = phase; |
| | 1219 | } |
| | 1220 | |
| 1215 | void tMBPulse_setSyncMode(tMBPulse* const osc, int hardOrSoft) | 1221 | void tMBPulse_setSyncMode(tMBPulse* const osc, int hardOrSoft) |
| 1216 | { | 1222 | { |
| 1217 | _tMBPulse* c = *osc; | 1223 | _tMBPulse* c = *osc; |
| @@ -1282,7 +1288,8 @@ float tMBTriangle_tick(tMBTriangle* const osc) · 64 unmodified lines |
| 1282 | // + 1e3 * linm[1] * vco->_port[LING]) / SAMPLERATE; | 1288 | // + 1e3 * linm[1] * vco->_port[LING]) / SAMPLERATE; |
| 1283 | w = freq * c->invSampleRate; | 1289 | w = freq * c->invSampleRate; |
| 1284 | b = 0.5f * (1.0f + c->waveform); | 1290 | b = 0.5f * (1.0f + c->waveform); |
| 1285 | p = 0.5f * b; | 1291 | // p = 0.5f * b; |
| | 1292 | p = 0.f; |
| 1286 | /* if we valued alias-free startup over low startup time, we could do: | 1293 | /* if we valued alias-free startup over low startup time, we could do: |
| 1287 | * p -= w; | 1294 | * p -= w; |
| 1288 | * place_slope_dd(_f, j, 0.0f, w, 1.0f / b); */ | 1295 | * place_slope_dd(_f, j, 0.0f, w, 1.0f / b); */ |
| @@ -1300,7 +1307,7 @@ float tMBTriangle_tick(tMBTriangle* const osc) · 11 unmodified lines |
| 1300 | if (sync > 0.0f && c->softsync > 0) c->syncdir = -c->syncdir; | 1307 | if (sync > 0.0f && c->softsync > 0) c->syncdir = -c->syncdir; |
| 1301 | | 1308 | |
| 1302 | sw = w * c->syncdir; | 1309 | sw = w * c->syncdir; |
| 1303 | p += sw - rintf(sw - 0.5f); | 1310 | p += sw - (int)sw; |
| 1304 | | 1311 | |
| 1305 | if (sync > 0.0f && c->softsync == 0) { /* sync to master */ | 1312 | if (sync > 0.0f && c->softsync == 0) { /* sync to master */ |
| 1306 | float eof_offset = sync * sw; | 1313 | float eof_offset = sync * sw; |
| @@ -1514,6 +1521,12 @@ float tMBTriangle_sync(tMBTriangle* const osc, float value) · 207 unmodified lines |
| 1514 | return value; | 1521 | return value; |
| 1515 | } | 1522 | } |
| 1516 | | 1523 | |
| | 1524 | void tMBTriangle_setPhase(tMBTriangle* const osc, float phase) |
| | 1525 | { |
| | 1526 | _tMBTriangle* c = *osc; |
| | 1527 | c->_p = phase; |
| | 1528 | } |
| | 1529 | |
| 1517 | void tMBTriangle_setSyncMode(tMBTriangle* const osc, int hardOrSoft) | 1530 | void tMBTriangle_setSyncMode(tMBTriangle* const osc, int hardOrSoft) |
| 1518 | { | 1531 | { |
| 1519 | _tMBTriangle* c = *osc; | 1532 | _tMBTriangle* c = *osc; |
| @@ -1526,8 +1539,8 @@ void tMBTriangle_setSampleRate(tMBTriangle* const osc, float sr) · 6 unmodified lines |
| 1526 | c->invSampleRate = 1.0f/sr; | 1539 | c->invSampleRate = 1.0f/sr; |
| 1527 | } | 1540 | } |
| 1528 | | 1541 | |
| 1529 | //========================================================================================================== | 1542 | //================================================================================================== |
| 1530 | //========================================================================================================== | 1543 | //================================================================================================== |
| 1531 | | 1544 | |
| 1532 | void tMBSaw_init(tMBSaw* const osc, LEAF* const leaf) | 1545 | void tMBSaw_init(tMBSaw* const osc, LEAF* const leaf) |
| 1533 | { | 1546 | { |
| @@ -1577,7 +1590,8 @@ float tMBSaw_tick(tMBSaw* const osc) · 43 unmodified lines |
| 1577 | j = c->_j; /* index into buffer _f */ | 1590 | j = c->_j; /* index into buffer _f */ |
| 1578 | | 1591 | |
| 1579 | if (c->_init) { | 1592 | if (c->_init) { |
| 1580 | p = 0.5f; | 1593 | // p = 0.5f; |
| | 1594 | p = 0.f; |
| 1581 | w = freq * c->invSampleRate; | 1595 | w = freq * c->invSampleRate; |
| 1582 | | 1596 | |
| 1583 | /* if we valued alias-free startup over low startup time, we could do: | 1597 | /* if we valued alias-free startup over low startup time, we could do: |
| @@ -1605,7 +1619,7 @@ float tMBSaw_tick(tMBSaw* const osc) · 21 unmodified lines |
| 1605 | // else if (sw < 0) place_slope_dd(c->_f, j, 1.0f - p, -sw, -2.0f); | 1619 | // else if (sw < 0) place_slope_dd(c->_f, j, 1.0f - p, -sw, -2.0f); |
| 1606 | | 1620 | |
| 1607 | sw = w * c->syncdir; | 1621 | sw = w * c->syncdir; |
| 1608 | p += sw - rintf(sw - 0.5f); | 1622 | p += sw - (int)sw; |
| 1609 | | 1623 | |
| 1610 | if (sync > 0.0f && c->softsync == 0) { /* sync to master */ | 1624 | if (sync > 0.0f && c->softsync == 0) { /* sync to master */ |
| 1611 | float eof_offset = sync * sw; | 1625 | float eof_offset = sync * sw; |
| @@ -1680,6 +1694,12 @@ float tMBSaw_sync(tMBSaw* const osc, float value) · 68 unmodified lines |
| 1680 | return value; | 1694 | return value; |
| 1681 | } | 1695 | } |
| 1682 | | 1696 | |
| | 1697 | void tMBSaw_setPhase(tMBSaw* const osc, float phase) |
| | 1698 | { |
| | 1699 | _tMBSaw* c = *osc; |
| | 1700 | c->_p = phase; |
| | 1701 | } |
| | 1702 | |
| 1683 | void tMBSaw_setSyncMode(tMBSaw* const osc, int hardOrSoft) | 1703 | void tMBSaw_setSyncMode(tMBSaw* const osc, int hardOrSoft) |
| 1684 | { | 1704 | { |
| 1685 | _tMBSaw* c = *osc; | 1705 | _tMBSaw* c = *osc; |