[chuck-dev] Minor patch for ugen_osc.cpp
conrad.scott at dsl.pipex.com
Sun Jul 8 19:59:37 EDT 2007
Just started using ChucK and greatly enjoying myself. Not much music (or
even noise) as yet, just learning the language for now.
Not understanding the various `sync' options, I was setting a SinOsc's
phase explicitly and wasn't getting what I expected. On inspection of
the source there was a minor typo in CK_DLL_CTRL(osc_ctrl_phase), which
I fixed. While I was there I tidied up the range checking of input
parameters (including those used via `sync', which I now understand
*grin*), particularly so that negative frequencies are handled cleanly.
The original code contained snippets like "if( d->num <= 1.0 ) d->num +=
floor( d->num )" that can't of been doing what anyone wanted them to do.
The same sort of changes and range checking probably ought to be done
elsewhere in the code too, such as in the sndbuf ugen, but that's a job
for another day.
I'm also not convinced that the code to adjust the phase in
CK_DLL_CTRL(osc_ctrl_sync) can be correct. It certainly should only be
done if ugen->m_num_src is non-zero; but even then, I imagine pld's
comment there is correct. Again, for another day.
Attached is a diff patch against the current CVS version. I can't
imagine you'll need any form of assignment for so small a change, but
please use the attached code in anyway you want for any purpose you see
fit. It comes with no warranty, but it has been compiled and vaguely
tested on x86 Windows XP (under Cygwin) and PPC Mac OS X 10.4 (with a
recent copy of the developers tools).
Now, back to making some noise.
All the best and thanks for the great system,
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the chuck-dev