2 * STed: assign.c (assign)
8 static char *filter_name[14]={
41 unsigned char stgt_name[10][4]={
42 "æ^","æ_","æ`","æa","æb","æc","æd","æe","æf","æh"};
44 /***************************/
47 int a,i,j,xx,x=0,y=0,f,gy,sh;
51 for(i=0;i<32;i++){rno[i]=rhyno[i][0];}
54 fill(0,544,767,1023,0);
56 fill(2,666,564,708,14);box(2,708,564,986,14,65535);
57 box(4,710,282,984,14,65535);box(284,710,562,984,14,65535);
58 box(6,618,200+80,660,14,65535);box(8,620,198+80,658,14,65535);
64 B_LOCATE(1,10);B_PRINT("RHYTHM ASSIGN");B_LOCATE(1,11);
65 B_PRINT(" NO RHYTHM NAME K# GT ");
66 B_PRINT(" NO RHYTHM NAME K# GT ");
70 B_LOCATE((i>>4)*35+2,(i&15)+13);
71 B_PRINT(fstr(i+1,2));B_PRINT(":");B_PRINT(spadd(rhyna[i],14));
76 B_PRINT(fstr(a,4));B_PRINT(" (");
77 B_PRINT(keystr(a));B_PRINT(")");
79 B_PRINT(fstr(rhyno[i][1],5));
84 if(x<3){f=0;}else{f=1;}
85 i=y+f*16;xx=f*35+5;f=x-f*3;
91 if( f==1 ){xx=xx+15;}else{xx=xx+26;}
95 a=inkey2();sh=B_SFTSNS();
96 if(a>='a' && a<='z'){a=a-32;}
100 a=rhy_stest[2];if(gs_mode[16]&4){a*=256;}
101 s_test(rhy_stest[0],a,rhy_stest[1],rhyno[i][0],rhy_stest[4]);
104 if(a=='r'||a=='R'){s_test(11,-1,64,rhyno[i][0],rhy_stest[4]);}
105 if(a=='e'||a=='E'){s_test(11,-1,65,rhyno[i][0],rhy_stest[4]);}
109 if( a==0x05 ){y--;if( y<0 ){y=15;}}
110 if( a==0x18 ){y++;if( y>15 ){y=0;}}
111 if( a==0x13 ){x--;if( x<0 ){x=5;}}
112 if( a==0x04 ){x++;if( x>5 ){x=0;}}
113 if( a==0x0b ){y=0;x=0;goto redis;}
116 msg("No.=");j=vinput(f*16+y+1,0x802);msg_clr();
117 if(es==0 && j>0 && j<=32){j-=1;x=(j>>4)*3;y=j&15;}
121 msg(_("Initialize assign"));
122 if(yn_sel()>0){msg_clr();rhinit();goto redis;}
125 rhinit2(i);goto redis;
132 strcpy(tmp0,chstr(rhy_stest[0]));
133 sinput(tmp0,0x803);n=strch(rhy_stest[0],tmp0);
134 /* May.06.2001 NAGANO Daisuke <breeze.nagano@nifty.ne.jp> */
136 if(es==0 && n>=0 && n<=STED3_MAX_PORT_NUMBER*16){rhy_stest[0]=n;}
139 if(es==0 && n>=0 && n<=32){rhy_stest[0]=n;}
147 B_LOCATE(21,7);n=vinput(n,0x803);
148 if(es==0 && n>=-1 && n<=127){rhy_stest[2]=n;}
155 B_LOCATE(29,7);n=vinput(n,0x803);
156 if(es==0 && n>=0 && n<=127){rhy_stest[4]=n;}
161 if((cmdflag&0x1000)==0){goto retimsel;}
164 if((cmdflag&0x20)!=0 ){n++;}
165 B_LOCATE(6,8);n=vinput(n,0xb03);
166 if((cmdflag&0x20)!=0 ){n--;}
172 /* if(rhy_stest[2]>=0){a=rhy_stest[2]*256;}*/
176 a=rhy_stest[2];if(gs_mode[16]&4){a*=256;}
179 n=timsel(rhy_stest[0],a,36,rhy_stest[1]);
181 if(n<0){goto timnore;}
184 if(n>=-1 && n<128){rhy_stest[1]=n;}
197 b_striS(tmp1,256,rhyno[i][0]);sinput(tmp1,0xb03);
199 n=ctc(rhyno[i][0],tmp1,0);
201 tdis(xx,(i&15)+13,tmp1,j,11);
202 n=rhy_stest[1];if(n<0){n=0;}
203 if(rhy_stest[2]>=0){n+=rhy_stest[2]*256;}
204 n=timsel(rhy_stest[0]+0x100,n,36,0);
205 if(n<0){goto timnore2;}
210 as=tim_asin[rhy_stest[0]];
212 if(as==8 || as==10 || as==12 || as==14){
214 tmp1[15]=0;strcpy(rhyna[i],tmp1+1);
218 strcpy(rhyna[i],tim_name[cm6[0x130+(n-24)*4]+128]);
226 n=vinput(rhyno[i][1],0x803);
227 if( n>=0 && n<=255){rhyno[i][1]=n;}
233 if( a>='0' && a<='9' ){
238 /*sinput(rhyna[i],14);*/
241 tmp1[0]=a;tmp1[1]=0;sinput(tmp1,0x603);
243 n=ctc(rhyno[i][0],tmp1,0);
245 tdis(xx,(i&15)+13,tmp1,j,11);
246 n=rhy_stest[1];if(n<0){n=0;}
247 if(rhy_stest[2]>=0){n+=rhy_stest[2]*256;}
248 n=timsel(rhy_stest[0]+0x100,n,36,0);
249 if(n<0){goto timnore3;}
251 if( n>=0 && n<128 ){rhyno[i][0]=n;}
254 n=vinput(a-'0',0x403);
255 if( n>=0 && n<=255){rhyno[i][1]=n;}
262 if( (a=='+' || a=='>' || a=='.') && f>0 ){
264 if(sh&1){n+=12;}else{n++;}
265 if( f==1 ){n=n&127;}else{n=n&255;}
269 if( (a=='-' || a=='<' || a==',') && f>0 ){
271 if(sh&1){n+=244;}else{n+=255;}
272 if( f==1 ){n=n&127;}else{n=n&255;}
278 char tmp0[256],tmp1[256],path2[256];
282 strcpy(path2,prt_path);tmp1[0]=0;
283 fsel(tmp1,path2,0x00b);
284 if( es==0 && tmp1[0]!=0){
285 strcpy(tmp0,path2);strcat(tmp0,tmp1);
286 msg(_("Loading Rhythm assign file"));
287 if(ras_load(tmp0)==0 ){msg_clr();
288 if(!(cnfflag&0x0008)){strcpy(prt_path,path2);}
294 char tmp0[256],tmp1[256],path2[256];
298 strcpy(path2,prt_path);tmp1[0]=0;
299 fsel(tmp1,path2,0x10b);
300 if( es==0 && tmp1[0]!=0){
301 strcpy(tmp0,path2);strcat(tmp0,tmp1);
302 msg(_("Saving Rhythm assign file"));
303 if(ras_save(tmp0)==0 ){msg_clr();
304 if(!(cnfflag&0x0008)){strcpy(prt_path,path2);}
312 msg(_("Change all rhythm name"));
313 a=yn_sel();msg_clr();if(a==0){goto ass_ret;}
317 if( n>=0 && n<128 /*&& rhyno[i][1]!=0*/){
319 as=tim_asin[rhy_stest[0]];
321 if(rhy_stest[2]>=0){bk+=rhy_stest[2]*256;}
323 if(as==8 || as==10 || as==12 || as==14){
325 tmp1[15]=0;strcpy(rhyna[i],tmp1+1);
329 strcpy(rhyna[i],tim_name[cm6[0x130+(n-24)*4]+128]);
344 B_LOCATE(35,6);B_PRINT("ExChange Rhythm Data");
345 B_LOCATE(52,7);B_PRINT("Source No.=");B_PRINT(fstr(i+1,2));
346 B_LOCATE(48,8);B_PRINT("Distnation No.=");
347 exc1: ex=rhy_as_sel(i);if(ex==i){goto exc1;}
348 txerase(35*8,6*16,40*8,3*16);
351 n=rhyno[i][0];rhyno[i][0]=rhyno[ex][0];rhyno[ex][0]=n;
352 n=rhyno[i][1];rhyno[i][1]=rhyno[ex][1];rhyno[ex][1]=n;
354 strcpy(tmp0,rhyna[i]);strcpy(rhyna[i],rhyna[ex]);
355 strcpy(rhyna[ex],tmp0);
366 if(rhyno[i][0]==rhyno[j][0] && rhyno[i][0]!=0){
372 msg(_("Find repetition of key number. Ok"));
373 if(yn_sel()<1){msg_clr();goto redis;}
380 for(i=0;i<32;i++){if(rno[i]!=rhyno[i][0]){f=1;}}
382 if(f!=0 && (cmdflag&0x800)==0){
384 if((cmdflag&0x400)==0){
385 msg(_("Replace all track datas"));
386 a=yn_sel();if(a==0){msg_clr();goto ass_ret;}
390 msg(_("Now processing ..."));
392 if((trrhy[i]&128)!=0){
393 for(j=0;j<tr_len[i];j=j+4){
394 unsigned char a=trk[i][j];
395 if(a<128 && a!=0 && trk[i][j+2]>0 && trk[i][j+3]>0){
397 if(a==rno[n] && rhyno[n][0]!=0){
398 trk[i][j]=rhyno[n][0];
410 B_CLR_AL();home2(gy);
413 /***************************/
414 int rhy_as_sel(int no)
427 if( a==0x05 ){y--;if( y<0 ){y=15;}}
428 if( a==0x18 ){y++;if( y>15 ){y=0;}}
429 if( a==0x13 ){x--;if( x<0 ){x=1;}}
430 if( a==0x04 ){x++;if( x>1 ){x=0;}}
431 if( a==0x0b ){y=0;x=0;}
434 msg("No.=");j=vinput(x*16+y+1,0x802);msg_clr();
435 if(es==0 && j>0 && j<=32){j-=1;x=j>>4;y=j&15;}
437 if( a==13 ){return x*16+y;}
438 if( a==27 ){return -1;}
443 /***************************/
446 B_LOCATE(2,7);B_PRINT("CH.=");B_PRINT(chstr(rhy_stest[0]));
449 B_PRINT("BANK LSB=");
451 B_PRINT("BANK MSB=");
453 B_PRINT(fstr(rhy_stest[2],3));
455 B_LOCATE(25,7);B_PRINT("VEL=");B_PRINT(fstr(rhy_stest[4],3));
457 B_LOCATE(2,8);B_PRINT("PRG=");
458 B_PRINT(prog_name(rhy_stest[0],rhy_stest[2]*256,rhy_stest[1],1));
461 /***************************/
462 int tagj(int *po,int fl)
467 fill(315,566,453,1001,0);
468 box(316,588-16,444,999,14,65535);
469 box(317,626-16,443,998,14,65535);
470 fill(316,588-16,444,626-16,14);
473 B_LOCATE(40,4);if(fl==0){B_PRINT("### TAG JUMP ##");}else{B_PRINT("### TAG SET ###");}
474 B_LOCATE(40,5);B_PRINT("NO.TR MEAS ST ");
479 strcpy(tmp0," : ");tmp0[0]=i+'A';if(i==22){tmp0[0]=32;}
483 strcat(tmp0,fstr(tag[i][0]+1,2));
487 strcat(tmp0,fstr(tag[i][1],5));strcat(tmp0,fstr(tag[i][2],5));
489 B_LOCATE(40,i+7);B_PRINT(tmp0);
495 strcpy(tmp0,fstr(tag[y][0]+1,3));
499 strcat(tmp0,fstr(tag[y][1],5));strcat(tmp0,fstr(tag[y][2],5));
501 tdis(42,y+7,tmp0,13,11);
503 tdis(42,y+7,tmp0,13,3);
505 if(a>='A' && a<='V'){y=a-'A';}
506 if(a>='a' && a<='v'){y=a-'a';}
507 if( a==0x05 ){y--;if( y<0 ){y=22;}}
508 if( a==0x18 ){y++;if( y>22 ){y=0;}}
509 if( a==0x0b ){y=0;break;}
510 if( a==13 || a==32 ){es= 0;break;}
511 if( a==27 ){es= 1;break;}
513 txerase(40*8,5*16-16,20*8,25*16+16);
514 fill(315,587-16,445,1001,0);
520 tag[22][0]=track;tag[22][1]=meas_no(*po);
521 tag[22][2]=sttm_no(*po);
523 if(tag[y][0]<255){track=tag[y][0];}
524 *po=meas_add(tag[y][1]);
528 i=tag[y][2];*po=sttm_ad(*po,i);
532 if(a==13){tag[y][0]=track;}else{tag[y][0]=255;}
533 tag[y][1]=meas_no(*po);tag[y][2]=sttm_no(*po);
539 /***************************/
542 int ke,sh,i,j,x=0,y=0,scr,gy;
546 scr=edit_scr;edit_scr=0;
548 fill(0,512+32,767,1023,0);
549 box(15,116+512,496,411+512,14,65535);
550 box(17,133+512,494,409+512,14,65535);
551 sdis(2, 84+512," PART ASSIGN",13,15,8);
552 sdis(2 ,116+512," CH. PART NAME",30,15,14);
553 sdis(32,116+512," CH. PART NAME",30,15,14);
558 strcpy(tmp,chstr(i+j*16));
559 tdis(3+j*30,8+i,tmp,3,3);
562 if(ke!=0){strcpy(tmp,tim_head[ke-1]);}
563 else{strcpy(tmp,"No Assign");}
564 tdis(8+j*30,8+i,tmp,20,3);
571 if(ke!=0){strcpy(tmp,tim_head[ke-1]);}
572 else{strcpy(tmp,"No Assign");}
574 tdis(x*30+8,9+y,tmp,20,11);
575 ke=inkey2();sh=B_SFTSNS();
576 tdis(x*30+8,9+y,tmp,20,3);
582 ex=str_search("1234567890,./*-+=\x0d",t);
583 if(ex>0 && ex<19){ex--;x=ex>>4;y=ex&15;ke=0;}
588 tdis(x*30+8,9+y,tmp,20,10);
589 i=part_sel(tim_asin[nn]);
590 if(i>=0){tim_asin[nn]=i;}
593 if( ke>='0' && ke<='9' ){
596 if((ke>='a' && ke<='f')||(ke>='A' && ke<='F')){
597 tim_asin[nn]=(ke&15)+9;
600 if( ke==0x05 ){y--;if( y<0 ){y=15;}}
601 if( ke==0x18 ){y++;if( y>15 ){y=0;}}
602 if( ke==0x13 || ke==0x04 ){x++;if( x>1 ){x=0;}}
605 msg("No.=");j=vinput(x*16+y+1,0x802);msg_clr();
606 if(es==0 && j>0 && j<=32){j-=1;x=j>>4;y=j&15;}
610 msg(_("Initialize assign"));
611 if(yn_sel()>0){msg_clr();asin_init();goto top;}
615 C_CLS_AL();home2(gy);
618 /***************************/
624 box(527,116+512,752,411+512,14,65535);
625 box(529,133+512,750,409+512,14,65535);
626 sdis(66,84+512," PART SELECT",13,15,8);
627 sdis(66,116+512," No. PART NAME",28,15,14);
631 strcpy(tmp,fstr(i,2));
632 tdis(67,9+i,tmp,3,3);
634 if(i!=0){strcpy(tmp,tim_head[i-1]);}
635 else{strcpy(tmp,"No Assign");}
636 tdis(70,9+i,tmp,20,3);
640 if(y!=0){strcpy(tmp,tim_head[y-1]);}
641 else{strcpy(tmp,"No Assign");}
643 tdis(70,9+y,tmp,20,11);
645 tdis(70,9+y,tmp,20,3);
647 if( ke==27 ){y=-1;break;}
649 if( ke==0x05 ){y--;if( y<0 ){y=15;}}
650 if( ke==0x18 ){y++;if( y>15 ){y=0;}}
653 msg("No.=");j=vinput(y+1,0x802);msg_clr();
654 if(es==0 && j>0 && j<=16){j-=1;y=j&15;}
658 txerase(527,32,767,511);
659 fill(527,512+32,767,1023,0);
663 /***************************/
664 void rec_filter(int md)
672 fill(0,512+32,767,1023,0);
674 txerase(22*8,9*16,59*8,18*16);
675 fill(174,115+512,641,379+512,0);
678 box(174,115+512,361,379+512,14,65535);
679 box(176,133+512,359,377+512,14,65535);
680 sdis(22,116+512," RECORD FILTER",23,15,14);
682 box(366,115+512,641,379+512,14,65535);
683 box(368,133+512,639,377+512,14,65535);
685 box(495,133+512+4,511,377+512-4,14,65535);
687 sdis(46,116+512," Control Change Convert",34,15,14);
688 sdis(46+16,128+512+16*7+8,"->",2,15,-1);
695 tdis(23,9+i,filter_name[i],18,3);
697 if(ke){strcpy(tmp,": ON");}else{strcpy(tmp,":OFF");}
698 tdis(40,9+i,tmp,4,3);
700 ka=rfilt[i+16][0];kb=rfilt[i+16][1];
702 if(ka==128){strcpy(tmp,"--- --------");}else{
703 strcpy(tmp,fstr(ka,3));strcat(tmp," ");
704 strcat(tmp,ctrl_type(ka));}
705 tdis(41+7,9+i,tmp,13,3);
707 if(kb==128){strcpy(tmp,"--- --------");}else{
708 strcpy(tmp,fstr(kb,3));strcat(tmp," ");
709 strcat(tmp,ctrl_type(kb));}
710 tdis(41+24,9+i,tmp,13,3);
712 tdis(40-10,9+11,fstr(rfilt[11][1],3),3,3);
713 tdis(40-4,9+11,fstr(rfilt[11][2],3),3,3);
714 tdis(40-4,9+12,fstr(rfilt[12][1]-128,3),3,3);
715 tdis(40-4,9+13,fstr(rfilt[13][1],3),3,3);
720 tcur(41+x*7,9+y,3,3);
721 if(x){tcur(41+x*7+17,9+y,3,3);}
724 tcur(41+x*7,9+y,3,3);
725 if(x){tcur(41+x*7+17,9+y,3,3);}
729 if(x==0){rfilt[y][0]=1-rfilt[y][0];
730 if(rfilt[y][0]){tdis(41,y+9,"ON ",3,3);}
732 if(y==11 && rfilt[y][0]){
736 B_LOCATE(41-11,y+9);tmp0[0]=0;
737 b_striS(tmp0,64,rfilt[y][1]);
742 if(ct>=0 && ct<=127){rfilt[y][1]=ct;}
744 B_LOCATE(41-5,y+9);tmp0[0]=0;
745 b_striS(tmp0,64,rfilt[y][2]);
750 if(ct>=0 && ct<=127){rfilt[y][2]=ct;}
754 if(y==12 && rfilt[y][0]){
757 B_LOCATE(41-5,y+9);ct=vinput(ct,0x803);
758 if(es==0 && (ct>=-99 && ct<99)){
761 if(y==13 && rfilt[y][0]){
765 B_LOCATE(41-5,y+9);tmp0[0]=0;
766 b_striS(tmp0,64,rfilt[y][1]);
771 if(ct>=0 && ct<=127){rfilt[y][1]=ct;}
781 B_LOCATE(41+7,y+9);tmp0[0]=0;
782 if(rfilt[y+16][0]<128){b_striS(tmp0,64,rfilt[y+16][0]);}
786 ct=spc_code(tmp0,&ctl);
787 if(ct==0xeb && ctl>=0){rfilt[y+16][0]=ctl;}
789 B_LOCATE(41+24,y+9);tmp0[0]=0;
790 if(rfilt[y+16][1]<128){b_striS(tmp0,64,rfilt[y+16][1]);}
794 ct=spc_code(tmp0,&ctl);
795 if(ct==0xeb && ctl>=0){rfilt[y+16][1]=ctl;}
802 if( ke==0x05 ){y--;if( y<0 ){y=13;}}
803 if( ke==0x18 ){y++;if( y>13 ){y=0;}}
805 if( ke==0x13 ){x--;if( x<0 ){x=1;}}
806 if( ke==0x04 ){x++;if( x>1 ){x=0;}}
811 msg_clr();filt_init();goto top;
815 txerase(22*8,9*16,59*8,18*16);home2(gy);
816 fill(174,115+512,641,379+512,0);
820 /***************************/
826 rfilt[i][0]=0;rfilt[i][1]=0;
827 rfilt[i+16][0]=128;rfilt[i+16][1]=128;
829 rfilt[11][1]=127;rfilt[11][2]=0;
835 /***************************/
838 int a,n,i,xx,yy,x=0,y=0,scr,sh;
840 scr=edit_scr;edit_scr=0;
842 fill(316,566,453,997,0);
843 box(316,643,452,996-8,14,65535);
844 box(317,644,451,995-8,14,65535);
845 fill(316,602,452,644,14);
850 B_PRINT("* ST/GT ASSIGN *");
855 B_PRINT("NO. ST GT");
857 B_PRINT("NO. ST GT VEL");
862 B_PRINT("F");B_PRINT(fstr(i+1,2));B_PRINT(": ");
864 B_PRINT((const char *)stgt_name[i]);
865 B_PRINT(fstr(stgt_tbl[i],5));
866 B_PRINT(fstr(stgt_tbl[i+10],4));
868 B_PRINT(fstr(stgt_tbl[i],3));
869 B_PRINT(fstr(stgt_tbl[i+10],4));
870 B_PRINT(fstr(stgt_tbl[i+20],4));
874 i=y+x*10;xx=49/*+(x&1)*4*/;if(x){xx+=4;}
878 a=inkey2();sh=B_SFTSNS();
881 if( a==0x05 ){y--;if( y<0 ){y=9;/*SKEYSET(0x85);SKEYSET(0x5);*/}}
882 if( a==0x18 ){y++;if( y>9 ){y=0;}}
883 if( a==0x13 ){x--;if( x<0 ){x=2;}if(x==2||x==1){goto redis;}}
884 if( a==0x04 ){x++;if( x>2 ){x=0;}if(x==2||x==0){goto redis;}}
885 if( a==0x0b ){y=0;x=0;break;}
888 msg("No.=");j=vinput(y+1,0x802);msg_clr();
889 if(es==0 && j>0 && j<=10){y=j-1;}
893 msg(_("Initialize assign"));
894 if(yn_sel()>0){msg_clr();stgt_init();goto redis;}
897 stgt_init2(i);goto redis;
902 n=vinput(stgt_tbl[i],0x803);
903 if(es==0 && n>=0 && ((x<2 && n<=255) || n<=127)){stgt_tbl[i]=n;}
906 if( a>='0' && a<='9' ){
908 n=vinput(a-'0',0x403);
909 if(es==0 && n>=0 && ((x<2 && n<=255) || n<=127)){stgt_tbl[i]=n;}
913 if( a=='+' || a=='>' || a=='.' ){
915 if(sh&1){n+=12;}else{n++;}
922 if( a=='-' || a=='<' || a==',' ){
924 if(sh&1){n+=244;}else{n+=255;}
935 txerase(40*8,5*16,16*8,25*16);
936 fill(316,537,453,997,0);
940 /***************************/