diff -urN midi_prog-/Makefile midi_prog/Makefile --- midi_prog-/Makefile Thu Apr 2 02:00:00 2015 +++ midi_prog/Makefile Fri Apr 3 00:00:00 2015 @@ -5,12 +5,15 @@ OBJS += cui_tone.o CFLAGS += -Wall -I.. -all: $(TARG) +all: $(TARG) txprm $(TARG): $(OBJS) $(CC) -o $@ $(OBJS) $(LIB) +txprm: txprm.c util.o + $(CC) -o $@ txprm.c util.o -lm + clean: - rm -f $(TARG) $(OBJS) *~ + rm -f $(TARG) $(OBJS) txprm *~ # EOF diff -urN midi_prog-/prmfmt.txt midi_prog/prmfmt.txt --- midi_prog-/prmfmt.txt Thu Jan 1 09:00:00 1970 +++ midi_prog/prmfmt.txt Fri Apr 3 00:00:00 2015 @@ -0,0 +1,52 @@ +int tone_inf_n + addr name + int wave1 + int wave2 + int tune + double mix + int ring + int alias_noise1 + int alias_noise2 + int fl_type1 + double freq1 + double Q1 + int fl_type2 + double freq2 + double Q2 + double attack + double decay + double sustain + double release + double level + int lfo_modu_pitch1 + int lfo_modu_pitch2 + int lfo_modu_filter1 + int lfo_modu_filter2 + int lfo_wave + double lfo_freq + double lfo_delay + int env_modu_pitch1 + int env_modu_pitch2 + int env_modu_filter1 + int env_modu_filter2 + int delay_onoff + double delay_sec + double delay_gain + int chorus +int tones_lst_n + int prog + int note + addr tone_compo +int compo_inf_n + addr tone_compo + int idx +int compo_arr_n + addr name + int note + double rate + addr tone +int name_info_n + addr name + int offset +int name_info_area_sz + str name_str diff -urN midi_prog-/txprm.c midi_prog/txprm.c --- midi_prog-/txprm.c Thu Jan 1 09:00:00 1970 +++ midi_prog/txprm.c Fri Apr 3 00:00:00 2015 @@ -0,0 +1,104 @@ +#include +#include +#include "util.h" + +char *work(char *fmt, int idt, int idx, int *p_cnt); + +void +cnv(char *type, char *name, int *np, int idx, int *p_cnt) +{ + printf("%s %s_%d ", type, name, idx); + if(strcmp(type, "int") == 0){ + int v = 0; + fread(&v, sizeof(v), 1, stdin); + printf("%d\n", v); + *np = v; + }else if(strcmp(type, "double") == 0){ + double v = 0; + fread(&v, sizeof(v), 1, stdin); + printf("%lf\n", v); + }else if(strcmp(type, "addr") == 0){ + void *v = NULL; + fread(&v, sizeof(v), 1, stdin); + printf("%p\n", v); + }else if(strcmp(type, "str") == 0){ + int ch, len = 0; + putchar('"'); + while((ch = getchar()) != '\0'){ + putchar(ch); + len++; + } + putchar('"'); + putchar('\n'); + if(p_cnt) *p_cnt += len + 1; + }else{ + MSG(type); + MSG(name); + ERR("cnv"); + } +} + +char * +loop(char *fmt, int idt, int n) +{ + int i, cnt = 0; + char *next = fmt; + + for(i=0; i idt){ + fmt = loop(fmt, i, n); + continue; + } + sscanf(fmt+i, "%s %s\n", type, name); + + for(i=0; i