#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ugens.h>
extern struct chord curchord[MAXCHORDS];
double getpitch(float *p, short n_args){
int decimalext, newroot, i, step;
int num = p[0];
int interval = (int)p[1];
double newpitch;
float temp;
switch(interval){case 0:
newpitch = curchord[num].root * 0.01;
break;case 1:
newroot = curchord[num].root/100;
decimalext = curchord[num].root % 100;
step = curchord[num].triadtype[0];
for(i = 1; i <= step; i++){
if(decimalext % 12 == 0){
newroot++;
decimalext = 1;}
elsedecimalext++;
}
newpitch = (newroot + decimalext * 0.01);
break;case 2:
newroot = curchord[num].root/100;
decimalext = curchord[num].root % 100;step = curchord[num].triadtype[0] + curchord[num].triadtype[1];
for(i = 1; i <= step; i++){if(decimalext % 12 == 0){
newroot++;
decimalext = 1;}
elsedecimalext++;
}
newpitch = (newroot + decimalext * 0.01);
break;case 3:
newroot = curchord[num].root/100;
decimalext = curchord[num].root % 100;
step = curchord[num].triadtype[0] + curchord[num].triadtype[1] + curchord[num].triadtype[2];for(i = 1; i <= step; i++){
if(decimalext % 12 == 0){
newroot++;
decimalext = 1;
}else
decimalext++;
}
newpitch = (newroot + decimalext * 0.01);
break;
}//end switchreturn newpitch;
}//end
getpitch