diff -urN midi_prog-/Makefile midi_prog/Makefile --- midi_prog-/Makefile 2015-04-18 00:00:00.000000000 +0900 +++ midi_prog/Makefile 2015-04-19 00:00:00.000000000 +0900 @@ -1,6 +1,6 @@ CC = gcc LIB = -lm -lpthread -L../cui -lcui -TARG = prog57 +TARG = prog58 OBJS = main.o vcf.o ch.o delay.o stat.o note.o env.o tone.o filter.o lfo.o modu.o vco.o wave.o out.o rd.o util.o OBJS += rec.o OBJS += cui_tone.o diff -urN midi_prog-/rec.c midi_prog/rec.c --- midi_prog-/rec.c 2015-04-18 00:00:00.000000000 +0900 +++ midi_prog/rec.c 2015-04-19 00:00:00.000000000 +0900 @@ -86,8 +86,8 @@ },{ REC(struct tones_lst_rec), (struct memb []){ - MEMB(struct tones_lst_rec, int, prog), - MEMB(struct tones_lst_rec, int, note), + MEMB(struct tones_lst_rec, char*, prog_name), + MEMB(struct tones_lst_rec, char*, note_name), MEMB(struct tones_lst_rec, struct tone_compo_rec*, tone_compo), { NULL } } diff -urN midi_prog-/tone.c midi_prog/tone.c --- midi_prog-/tone.c 2015-04-18 00:00:00.000000000 +0900 +++ midi_prog/tone.c 2015-04-19 00:00:00.000000000 +0900 @@ -111,261 +111,475 @@ }, *tone_inf = tone_inf_default; +char *prog_name_tbl[] = { + /* 0 */ + "PROG_DRUM", + + /* 1 */ + "Acoustic Grand Piano", + "Bright Acoustic Piano", + "Electric Grand Piano", + "Honky-tonk Piano", + "Electric Piano 1", + "Electric Piano 2", + "Harpsichord", + "Clavi", + + /* 9 */ + "Celesta", + "Glockenspiel", + "Music Box", + "Vibraphone", + "Marimba", + "Xylophone", + "Tubular Bells", + "Dulcimer", + + /* 17 */ + "Drawbar Organ", + "Percussive Organ", + "Rock Organ", + "Church Organ", + "Reed Organ", + "Accordiony", + "Harmonica", + "Tango Accordion", + + /* 25 */ + "Acoustic Guitar (nylon)", + "Acoustic Guitar (steel)", + "Electric Guitar (jazz)", + "Electric Guitar (clean)", + "Electric Guitar (muted)", + "Overdriven Guitar", + "Distortion Guitar", + "Guitar harmonics", + + /* 33 */ + "Acoustic Bass", + "Electric Bass (finger)", + "Electric Bass (pick)", + "Fretless Bass", + "Slap Bass 1", + "Slap Bass 2", + "Synth Bass 1", + "Synth Bass 2", + + /* 41 */ + "Violin", + "Viola", + "Cello", + "Contrabass", + "Tremolo Strings", + "Pizzicato Strings", + "Orchestral Harp", + "Timpani", + + /* 49 */ + "String Ensemble 1", + "String Ensemble 2", + "SynthStrings 1", + "SynthStrings 2", + "Choir Aahs", + "Voice Oohs", + "Synth Voice", + "Orchestra Hit", + + /* 57 */ + "Trumpet", + "Trombone", + "Tuba", + "Muted Trumpet", + "French Horn", + "Brass Section", + "SynthBrass 1", + "SynthBrass 2", + + /* 65 */ + "Soprano Sax", + "Alto Sax", + "Tenor Sax", + "Baritone Sax", + "Oboe", + "English Horn", + "Bassoon", + "Clarinet", + + /* 73 */ + "Piccolo", + "Flute", + "Recorder", + "Pan Flute", + "Blown Bottle", + "Shakuhachi", + "Whistle", + "Ocarina", + + /* 81 */ + "Lead 1 (square)", + "Lead 2 (sawtooth)", + "Lead 3 (calliope)", + "Lead 4 (chiff)", + "Lead 5 (charang)", + "Lead 6 (voice)", + "Lead 7 (fifths)", + "Lead 8 (bass + lead)", + + /* 89 */ + "Pad 1 (new age)", + "Pad 2 (warm)", + "Pad 3 (polysynth)", + "Pad 4 (choir)", + "Pad 5 (bowed)", + "Pad 6 (metallic)", + "Pad 7 (halo)", + "Pad 8 (sweep)", + + /* 97 */ + "FX 1 (rain)", + "FX 2 (soundtrack)", + "FX 3 (crystal)", + "FX 4 (atmosphere)", + "FX 5 (brightness)", + "FX 6 (goblins)", + "FX 7 (echoes)", + "FX 8 (sci-fi)", + + /* 105 */ + "Banjo", + "Shamisen", + "Koto", + "Kalimba", + "Bag pipe", + "Fiddle", + "Shanai", + + /* 113 */ + "Agogo", + "Steel Drums", + "Woodblock", + "Taiko Drum", + "Melodic Tom", + "Synth Drum", + "Reverse Cymbal", + + /* 121 */ + "Guitar Fret Noise", + "Breath Noise", + "Seashore", + "Bird Tweet", + "Telephone Ring", + "Helicopter", + "Applause", + "Gunshot", +}; + +char *note_name_tbl[] = { + /* 35 */ + "Acoustic Bass Drum", + "Bass Drum 1", + "Side Stick", + "Acoustic Snare", + "Hand Clap", + "Electric Snare", + "Low Floor Tom", + "Closed Hi Hat", + "High Floor Tom", + "Pedal Hi-Hat", + "Low Tom", + "Open Hi-Hat", + "Low-Mid Tom", + "Hi-Mid Tom", + "Crash Cymbal 1", + "High Tom", + "Ride Cymbal 1", + "Chinese Cymbal", + "Ride Bell", + "Tambourine", + "Splash Cymbal", + "Cowbell", + "Crash Cymbal 2", + "Vibraslap", + "Ride Cymbal 2", + "Hi Bongo", + "Low Bongo", + "Mute Hi Conga", + "Open Hi Conga", + "Low Conga", + "High Timbale", + "Low Timbale", + "High Agogo", + "Low Agogo", + "Cabasa", + "Maracas", + "Short Whistle", + "Long Whistle", + "Short Guiro", + "Long Guiro", + "Claves", + "Hi Wood Block", + "Low Wood Block", + "Mute Cuica", + "Open Cuica", + "Mute Triangle", + "Open Triangle", +}; + #define PROG_DRUM 0 static struct tones_lst_rec tones_lst_default[] = { { - PROG_DRUM, 36, /* bass drum1 */ + "0 PROG_DRUM", "36", /* bass drum1 */ (struct tone_compo_rec []){ { "bass drum", 28, 1.0, }, { NULL, } } },{ - PROG_DRUM, 37, /* side stick */ + "0 PROG_DRUM", "37", /* side stick */ (struct tone_compo_rec []){ { "side stick", 110, 1.0 }, { NULL, } } },{ - PROG_DRUM, 40, /* electric snare */ + "0 PROG_DRUM", "40", /* electric snare */ (struct tone_compo_rec []){ { "snare", 69, 1.0 }, { NULL, } } },{ - PROG_DRUM, 41, /* low floor tom */ + "0 PROG_DRUM", "41", /* low floor tom */ (struct tone_compo_rec []){ { "tom", 50, 1.0 }, { NULL, } } },{ - PROG_DRUM, 42, /* closed hi-hat */ + "0 PROG_DRUM", "42", /* closed hi-hat */ (struct tone_compo_rec []){ { "hi-hat close", 115 + 8, 1.0 }, { NULL, } } },{ - PROG_DRUM, 46, /* open hi-hat */ + "0 PROG_DRUM", "46", /* open hi-hat */ (struct tone_compo_rec []){ { "hi-hat open", 115 + 8, 1.0 }, { NULL, } } },{ - PROG_DRUM, 49, /* crash cymbal 1 */ + "0 PROG_DRUM", "49", /* crash cymbal 1 */ (struct tone_compo_rec []){ { "cymbal", 75, 1.0 }, { NULL, } } },{ - PROG_DRUM, 57, /* crash cymbal 2 */ + "0 PROG_DRUM", "57", /* crash cymbal 2 */ (struct tone_compo_rec []){ { "cymbal", 85, 1.0 }, { NULL, } } },{ - 48, -1, /* timpani */ + "48", "-1", /* timpani */ (struct tone_compo_rec []){ { "strings", -1, 1.0 }, { NULL, } } },{ - 50, -1, /* strings ensamble 2 */ + "50", "-1", /* strings ensamble 2 */ (struct tone_compo_rec []){ { "lead", -1, 1.0 }, /* test */ { "strings", -1, 1.0 }, { NULL, } } },{ - 35, -1, /* electric bass (pick) */ + "35", "-1", /* electric bass (pick) */ (struct tone_compo_rec []){ { "bass", -1, 1.0 }, { NULL, } } },{ - 79, -1, /* whistle */ + "79", "-1", /* whistle */ (struct tone_compo_rec []){ { "lead", -1, 1.0 }, { NULL, } } },{ - 81, -1, /* lead 1 (square) */ + "81", "-1", /* lead 1 (square) */ (struct tone_compo_rec []){ { "lead", -1, 1.0 }, { NULL, } } },{ - 87, -1, /* lead 7 (fifths) */ + "87", "-1", /* lead 7 (fifths) */ (struct tone_compo_rec []){ { "lead", -1, 1.0 }, { NULL, } } },{ - 24, -1, /* tango accordion */ + "24", "-1", /* tango accordion */ (struct tone_compo_rec []){ { "SIN", -1, 1.0 }, { NULL, } } },{ - 67, -1, /* tenor sax */ + "67", "-1", /* tenor sax */ (struct tone_compo_rec []){ { "SIN", -1, 1.0 }, { NULL, } } },{ /* for tong poo */ - 26, -1, /* acoustic guitar (steel) */ + "26", "-1", /* acoustic guitar (steel) */ (struct tone_compo_rec []){ { "lead", -1, 1.0 }, { NULL, } } },{ - 34, -1, /* electric bass (finger) */ + "34", "-1", /* electric bass (finger) */ (struct tone_compo_rec []){ { "bass", -1, 1.0 }, { NULL, } } },{ - 126, -1, /* helicopter */ + "126", "-1", /* helicopter */ (struct tone_compo_rec []){ { "SIN", -1, 1.0 }, { NULL, } } },{ - 49, -1, /* string ensemble 1 */ + "49", "-1", /* string ensemble 1 */ (struct tone_compo_rec []){ { "strings", -1, 1.0 }, { NULL, } } },{ - 62, -1, /* brass section */ + "62", "-1", /* brass section */ (struct tone_compo_rec []){ { "strings", -1, 1.0 }, { NULL, } } },{ - 9, -1, /* celesta */ + "9", "-1", /* celesta */ (struct tone_compo_rec []){ { "lead", -1, 1.0 }, { NULL, } } },{ - 29, -1, /* electric guitar (muted) */ + "29", "-1", /* electric guitar (muted) */ (struct tone_compo_rec []){ { "bass", -1, 1.0 }, { NULL, } } },{ - 80, -1, /* ocarina */ + "80", "-1", /* ocarina */ (struct tone_compo_rec []){ { "lead", -1, 1.0 }, { NULL, } } },{ - 74, -1, /* flute */ + "74", "-1", /* flute */ (struct tone_compo_rec []){ { "lead", -1, 1.0 }, { NULL, } } },{ - PROG_DRUM, 44, /* pedal hi-hat */ + "0 PROG_DRUM", "44", /* pedal hi-hat */ (struct tone_compo_rec []){ { "hi-hat close", 115 + 8, 1.0 }, { NULL, } } },{ /* for behind the mask */ - 95, -1, /* pad 7 (halo) */ + "95", "-1", /* pad 7 (halo) */ (struct tone_compo_rec []){ { "SIN", -1, 1.0 }, { NULL, } } },{ - 38, -1, /* slap bass 2 */ + "38", "-1", /* slap bass 2 */ (struct tone_compo_rec []){ { "bass", -1, 1.0 }, { NULL, } } },{ - 103, -1, /* fx 7 (echoes) */ + "103", "-1", /* fx 7 (echoes) */ (struct tone_compo_rec []){ { "strings", -1, 1.0 }, { NULL, } } },{ - 28, -1, /* electric guitar (clean) */ + "28", "-1", /* electric guitar (clean) */ (struct tone_compo_rec []){ { "lead", -1, 1.0 }, { NULL, } } },{ - 118, -1, /* melodic tom */ + "118", "-1", /* melodic tom */ (struct tone_compo_rec []){ { "tom", -1, 1.0 }, { NULL, } } },{ - 108, -1, /* koto */ + "108", "-1", /* koto */ (struct tone_compo_rec []){ { "lead", -1, 1.0 }, { NULL, } } },{ - 25, -1, /* acoustic guitar (nylon) */ + "25", "-1", /* acoustic guitar (nylon) */ (struct tone_compo_rec []){ { "lead", -1, 1.0 }, { NULL, } } },{ /* for rydeen */ - 30, -1, /* overdriven guitar */ + "30", "-1", /* overdriven guitar */ (struct tone_compo_rec []){ { "bass", -1, 1.0 }, { NULL, } } },{ - 33, -1, /* acoustic bass */ + "33", "-1", /* acoustic bass */ (struct tone_compo_rec []){ { "bass", -1, 1.0 }, { NULL, } } },{ - 104, -1, /* fx 8 (sci-fi) */ + "104", "-1", /* fx 8 (sci-fi) */ (struct tone_compo_rec []){ { "strings", -1, 1.0 }, { NULL, } } },{ - 63, -1, /* synthbrass 1 */ + "63", "-1", /* synthbrass 1 */ (struct tone_compo_rec []){ { "strings", -1, 1.0 }, { NULL, } } },{ - 127, -1, /* applause */ + "127", "-1", /* applause */ (struct tone_compo_rec []){ { "SIN", -1, 1.0 }, { NULL, } } },{ - PROG_DRUM, 38, /* acoustic snare */ + "0 PROG_DRUM", "38", /* acoustic snare */ (struct tone_compo_rec []){ { "snare", 69, 1.0 }, { NULL, } } },{ - PROG_DRUM, 47, /* low-mid tom */ + "0 PROG_DRUM", "47", /* low-mid tom */ (struct tone_compo_rec []){ { "tom", 55, 1.0 }, { NULL, } } },{ - PROG_DRUM, 48, /* hi-mid tom */ + "0 PROG_DRUM", "48", /* hi-mid tom */ (struct tone_compo_rec []){ { "tom", 60, 1.0 }, { NULL, } } },{ - PROG_DRUM, 50, /* hi tom */ + "0 PROG_DRUM", "50", /* hi tom */ (struct tone_compo_rec []){ { "tom", 65, 1.0 }, { NULL, } } },{ /* for techno polis */ - 93, -1, /* pad 5 (bowed) */ + "93", "-1", /* pad 5 (bowed) */ (struct tone_compo_rec []){ { "SIN", -1, 1.0 }, { NULL, } } },{ - 51, -1, /* synthstrings 1 */ + "51", "-1", /* synthstrings 1 */ (struct tone_compo_rec []){ { "strings", -1, 1.0 }, { NULL, } } },{ - 86, -1, /* lead 6 (voice) */ + "86", "-1", /* lead 6 (voice) */ (struct tone_compo_rec []){ { "bass", -1, 1.0 }, { NULL, } } },{ - 100, -1, /* fx 4 (atmosphere) */ + "100", "-1", /* fx 4 (atmosphere) */ (struct tone_compo_rec []){ { "lead", -1, 1.0 }, { NULL, } } },{ - PROG_DRUM, 52, /* chinese cymbal */ + "0 PROG_DRUM", "52", /* chinese cymbal */ (struct tone_compo_rec []){ { "cymbal", 75, 1.0 }, { NULL, } } },{ - PROG_DRUM, 55, /* splash cymbal */ + "0 PROG_DRUM", "55", /* splash cymbal */ (struct tone_compo_rec []){ { "cymbal", 75, 1.0 }, { NULL, } } },{ - -1, -1, NULL /* tail */ + "-1", "-1", NULL /* tail */ } }, *tones_lst = tones_lst_default; @@ -406,16 +620,30 @@ void tone_init(void) { + struct tones_lst_rec *tl; struct tone_compo_rec *tone_compo; - int i; + char buf[256], *s; + int i, note_st = 35; try_load(); - for(i=0; tones_lst[i].tone_compo; i++){ - for(tone_compo=tones_lst[i].tone_compo; tone_compo->name; tone_compo++){ + for(tl=tones_lst; tl->tone_compo; tl++){ + for(tone_compo=tl->tone_compo; tone_compo->name; tone_compo++){ tone_compo->tone = name_search(tone_compo->name); } tone_compo->tone = NULL; + + i = tl->prog = strtol(tl->prog_name, NULL, 0); + s = i < 0 ? "any" : prog_name_tbl[i]; + sprintf(buf, "%d %s", i, s); + if(tones_lst != tones_lst_default) free(tl->prog_name); + tl->prog_name = strdup(buf); + + i = tl->note = strtol(tl->note_name, NULL, 0); + s = i < 0 ? "any" : i >=note_st ? note_name_tbl[i-note_st] : ""; + sprintf(buf, "%d %s", i, s); + if(tones_lst != tones_lst_default) free(tl->note_name); + tl->note_name = strdup(buf); } try_save(); } diff -urN midi_prog-/tone.h midi_prog/tone.h --- midi_prog-/tone.h 2015-04-18 00:00:00.000000000 +0900 +++ midi_prog/tone.h 2015-04-19 00:00:00.000000000 +0900 @@ -29,8 +29,9 @@ }; struct tones_lst_rec{ - int prog, note; /* note for ch 9 */ + char *prog_name, *note_name; struct tone_compo_rec *tone_compo; + int prog, note; /* note for ch 9 */ }; struct tone_all_rec{