earlevel wrote:mystran wrote:What would be wrong with this:
- Code: Select all
return wave->data[int(wave->size * phase)]
- wave->data[int(wave->size * offsetPhase)];
For what it's worth, I actually spent a little bit of effort to try to make sure to use names that would result in the correct mental associations, which also making it as easy as possible to parse visually.
Nothing wrong with it. For me, a sample has a size (16-bit, etc.), and a buffer of samples has a length, but no big deal. Maybe due to decades of C (sizeof, strlen, etc.). Anyway, like I said, I word things a little differently for examples, and maybe "waveTable->waveTableLen" is over-explaining, but hey. I stress enough about the wording of my articles
Well... i suppose you could choose "length" just as well, but STL likes to use "size()" so I went with that.