|
|
| version 1.5, 2005/02/07 14:46:13 | version 1.6, 2005/03/18 09:23:11 |
|---|---|
| Line 16 enum { | Line 16 enum { |
| CFG_DRUM | CFG_DRUM |
| }; | }; |
| static const char str_dir[] = "dir"; | static const OEMCHAR str_dir[] = OEMTEXT("dir"); |
| static const char str_source[] = "source"; | static const OEMCHAR str_source[] = OEMTEXT("source"); |
| static const char str_default[] = "default"; | static const OEMCHAR str_default[] = OEMTEXT("default"); |
| static const char str_bank[] = "bank"; | static const OEMCHAR str_bank[] = OEMTEXT("bank"); |
| static const char str_drumset[] = "drumset"; | static const OEMCHAR str_drumset[] = OEMTEXT("drumset"); |
| static const char *cfgstr[] = {str_dir, str_source, str_default, | static const OEMCHAR *cfgstr[] = {str_dir, str_source, str_default, |
| str_bank, str_drumset}; | str_bank, str_drumset}; |
| static const char str_amp[] = "amp"; | static const OEMCHAR str_amp[] = OEMTEXT("amp"); |
| static const char str_keep[] = "keep"; | static const OEMCHAR str_keep[] = OEMTEXT("keep"); |
| static const char str_note[] = "note"; | static const OEMCHAR str_note[] = OEMTEXT("note"); |
| static const char str_pan[] = "pan"; | static const OEMCHAR str_pan[] = OEMTEXT("pan"); |
| static const char str_strip[] = "strip"; | static const OEMCHAR str_strip[] = OEMTEXT("strip"); |
| static const char str_left[] = "left"; | static const OEMCHAR str_left[] = OEMTEXT("left"); |
| static const char str_center[] = "center"; | static const OEMCHAR str_center[] = OEMTEXT("center"); |
| static const char str_right[] = "right"; | static const OEMCHAR str_right[] = OEMTEXT("right"); |
| static const char str_env[] = "env"; | static const OEMCHAR str_env[] = OEMTEXT("env"); |
| static const char str_loop[] = "loop"; | static const OEMCHAR str_loop[] = OEMTEXT("loop"); |
| static const char str_tail[] = "tail"; | static const OEMCHAR str_tail[] = OEMTEXT("tail"); |
| static const char file_timiditycfg[] = "timidity.cfg"; | static const OEMCHAR file_timiditycfg[] = OEMTEXT("timidity.cfg"); |
| static void pathadd(MIDIMOD mod, const char *path) { | static void pathadd(MIDIMOD mod, const OEMCHAR *path) { |
| _PATHLIST pl; | _PATHLIST pl; |
| PATHLIST p; | PATHLIST p; |
| Line 46 static void pathadd(MIDIMOD mod, const c | Line 46 static void pathadd(MIDIMOD mod, const c |
| ZeroMemory(&pl, sizeof(pl)); | ZeroMemory(&pl, sizeof(pl)); |
| if (path) { | if (path) { |
| pl.path[0] = '\0'; | pl.path[0] = '\0'; |
| file_catname(pl.path, path, sizeof(pl.path)); // separator change! | // separator change! |
| file_catname(pl.path, path, NELEMENTS(pl.path)); | |
| if (path[0]) { | if (path[0]) { |
| file_setseparator(pl.path, sizeof(pl.path)); | file_setseparator(pl.path, NELEMENTS(pl.path)); |
| } | } |
| } | } |
| pl.next = mod->pathlist; | pl.next = mod->pathlist; |
| p = pl.next; | p = pl.next; |
| while(p) { | while(p) { |
| if (!strcmp(p->path, pl.path)) { | if (!file_cmpname(p->path, pl.path)) { |
| return; | return; |
| } | } |
| p = p->next; | p = p->next; |
| Line 66 static void pathadd(MIDIMOD mod, const c | Line 67 static void pathadd(MIDIMOD mod, const c |
| } | } |
| } | } |
| static int cfggetarg(char *str, char *arg[], int maxarg) { | static int cfggetarg(OEMCHAR *str, OEMCHAR *arg[], int maxarg) { |
| int ret; | int ret; |
| BOOL quot; | BOOL quot; |
| char *p; | OEMCHAR *p; |
| UINT8 c; | OEMCHAR c; |
| ret = 0; | ret = 0; |
| while(maxarg--) { | while(maxarg--) { |
| Line 81 static int cfggetarg(char *str, char *ar | Line 82 static int cfggetarg(char *str, char *ar |
| if ((c == 0) || (c == 0x23)) { | if ((c == 0) || (c == 0x23)) { |
| goto cga_done; | goto cga_done; |
| } | } |
| if (c > 0x20) { | if ((c < 0) || (c > 0x20)) { |
| break; | break; |
| } | } |
| str++; | str++; |
| Line 104 static int cfggetarg(char *str, char *ar | Line 105 static int cfggetarg(char *str, char *ar |
| *p = '\0'; | *p = '\0'; |
| goto cga_done; | goto cga_done; |
| } | } |
| else if (c > 0x20) { | else if ((c < 0) || (c > 0x20)) { |
| *p++ = c; | *p++ = c; |
| } | } |
| else { | else { |
| Line 118 cga_done: | Line 119 cga_done: |
| return(ret); | return(ret); |
| } | } |
| static char *seachr(char *str, char sepa) { | static OEMCHAR *seachr(const OEMCHAR *str, OEMCHAR sepa) { |
| char c; | OEMCHAR c; |
| while(1) { | while(1) { |
| c = *str; | c = *str; |
| Line 128 static char *seachr(char *str, char sepa | Line 129 static char *seachr(char *str, char sepa |
| break; | break; |
| } | } |
| if (c == sepa) { | if (c == sepa) { |
| return(str); | return((OEMCHAR *)str); |
| } | } |
| str++; | str++; |
| } | } |
| Line 140 enum { | Line 141 enum { |
| VAL_SIGN = 2 | VAL_SIGN = 2 |
| }; | }; |
| static BOOL cfggetval(const char *str, int *val) { | static BRESULT cfggetval(const OEMCHAR *str, int *val) { |
| int ret; | int ret; |
| int flag; | int flag; |
| Line 185 static BOOL cfggetval(const char *str, i | Line 186 static BOOL cfggetval(const char *str, i |
| // ---- | // ---- |
| static void settone(MIDIMOD mod, int bank, int argc, char *argv[]) { | static void settone(MIDIMOD mod, int bank, int argc, OEMCHAR *argv[]) { |
| int val; | int val; |
| TONECFG tone; | TONECFG tone; |
| char *name; | OEMCHAR *name; |
| int i; | int i; |
| char *key; | OEMCHAR *key; |
| char *data; | OEMCHAR *data; |
| UINT8 flag; | UINT8 flag; |
| if ((bank < 0) || (bank >= (MIDI_BANKS * 2)) || (argc < 2) || | if ((bank < 0) || (bank >= (MIDI_BANKS * 2)) || (argc < 2) || |
| Line 211 static void settone(MIDIMOD mod, int ban | Line 212 static void settone(MIDIMOD mod, int ban |
| tone += val; | tone += val; |
| name = tone->name; | name = tone->name; |
| if (name == NULL) { | if (name == NULL) { |
| name = (char *)listarray_append(mod->namelist, NULL); | name = (OEMCHAR *)listarray_append(mod->namelist, NULL); |
| tone->name = name; | tone->name = name; |
| } | } |
| if (name) { | if (name) { |
| Line 309 static void settone(MIDIMOD mod, int ban | Line 310 static void settone(MIDIMOD mod, int ban |
| // ---- | // ---- |
| BOOL cfgfile_getfile(MIDIMOD mod, const char *filename, | BRESULT cfgfile_getfile(MIDIMOD mod, const OEMCHAR *filename, |
| char *path, int size) { | OEMCHAR *path, int size) { |
| PATHLIST p; | PATHLIST p; |
| short attr; | short attr; |
| Line 334 fpgf_exit: | Line 335 fpgf_exit: |
| return(FAILURE); | return(FAILURE); |
| } | } |
| BOOL cfgfile_load(MIDIMOD mod, const char *filename, int depth) { | BRESULT cfgfile_load(MIDIMOD mod, const OEMCHAR *filename, int depth) { |
| TEXTFILEH tfh; | TEXTFILEH tfh; |
| char buf[1024]; | OEMCHAR buf[1024]; |
| int bank; | int bank; |
| int i; | int i; |
| int argc; | int argc; |
| char *argv[16]; | OEMCHAR *argv[16]; |
| int val; | int val; |
| UINT cfg; | UINT cfg; |
| bank = -1; | bank = -1; |
| if ((depth >= 16) || | if ((depth >= 16) || |
| (cfgfile_getfile(mod, filename, buf, sizeof(buf)) != SUCCESS)) { | (cfgfile_getfile(mod, filename, buf, NELEMENTS(buf)) != SUCCESS)) { |
| goto cfl_err; | goto cfl_err; |
| } | } |
| // TRACEOUT(("open: %s", buf)); | // TRACEOUT(("open: %s", buf)); |
| Line 356 BOOL cfgfile_load(MIDIMOD mod, const cha | Line 357 BOOL cfgfile_load(MIDIMOD mod, const cha |
| if (tfh == NULL) { | if (tfh == NULL) { |
| goto cfl_err; | goto cfl_err; |
| } | } |
| while(textfile_read(tfh, buf, sizeof(buf)) == SUCCESS) { | while(textfile_read(tfh, buf, NELEMENTS(buf)) == SUCCESS) { |
| argc = cfggetarg(buf, argv, NELEMENTS(argv)); | argc = cfggetarg(buf, argv, NELEMENTS(argv)); |
| if (argc < 2) { | if (argc < 2) { |
| continue; | continue; |
| Line 417 MIDIMOD midimod_create(UINT samprate) { | Line 418 MIDIMOD midimod_create(UINT samprate) { |
| UINT size; | UINT size; |
| MIDIMOD ret; | MIDIMOD ret; |
| BOOL r; | BRESULT r; |
| size = sizeof(_MIDIMOD); | size = sizeof(_MIDIMOD); |
| size += sizeof(INSTRUMENT) * 128 * 2; | size += sizeof(INSTRUMENT) * 128 * 2; |