📄 srgconv.c
字号:
/* * srgconv - SMF1/RCP/G36 to SMF0 converter * Copyright (C) 1998,1999 SAKAI Katsuya * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#include <stdio.h> // #include <iostream.h>#include <unistd.h>#include <fcntl.h>#include <sys/ioctl.h>#include <stdlib.h>#include <string.h>#include "config.h"#include "player.h"#include "seq_smf0.h"#include "defines.h"#include "option.h"u_char port2dev[16]={ PORT_A, PORT_B, PORT_C, PORT_D, PORT_E, PORT_F, PORT_A, PORT_A, PORT_A, PORT_A, PORT_A, PORT_A, PORT_A, PORT_A, PORT_A, PORT_A};Sequencer *aSequencer;MIDIplayer *player;OPTION opt;char MIDIplayer::stop=FALSE;char MIDIplayer::next=FALSE;void usage(char *progname);intmain(int argc, char *argv[]){ if (argc>2) usage(argv[0]); aSequencer = new Sequencer_SMF0; if(aSequencer->open(0, SEQBUFFER_SIZE)<0) return -1; G36_Player g36; R36_Player rcp; SMF_Player smf; int rtn; if (argc==2) { if (argv[1][0]=='-') usage(argv[0]); if((rtn = smf.load(argv[1]))>=0) player=&smf; else if((rtn = rcp.load(argv[1]))>=0) player=&rcp; else if((rtn = g36.load(argv[1]))>=0) player=&g36; } else { char ch; ch = opt.filename (argv[0])[0]; if (ch=='s') { if((rtn = smf.load(0))>=0) player=&smf; } else if (ch=='g') { if((rtn = g36.load(0))>=0) player=&g36; } else { if((rtn = rcp.load(0))>=0) player=&rcp; } } if(rtn>=0) {# ifdef SHOW_FILEINFO cout << "filename:" << argv[1] << endl;# endif aSequencer->reset(); player->init(); player->play(); player->clear(); } else { switch (rtn) { case -1: printf("%s : open error\n", argv[1]); // cout << argv[1] << " : open error " << endl; break; case -2: printf("%s : unknown format\n", argv[1]); // cout << argv[1] << " : unknown format" << endl; break; case -3: printf("%s : broken file?\n", argv[1]); // cout << argv[1] << " : broken file?" << endl; break; case -4: printf("memory allocatiuon error\n"); // cout << "memory allocation error" << endl; aSequencer->close(); return rtn; break; default: printf("error\n"); // cout << "error" << endl; aSequencer->close(); return rtn; break; } } aSequencer->close(); return 0;}void usage(char *progname){#if 0 cout << endl << "SMF1/RCP/R36/G18/G36 to SMF0 converter" << endl << opt.filename(progname) << " version " << VERSION << endl << "Copyright (C) 1998,1999 Sakai Katsuya" << endl << "This software comes with ABSOLUTELY NO WARRANTY." << endl << endl << "usage: " << opt.filename(progname) << " filename "<< endl << endl;#else#endif exit(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -