Working with Pure Data, I always took the shortcut to fake exponential decay presented in Andy Farnell's Designing Sound: multiplying the current envelope value by itself four times. This quartic envelope is a fairly efficient approximation of exponential decay.
@clausanders28864 жыл бұрын
Is there a particular reason, why you are using nested if statements instead of switch/case statements? I personally find switch statements easier to read and maintain.
@apm4144 жыл бұрын
Good question. You can definitely use switch/case statements instead of a series of if statements, but I chose the latter for a couple reasons: first, it's simpler and less bug-prone when learning C++ (particularly forgetting to include a "break"), and second, you can't define local variables within a "case" statement which can be slightly confusing if you have more complex code to run. Ultimately it's a matter of taste, and I use plenty of switch/case in my own code.