| 40 | } |
| 41 | |
| 42 | static void waveLine(float *points, int pointsLen, float startIndex, float endIndex, float startValue, float endValue) { |
| 43 | // Switch indices if out of order |
| 44 | if (startIndex > endIndex) { |
| 45 | float tmpIndex = startIndex; |
| 46 | startIndex = endIndex; |
| 47 | endIndex = tmpIndex; |
| 48 | float tmpValue = startValue; |
| 49 | startValue = endValue; |
| 50 | endValue = tmpValue; |
| 51 | } |
| 52 | |
| 53 | int startI = maxi(0, roundf(startIndex)); |
| 54 | int endI = mini(pointsLen - 1, roundf(endIndex)); |
| 55 | for (int i = startI; i <= endI; i++) { |
| 56 | float frac = (startIndex < endIndex) ? rescalef(i, startIndex, endIndex, 0.0, 1.0) : 0.0; |
| 57 | points[i] = crossf(startValue, endValue, frac); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | |
| 62 | static void waveSmooth(float *points, int pointsLen, float index) { |
no test coverage detected