#include #include //using namespace std; int base,variance,del,repeat,current; void ascend(int &,int &,int &); /* The format of the above function is * acsend(current value of frequency , amount to ascend , delay in * milliseconds) */ void descend(int &,int &,int &); /* The format remains the same , except that instead of amount to ascend , * you give the amount to descend . */ int main(int argc , char *argv[]) { /* The format of the command-line parameters to pass * to the program is rather simple . * * The 1st argument is the base frequency ( representing the * sine x-axis) . * * The 2nd argument is the variance , or the amplitude of the sine * wave . * * The 3rd argument is the delay ( in milliseconds ) , representing * the delay between frequency change in the ascent and descent * functions . * * The 4th argument is the number of times you want the siren to loop . */ int i; base=atoi(argv[1]); variance=atoi(argv[2]); del=atoi(argv[3]); repeat=atoi(argv[4]); /* The following for loop asends to the top , descends to the base , * then descends to the bottom , and finally ascends to the base . * To do : convert it into an approximation of a sine function from * a linear one .*/ for(i=0;i=0;i--) { if(i) current--; /* See the previous comment on this topic in the ascend * function . Here , the value of base is devremented on the * first run , too , to ensure that top and base values * are not repeated . */ sound(current); delay(del); } nosound(); }