switch(key) {
case 44 : playnote(0);break; /* z */
case 31 : playnote(1);break; /* s */
case 45 : playnote(2);break; /* x */
case 32 : playnote(3);break; /* d */
case 46 : playnote(4);break; /* c */
case 47 : playnote(5);break; /* v */
case 34 : playnote(6);break; /* g */
case 48 : playnote(7);break; /* b */
case 35 : playnote(8);break; /* h */
case 49 : playnote(9);break; /* n */
case 36 : playnote(10);break; /* j */
case 50 : playnote(11);break; /* m */
case 51 : playnote(12);break; /* , */
case 16 : playnote(12);break; /* q */
case 3 : playnote(13);break; /* 2 */
case 17 : playnote(14);break; /* w */
case 4 : playnote(15);break; /* 3 */
case 18 : playnote(16);break; /* e */
case 19 : playnote(17);break; /* f */
case 6 : playnote(18);break; /* 5 */
case 20 : playnote(19);break; /* t */
case 7 : playnote(20);break; /* 6 */
case 21 : playnote(21);break; /* y */
case 8 : playnote(22);break; /* 7 */
case 22 : playnote(23);break; /* u */
case 23 : playnote(24);break; /* i */
case 78 : if(octave < 7) octave++; break;
case 74 : if(octave > 2) octave--; break;
case 73 : change_program(key,0); break;
case 81 : change_program(key,0);break; /* PgDwn */
ms = miditicks;
point = sequence_start;
goto_playmode();
}
clr_sequence()
{
point = sequence_start; /* f�rsta block i gruppen */
do {
farfree(point); /* g�r fri nuvarande block */
point = point->next; /* peka till n�sta */
} while (point->next != NULL); /* sluta n�r next �r NULL */
/* Where in the linked list should this packet go? */
if(sequence_start == NULL) /* the list is empty */
{
sequence_start = sequence_end = scratch;
scratch->before = NULL;
scratch->next = NULL;
}
else
{
insert_pt = get_insert_point(sequence_start,sequence_end,tstamp);
scratch->track = trk;
if(insert_pt == NULL) /* insert the new bottom record */
{
sequence_end->next = scratch;
scratch->before = sequence_end;
scratch->next = NULL;
sequence_end = scratch;
}
else if(insert_pt == sequence_start) /* insert the new top record */
{
sequence_start->before = scratch;
scratch->before = NULL;
scratch->next = sequence_start;
sequence_start = scratch;
}
else /* insert before the insert pointer */
{
scratch->next = insert_pt;
scratch->before = insert_pt->before;
insert_pt->before = scratch;
(scratch->before)->next = scratch;
}
}
} /* end of add_packet() */
struct MIDIpacket *get_insert_point(top,bottom,tstamp)
struct MIDIpacket *top,*bottom;
unsigned long tstamp;
{
if(tstamp > bottom->msec) return(NULL); /* tack onto end of list */
if(tstamp < top->msec) return(top); /* insert as the new first record */
sbfd_instrument((char far*)InstrBuf);
draw_screen();
}
else
{
printf("Error on interrupt.\n");
return(0);
}
}
else
{
printf("Sound Blaster Card not found or wrong I/O setting.\n") ;
return(0);
}
}
else
{
printf("BLASTER environment variable not set or incomplete or invalid.\n");
return(0);
}
return(1);
}
quit(mode)
{
int k, butstat;
if(!mode)
{
gotoxy(1,22);
printf("Do you really want to quit (Y\\n)?");
k = (bioskey(0) >> 8) & 0xff;
}else
k = 28;
if(k == 28 || k == 21)
{
point = sequence_start; /* f�rsta block i gruppen */
do {
farfree(point); /* g�r fri nuvarande block */
point = point->next; /* peka till n�sta */
} while (point->next !=NULL); /* sluta n�r next �r NULL */
draw_screen()
{
int i;
clrscr();
printf("*** THE Sequencer! *** Current Program: %-3u\n\n",program);
printf("^V Set Velocity ^O All notes off ^Y FM Editor ^Z List Files ^P Load Patch\n\n");
printf("^L Load 128-patch set ^S Save 128-patch set ^W Save Settings ^C Clear seq\n\n");
printf("^T Select Track ^X Solo (R)ecord (P)lay (Q)uit\n\n\n");
printf("Current Track: %d\n",trk+1);
}
loadpatch()
{
FILE* f;
char patchname[80],patchnumstr[10];
clrscr();
ShowCur();
printf("Name of single patch to load: ");
gets(patchname);
if (strlen(patchname) != 0)
{
printf("Patch number to load patch into (0-127): ");
gets(patchnumstr);