home *** CD-ROM | disk | FTP | other *** search
- #include"\c\colors.h"
- #include<stdarg.h>
- #include<stdlib.h>
- #include<stdio.h>
-
- #include<dos.h>
-
- /* roland jx-8p programmer/sound librarian */
-
- /*------------------------------------------------------------------*/
- extern int done;
- /*------------------------------------------------------------------*/
- handle_midi() { receive_midi_packet(); } /* called by midi int routine */
- receive_midi_packet()
- { int a;
- do {
- do {} while (!(kbhit()||dta_rdy()));
- if (kbhit()) handle_kbd();
- if (dta_rdy()) {
- a=rc_dta();
- switch (a) {
- case 0x90: note(); break;
- case 0x80: note_off(); break;
- case 0xb0: modulation(); break;
- case 0xc0: program_change(); break;
- case 0xd0: after_touch(); break;
- case 0xe0: pitch_bend(); break;
- case 0xf0: midi_exclusive(); break;
- case 0xfe: break; /* ack */
- }
- }
- } while(!done);
- }
-
- /*------------------------------------------------------------------*/
- after_touch()
- {
- rc_dta_wt();
- }
- /*------------------------------------------------------------------*/
- pitch_bend()
- {
- rc_dta_wt();
- }
- /*------------------------------------------------------------------*/
- modulation()
- {
- rc_dta_wt(); rc_dta_wt(); /* discard it */
- }
- /*------------------------------------------------------------------*/
- program_change()
- {
- rc_dta_wt();
- }
- /*------------------------------------------------------------------*/
- note_off()
- {
- rc_dta_wt(); rc_dta_wt(); /* discard it */
- }
- /*------------------------------------------------------------------*/
- note()
- {
- rc_dta_wt(); rc_dta_wt(); /* discard it */
- }
- /*------------------------------------------------------------------*/
- wait_key()
- {
- printf("\nhit any key to continue...\n");
- while (!kbhit()) {};
- getch();
- }
- /*------------------------------------------------------------------*/
- shell()
- {
- /* invoke dos shell */
- int error;
- screen(1);
- color(normal);
- printf("\nDOS Shell - enter exit to return\n");
- color(normal);
- error=system("command.com");
- if (error!=0) { color(yellow); printf("return code=%x",error); }
- color(normal);
- wait_key();
- screen(0);
- }
- /*------------------------------------------------------------------*/
- set_dir()
- {
- /* cheap way to do it but it works!!! */
- char *cmd;
- screen(1);
- color(yellow);
- cmd="dir *.set";
- system(cmd);
- color(normal);
- wait_key();
- screen(0);
- }
- /*------------------------------------------------------------------*/
- patch_dir()
- {
- /* cheap way to do it but it works!!! */
- char *cmd;
- screen(1);
- color(yellow);
- cmd="dir *.jx8";
- system(cmd);
- color(normal);
- wait_key();
- screen(0);
- }
- /*------------------------------------------------------------------*/
- copy_right()
- {
- locate(1,1);
- color(blue+bold);
- printf("PC800 - JX8P Programmer/Voice Librarian 1.0");
- locate(1,46);
- color(green+bold);
- printf("(C)opyright 1987 BP Midi Systems");
- color(normal);
- }
- /*------------------------------------------------------------------*/
- warning(p) char *p;
- {
- save_cursor();
- locate(2,46);
- color(yellow);
- printf("warning - %s",p);
- restore_cursor();
- }
- /*------------------------------------------------------------------*/
- xabort(code) int code;
- {
- cls();
- color(red+bold);
- printf("\n\nA B O R T called - ");
- color(yellow);
- switch (code) {
- case(1): printf("sn_dta time out\n"); break;
- case(2): printf("sn_cmd time out\n"); break;
- case(5): printf("bad exclusive data\n"); break;
- case(7): printf("MPU version incorrect\n"); break;
- default : printf("undefined code=%d\n",code);
- }
- color(brown);
- printf("Closing Midi\n");
- close_midi();
- color(green+bold);
- printf("Close successful\n");
- color(normal);
- exit(16);
- }
- /*------------------------------------------------------------------*/
- logo()
- {
- cls();
- color(blue+bold);
- locate(7,20);
- color(green+bold);
- printf("PC800 - Roland JX8P Programmer/Librarian");
- locate(9,22);
- color(white+bold);
- printf("(C)opyright 1987 BP Midi Systems");
- locate(12,0);
- color(normal);
- }
- /*------------------------------------------------------------------*/