Jens,
On Mon, Apr 27, 2009 at 11:09 PM, Jens M Andreasen <jens.andreasen@comhem.se> wrote:
On Mon, 2009-04-27 at 21:39 -0700, Aaron Johnson wrote:
> Hi all,
-<snip>.
> here's the code snippet from 'whysynth_voice_render.c'You'll need to find the declaration of y_pitch[MAX_NOTES] first and
>
> /* MIDI note to pitch */
> for (i = 0; i <= 128; ++i) {
> pexp = (float)(i - 69) / 12.0f;
> y_pitch[i] = powf(2.0f, pexp);
> }
>
change that to say y_pitch[MAX_SCALES][MAX_NOTES] and then also change
every access from y_pitch[NOTE] to y_pitch[current_scale][NOTE] where
current_scale is a new (possibly global) variable initially set to zero
and NOTE is the original indexing variable. Don't worry ... GCC will
tell you where if you missed something :)
Say MAX_SCALES == 2 you can then
1) implement the second scale. For now setting everything to A440 will
do as proof of concept, and then later you can calculate or load
something sensible from a file.
2) make a single button that will set the value of current_scale to 1 or
0, thus changing between the two scales. Radiobuttons might be a better
choice for more scales, but then you'd need to read more GTK docs up
front.