| 244 | } |
| 245 | |
| 246 | double sqr2() const |
| 247 | { |
| 248 | double t1 = t + 0.875 + 0.25 * (pulseWidth - 0.5); |
| 249 | t1 -= bitwise_or_zero(t1); |
| 250 | |
| 251 | double t2 = t + 0.375 + 0.25 * (pulseWidth - 0.5); |
| 252 | t2 -= bitwise_or_zero(t2); |
| 253 | |
| 254 | // Square #1 |
| 255 | double y = t1 < 0.5 ? 1 : -1; |
| 256 | |
| 257 | y += blep(t1, freqInSecondsPerSample) - blep(t2, freqInSecondsPerSample); |
| 258 | |
| 259 | t1 += 0.5 * (1 - pulseWidth); |
| 260 | t1 -= bitwise_or_zero(t1); |
| 261 | |
| 262 | t2 += 0.5 * (1 - pulseWidth); |
| 263 | t2 -= bitwise_or_zero(t2); |
| 264 | |
| 265 | // Square #2 |
| 266 | y += t1 < 0.5 ? 1 : -1; |
| 267 | |
| 268 | y += blep(t1, freqInSecondsPerSample) - blep(t2, freqInSecondsPerSample); |
| 269 | |
| 270 | return amplitude * 0.5 * y; |
| 271 | } |
| 272 | |
| 273 | double rect() const |
| 274 | { |
nothing calls this directly
no test coverage detected