| version 1.6, 2005/03/18 09:23:11 | version 1.8, 2006/12/10 11:14:31 | 
| Line 3 | Line 3 | 
 | #include        "dosio.h" | #include        "dosio.h" | 
 | #include        "textfile.h" | #include        "textfile.h" | 
 | #include        "midiout.h" | #include        "midiout.h" | 
 |  | #if defined(SUPPORT_ARC) | 
 |  | #include        "arc.h" | 
 |  | #endif | 
 |  |  | 
 |  |  | 
 | #define CFG_MAXAMP              400 | #define CFG_MAXAMP              400 | 
| Line 36  static const OEMCHAR str_env[] = OEMTEXT | Line 39  static const OEMCHAR str_env[] = OEMTEXT | 
 | static const OEMCHAR str_loop[] = OEMTEXT("loop"); | static const OEMCHAR str_loop[] = OEMTEXT("loop"); | 
 | static const OEMCHAR str_tail[] = OEMTEXT("tail"); | static const OEMCHAR str_tail[] = OEMTEXT("tail"); | 
 | static const OEMCHAR file_timiditycfg[] = OEMTEXT("timidity.cfg"); | static const OEMCHAR file_timiditycfg[] = OEMTEXT("timidity.cfg"); | 
 |  | static const OEMCHAR str_basedir[] = OEMTEXT("${basedir}"); | 
 |  |  | 
 |  |  | 
 | static void pathadd(MIDIMOD mod, const OEMCHAR *path) { | static void pathadd(MIDIMOD mod, const OEMCHAR *path) { | 
| Line 49  static void pathadd(MIDIMOD mod, const O | Line 53  static void pathadd(MIDIMOD mod, const O | 
 | // separator change! | // separator change! | 
 | file_catname(pl.path, path, NELEMENTS(pl.path)); | file_catname(pl.path, path, NELEMENTS(pl.path)); | 
 | if (path[0]) { | if (path[0]) { | 
| file_setseparator(pl.path, NELEMENTS(pl.path)); | #if defined(SUPPORT_ARC) | 
|  | if (milstr_chr(pl.path, '#') == NULL) | 
|  | #endif | 
|  | file_setseparator(pl.path, NELEMENTS(pl.path)); | 
 | } | } | 
 | } | } | 
 |  |  | 
| Line 67  static void pathadd(MIDIMOD mod, const O | Line 74  static void pathadd(MIDIMOD mod, const O | 
 | } | } | 
 | } | } | 
 |  |  | 
 |  | static void pathaddex(MIDIMOD mod, const OEMCHAR *path) { | 
 |  |  | 
 |  | OEMCHAR _path[MAX_PATH]; | 
 |  |  | 
 |  | if (milstr_memcmp(path, str_basedir)) { | 
 |  | pathadd(mod, path); | 
 |  | } | 
 |  | else { | 
 |  | file_cpyname(_path, file_getcd(str_null), NELEMENTS(_path)); | 
 |  | file_cutseparator(_path); | 
 |  | file_catname(_path, path + 10, NELEMENTS(_path)); | 
 |  | pathadd(mod, _path); | 
 |  | } | 
 |  | } | 
 |  |  | 
 | static int cfggetarg(OEMCHAR *str, OEMCHAR *arg[], int maxarg) { | static int cfggetarg(OEMCHAR *str, OEMCHAR *arg[], int maxarg) { | 
 |  |  | 
 | int             ret; | int             ret; | 
| Line 324  BRESULT cfgfile_getfile(MIDIMOD mod, con | Line 346  BRESULT cfgfile_getfile(MIDIMOD mod, con | 
 | while(p) { | while(p) { | 
 | file_cpyname(path, p->path, size); | file_cpyname(path, p->path, size); | 
 | file_catname(path, filename, size); | file_catname(path, filename, size); | 
 |  | #if defined(SUPPORT_ARC) | 
 |  | attr = arcex_attr(path); | 
 |  | #else | 
 | attr = file_attr(path); | attr = file_attr(path); | 
 |  | #endif | 
 | if (attr != -1) { | if (attr != -1) { | 
 | return(SUCCESS); | return(SUCCESS); | 
 | } | } | 
| Line 372  BRESULT cfgfile_load(MIDIMOD mod, const | Line 398  BRESULT cfgfile_load(MIDIMOD mod, const | 
 | switch(cfg) { | switch(cfg) { | 
 | case CFG_DIR: | case CFG_DIR: | 
 | for (i=1; i<argc; i++) { | for (i=1; i<argc; i++) { | 
| pathadd(mod, argv[i]); | pathaddex(mod, argv[i]); | 
 | } | } | 
 | break; | break; | 
 |  |  | 
| Line 414  cfl_err: | Line 440  cfl_err: | 
 |  |  | 
 | // ---- | // ---- | 
 |  |  | 
| MIDIMOD midimod_create(UINT samprate) { | VEXTERN MIDIMOD VEXPORT midimod_create(UINT samprate) { | 
 |  |  | 
 | UINT    size; | UINT    size; | 
 | MIDIMOD ret; | MIDIMOD ret; | 
| Line 457  mmcre_err1: | Line 483  mmcre_err1: | 
 | return(NULL); | return(NULL); | 
 | } | } | 
 |  |  | 
| void midimod_destroy(MIDIMOD hdl) { | VEXTERN void VEXPORT midimod_destroy(MIDIMOD hdl) { | 
 |  |  | 
 | UINT    r; | UINT    r; | 
 | TONECFG bank; | TONECFG bank; | 
| Line 480  void midimod_destroy(MIDIMOD hdl) { | Line 506  void midimod_destroy(MIDIMOD hdl) { | 
 | } | } | 
 | } | } | 
 |  |  | 
| void midimod_loadprogram(MIDIMOD hdl, UINT num) { | VEXTERN void VEXPORT midimod_loadprogram(MIDIMOD hdl, UINT num) { | 
 |  |  | 
 | UINT    bank; | UINT    bank; | 
 |  |  | 
| Line 493  void midimod_loadprogram(MIDIMOD hdl, UI | Line 519  void midimod_loadprogram(MIDIMOD hdl, UI | 
 | } | } | 
 | } | } | 
 |  |  | 
| void midimod_loadrhythm(MIDIMOD hdl, UINT num) { | VEXTERN void VEXPORT midimod_loadrhythm(MIDIMOD hdl, UINT num) { | 
 |  |  | 
 | UINT    bank; | UINT    bank; | 
 |  |  | 
| Line 506  void midimod_loadrhythm(MIDIMOD hdl, UIN | Line 532  void midimod_loadrhythm(MIDIMOD hdl, UIN | 
 | } | } | 
 | } | } | 
 |  |  | 
| void midimod_loadgm(MIDIMOD hdl) { | VEXTERN void VEXPORT midimod_loadgm(MIDIMOD hdl) { | 
 |  |  | 
 | if (hdl) { | if (hdl) { | 
 | inst_bankload(hdl, 0); | inst_bankload(hdl, 0); | 
| Line 514  void midimod_loadgm(MIDIMOD hdl) { | Line 540  void midimod_loadgm(MIDIMOD hdl) { | 
 | } | } | 
 | } | } | 
 |  |  | 
| void midimod_loadall(MIDIMOD hdl) { | VEXTERN void VEXPORT midimod_loadall(MIDIMOD hdl) { | 
 |  |  | 
 | UINT    b; | UINT    b; | 
 |  |  | 
| Line 525  void midimod_loadall(MIDIMOD hdl) { | Line 551  void midimod_loadall(MIDIMOD hdl) { | 
 | } | } | 
 | } | } | 
 |  |  | 
 |  |  | 
 |  | VEXTERN void VEXPORT midimod_loadallex(MIDIMOD hdl, FNMIDIOUTLAEXCB cb, void *userdata) { | 
 |  |  | 
 |  | MIDIOUTLAEXPARAM param; | 
 |  | UINT    b; | 
 |  |  | 
 |  | if (hdl) { | 
 |  | ZeroMemory(¶m, sizeof(param)); | 
 |  | param.userdata = userdata; | 
 |  | for (b=0; b<(MIDI_BANKS*2); b++) { | 
 |  | param.totaltones += inst_gettones(hdl, b); | 
 |  | } | 
 |  | for (b=0; b<(MIDI_BANKS*2); b++) { | 
 |  | param.bank = b; | 
 |  | inst_bankloadex(hdl, b, cb, ¶m); | 
 |  | } | 
 |  | } | 
 |  | } | 
 |  |  |