//cond.c--conductor program //date: Wed Apr 26 13:52:47 PDT 2000 #include "c:\radioba5\improv.h" /*--------------------beginning improvization algorithms------------------*/ /*---------------------initialization algorithms--------------------------*/ description(){ printf(" CONDUCTOR PROGRAM COMMANDS\n"); printf ("s--select score z--play score\n"); printf ("b--stop score playing n--toggle no baton mode on/off\n"); printf("\n"); }//end description() initialization(){} /*--------------------main loop algorithms -------------------------------*/ mainloopalgorithms(){} /*--------------------triggered algorithms--------------------------------*/ stick1trig(){} stick2trig(){} b14plustrig(){printf("b14+ trigger\n");} b15plustrig(){printf("b15+ trigger\n");} b14minusuptrig() {scan=1;startmeasure=measure;} b14minusdowntrig(){b14minusup=1;} b15minusuptrig() {b15minusdown=1;} b15minusdowntrig(){b15minusup=1;} keyboardchar(testch){ switch(testch){ case 's': //select and compile score command(17,0); //turn off position reporting printf("type name of score file \n"); scanf("%s",scoref); ii=-1;while(scoref[++ii]!='\0')scorepf[ii]=scoref[ii]; scorepf[ii++]='.';scorepf[ii++]='p'; scorepf[ii]='\0'; ii=-1;while(scoref[++ii]!='\0')midif[ii]=scoref[ii]; midif[ii++]='.';midif[ii++]='m';midif[ii++]='i'; midif[ii++]='d';midif[ii]='\0'; if((fp2=fopen(scorepf,"r+b")) != NULL){ printf("playing existing .p file \n");newdotp=0; printf("type COMMAND (type z to start playing)\n"); } else{makedotp();} break; case 'S': //forces compilation of score file -> dotp.p command(17,0); //turn off position reporting printf("force compilation of new score.p file\n"); printf("type name of score file \n"); scanf("%s",scoref); ii=-1;while(scoref[++ii]!='\0')scorepf[ii]=scoref[ii]; scorepf[ii++]='.';scorepf[ii++]='p'; scorepf[ii]='\0'; ii=-1;while(scoref[++ii]!='\0')midif[ii]=scoref[ii]; midif[ii++]='.';midif[ii++]='m';midif[ii++]='i'; midif[ii++]='d';midif[ii]='\0'; makedotp(); break; case 'z': command(17,127); //turn on position reporting loadplay();pc(); break; case 'n': //toggle no baton mode if(nobat){nobat=0;printf("NOBAT MODE OFF\n");} else{nobat=1;printf("NOBAT MODE ON\n");} break; case 'm': //set startmeasure printf("startmeasure =");scanf("%d",&startmeasure); break; default: printf("UNKNOWN COMMAND \n");pc();break; }//end switch(testch) }//end keyboardchar(testch) makedotp(){ short ii; if((fp1=fopen(scoref,"r")) != NULL) { discardcnt=5;scoresok=1; fp2=fopen("dotp.p","w+b"); compile(); fclose(fp1);fclose(fp2);if(fp3!=NULL)fclose(fp3); if(errorflag)scoresok=0; while(m_poll()!=-1){ if(readkeyboard++>1000){ readkeyboard=0; if(kbhit()){ keych=getch(); if(keych=='Q')goto endmake; } } } printf("score file--%s compiled\n",scoref);newdotp=1; printf("type COMMAND (type z to start playing)\n"); } else{ printf("score file--%s not found\ntype COMMAND\n",scoref); scoresok=0;newdotp=0; } endmake:; }//end makedotp() loadplay(){ int ii; long nexttime; for(ii=0;ii<16;ii++)m_cont2(ii,64,0); nexttime=t_time; while(t_time