electro-smith / DaisySP

A Powerful DSP Library in C++
https://www.electro-smith.com/daisy
Other
882 stars 139 forks source link

Don't pass Tone float params by reference #180

Closed ndonald2 closed 1 year ago

ndonald2 commented 1 year ago

Summary

Very small change to the interface of Tone to accept a float param for the SetCutoff and Process methods by value instead of by reference.

Details

The reason for the change is twofold:

  1. Passing a cutoff freq by reference prevents usage of rvalues including constant literals, so e.g. tone.SetFreq(5000.0f) will not compile.
  2. Passing a non-const reference would allow the reference to be modified by the method, which is obviously not the intention of the interface here.
stephenhensley commented 1 year ago

lol the amount of temporary branches that i've done this on while working on other stuff 😭

Thanks for the PR!