csound/csound — pull request #411 by mskala (2014-12-20 14:49:07+00:00)
Title: fix nonsense output from k-rate phasorbnk

The phasorbnk opcode is supposed to return a value in the range 0 to 1. When used at a-rate, that is accomplished in a fairly obvious way: if the value we are about to return is greater than 1, subtract 1, and if it's less than 0, add 1. (It is assumed that it will always be between -1 and 2 going into this check.) But when used at k-rate, the second check tests against 1, not 0. Thus, if the value was in range going into the check, it is guaranteed _not_ to be in range afterward. This patch fixes that. It looks like I may be the first person to attempt serious use of phasorbnk at k-rate in the 15 years since it was added to Csound, since this bug makes phasorbnk effectively unusable at k-rate.