diff 17/instrum.h 18/instrum.h 77c77 < font_preset,font_keynote,legato; --- > font_preset,font_keynote,legato,tva_level; diff 17/playmidi.c 18/playmidi.c 392c392 < d[i]->drum_level = 127; --- > d[i]->drum_level = 1.0f; 406c406 < d[note]->drum_level = 127; --- > d[note]->drum_level = 1.0f; 683a684 > velocity = velocity_table[velocity]; 697c698 < /* Level of Drum */ --- > /* Level of Drum Instrument */ 699c700,701 < tempamp = tempamp * channel[voice[v].channel].drums[voice[v].note]->drum_level / 127; --- > tempamp *= channel[voice[v].channel].drums[voice[v].note]->drum_level; > /* in this part, meybe clipping process is necessary. */ 817a820,849 > void init_channel_lpf(int ch,int note) { > int i; > for(i=0;i<8;i++) { > channel[ch].lpf_val[i] = 0; > } > } > > FLOAT_T calc_drum_tva_level(int ch,int note,int level) > { > int def_level; > ToneBank *bank; > > if(channel[ch].special_sample > 0) {return 1.0;} > > if(ISDRUMCHANNEL(ch)) { > bank = drumset[(int)channel[ch].bank]; > if(bank == NULL) {bank = drumset[0];} > } else { > return 1.0; > } > > def_level = bank->tone[note].tva_level; > > if(def_level == -1) {def_level = 127;} > else if(def_level <= 0) {def_level = 1;} > else if(def_level > 127) {def_level = 127;} > > return ((FLOAT_T)level / (FLOAT_T)def_level); > } > 838,844d869 < void init_channel_lpf(int ch,int note) { < int i; < for(i=0;i<8;i++) { < channel[ch].lpf_val[i] = 0; < } < } < 2941c2966 < channel[ch].drums[note]->drum_level = val; --- > channel[ch].drums[note]->drum_level = calc_drum_tva_level(ch,note,val); diff 17/playmidi.h 18/playmidi.h 171c171 < int8 drum_level; --- > FLOAT_T drum_level; 238c238 < /* for Cutoff,Resonance */ --- > /* for Channel LPF / Resonance */ 249c249 < int8 soft_pedal; --- > int8 soft_pedal; /* for CC# Soft */ 251,252c251,252 < int8 tone_map0_number; < FLOAT_T pitch_offset_fine; --- > int8 tone_map0_number; /* for GS SysEx. */ > FLOAT_T pitch_offset_fine; /* in Hz */ 255,256c255,256 < int8 legato; < int8 note_on; --- > int8 legato; /* Legato: 0 or 1 */ > int8 note_on; /* for Legato */ diff 17/readmidi.c 18/readmidi.c 53a54,57 > /* mld.c */ > extern int read_mfi_file(struct timidity_file *tf); > extern char *get_mfi_file_title(struct timidity_file *tf); > 3117c3121 < if(strncmp(magic, "MThd", 4) == 0) --- > if(memcmp(magic, "MThd", 4) == 0) 3122c3126 < else if(strncmp(magic, "RCM-", 4) == 0 || strncmp(magic, "COME", 4) == 0) --- > else if(memcmp(magic, "RCM-", 4) == 0 || memcmp(magic, "COME", 4) == 0) 3126a3131,3135 > else if(memcmp(magic, "melo", 4) == 0) > { > readmidi_read_init(); > err = read_mfi_file(tf); > } 3136c3145 < else if(strncmp(magic, "RIFF", 4) == 0) --- > else if(memcmp(magic, "RIFF", 4) == 0) 3209c3218 < struct midi_file_info *new_midi_file_info(char *filename) --- > struct midi_file_info *new_midi_file_info(const char *filename) 3265c3274 < struct midi_file_info *get_midi_file_info(char *filename, int newp) --- > struct midi_file_info *get_midi_file_info(const char *filename, int newp) 3593c3602 < if(strncmp(tmp, "RCM-", 4) == 0 || strncmp(tmp, "COME", 4) == 0) --- > if(memcmp(tmp, "RCM-", 4) == 0 || memcmp(tmp, "COME", 4) == 0) 3619a3629,3650 > if(memcmp(tmp, "melo", 4) == 0) > { > int i; > char *master, *converted; > > master = get_mfi_file_title(tf); > if (master != NULL) > { > i = SAFE_CONVERT_LENGTH(strlen(master) + 1); > converted = (char *)new_segment(&tmpbuffer, i); > code_convert(master, converted, i, NULL, NULL); > p->seq_name = (char *)safe_strdup(converted); > reuse_mblock(&tmpbuffer); > } > else > { > p->seq_name = (char *)safe_malloc(1); > p->seq_name[0] = '\0'; > } > p->format = 0; > goto end_of_parse; > } 3842c3873 < out_name = url_expand_home_dir(out_name); --- > out_name = (char *)url_expand_home_dir(out_name); 4240c4271 < } \ No newline at end of file --- > } diff 17/readmidi.h 18/readmidi.h 54a55 > #define IS_MFI_FILE 800 /* Melody Format for i-mode */ diff 17/tables.c 18/tables.c 464a465 > FLOAT_T *velocity_vol_table; 494,498c495,511 < < for(i=0;i<128;i++) < { < linear_vol_table[i] = (FLOAT_T)i / 127.0; < log_vol_table[i] = log((FLOAT_T)i / 127.0 + 1) * 1.442695f; --- > /* generate velocity table */ > switch(opt_velocity_table) { > case 1: > velocity_vol_table = exp_vol_table; > break; > case 2: > velocity_vol_table = def_vol_table; > break; > case 3: > velocity_vol_table = gs_vol_table; > break; > case 4: > velocity_vol_table = log_vol_table; > break; > default: > velocity_vol_table = linear_vol_table; > break; 499a513 > 502,518c516 < switch(opt_velocity_table) { < case 0: < velocity_table[i] = i; < break; < case 1: < velocity_table[i] = ((sqrt((FLOAT_T)i/127) * 127) + i) / 2; < break; < case 2: < velocity_table[i] = sqrt((FLOAT_T)i/127) * 127; < break; < case 3: < velocity_table[i] = (((FLOAT_T)i * (FLOAT_T)i / 127) + i) / 2; < break; < case 4: < velocity_table[i] = (FLOAT_T)i * (FLOAT_T)i / 127; < break; < } --- > velocity_table[i] = (uint8)(velocity_vol_table[i] * 127.0 + 0.5); 1116c1114,1132 < uint8 velocity_table[128]; --- > FLOAT_T log_vol_table[128] = > { > 0.000000, 0.011315, 0.022543, 0.033683, 0.044738, 0.055709, 0.066598, 0.077405, > 0.088131, 0.098778, 0.109347, 0.119840, 0.130256, 0.140598, 0.150867, 0.161062, > 0.171187, 0.181240, 0.191224, 0.201140, 0.210988, 0.220769, 0.230484, 0.240134, > 0.249720, 0.259243, 0.268703, 0.278102, 0.287440, 0.296718, 0.305936, 0.315096, > 0.324198, 0.333243, 0.342232, 0.351165, 0.360043, 0.368867, 0.377638, 0.386355, > 0.395020, 0.403633, 0.412195, 0.420706, 0.429168, 0.437580, 0.445944, 0.454259, > 0.462526, 0.470747, 0.478921, 0.487049, 0.495131, 0.503168, 0.511161, 0.519110, > 0.527015, 0.534877, 0.542697, 0.550474, 0.558210, 0.565904, 0.573558, 0.581171, > 0.588744, 0.596278, 0.603772, 0.611228, 0.618646, 0.626025, 0.633367, 0.640672, > 0.647940, 0.655172, 0.662367, 0.669527, 0.676651, 0.683741, 0.690795, 0.697816, > 0.704802, 0.711755, 0.718674, 0.725561, 0.732415, 0.739236, 0.746025, 0.752782, > 0.759508, 0.766203, 0.772867, 0.779500, 0.786102, 0.792675, 0.799218, 0.805731, > 0.812215, 0.818670, 0.825097, 0.831494, 0.837864, 0.844205, 0.850519, 0.856805, > 0.863064, 0.869296, 0.875501, 0.881680, 0.887832, 0.893958, 0.900059, 0.906133, > 0.912182, 0.918206, 0.924205, 0.930179, 0.936128, 0.942053, 0.947953, 0.953830, > 0.959683, 0.965512, 0.971317, 0.977100, 0.982859, 0.988595, 0.994309, 1.000000, > }; 1118,1119c1134,1174 < FLOAT_T linear_vol_table[128]; < FLOAT_T log_vol_table[128]; --- > FLOAT_T linear_vol_table[128] = > { > 0.000000000000000000, 0.007874015748031495, 0.015748031496062991, 0.023622047244094486, 0.031496062992125982, 0.039370078740157478, 0.047244094488188972, 0.055118110236220472, > 0.062992125984251963, 0.070866141732283463, 0.078740157480314954, 0.086614173228346463, 0.094488188976377945, 0.102362204724409445, 0.110236220472440949, 0.118110236220472430, > 0.125984251968503935, 0.133858267716535440, 0.141732283464566926, 0.149606299212598426, 0.157480314960629908, 0.165354330708661434, 0.173228346456692917, 0.181102362204724425, > 0.188976377952755907, 0.196850393700787407, 0.204724409448818889, 0.212598425196850416, 0.220472440944881898, 0.228346456692913380, 0.236220472440944862, 0.244094488188976388, > 0.251968503937007871, 0.259842519685039353, 0.267716535433070879, 0.275590551181102361, 0.283464566929133852, 0.291338582677165334, 0.299212598425196852, 0.307086614173228334, > 0.314960629921259816, 0.322834645669291298, 0.330708661417322869, 0.338582677165354351, 0.346456692913385833, 0.354330708661417315, 0.362204724409448842, 0.370078740157480324, > 0.377952755905511806, 0.385826771653543297, 0.393700787401574814, 0.401574803149606296, 0.409448818897637778, 0.417322834645669261, 0.425196850393700831, 0.433070866141732314, > 0.440944881889763796, 0.448818897637795278, 0.456692913385826760, 0.464566929133858242, 0.472440944881889724, 0.480314960629921206, 0.488188976377952777, 0.496062992125984259, > 0.503937007874015741, 0.511811023622047223, 0.519685039370078705, 0.527559055118110187, 0.535433070866141758, 0.543307086614173240, 0.551181102362204722, 0.559055118110236204, > 0.566929133858267686, 0.574803149606299169, 0.582677165354330651, 0.590551181102362133, 0.598425196850393704, 0.606299212598425186, 0.614173228346456668, 0.622047244094488150, > 0.629921259842519632, 0.637795275590551114, 0.645669291338582596, 0.653543307086614078, 0.661417322834645738, 0.669291338582677220, 0.677165354330708702, 0.685039370078740184, > 0.692913385826771666, 0.700787401574803148, 0.708661417322834630, 0.716535433070866112, 0.724409448818897683, 0.732283464566929165, 0.740157480314960647, 0.748031496062992129, > 0.755905511811023612, 0.763779527559055094, 0.771653543307086576, 0.779527559055118058, 0.787401574803149629, 0.795275590551181111, 0.803149606299212593, 0.811023622047244075, > 0.818897637795275557, 0.826771653543307039, 0.834645669291338521, 0.842519685039370003, 0.850393700787401663, 0.858267716535433145, 0.866141732283464627, 0.874015748031496109, > 0.881889763779527591, 0.889763779527559073, 0.897637795275590555, 0.905511811023622037, 0.913385826771653520, 0.921259842519685002, 0.929133858267716484, 0.937007874015747966, > 0.944881889763779448, 0.952755905511810930, 0.960629921259842412, 0.968503937007873894, 0.976377952755905554, 0.984251968503937036, 0.992125984251968518, 1.000000000000000000, > }; > > FLOAT_T exp_vol_table[128] = > { > 0.000000, 0.004601, 0.009238, 0.013911, 0.018622, 0.023369, 0.028155, 0.032978, > 0.037839, 0.042739, 0.047677, 0.052655, 0.057672, 0.062728, 0.067825, 0.072961, > 0.078139, 0.083357, 0.088617, 0.093918, 0.099261, 0.104646, 0.110074, 0.115544, > 0.121058, 0.126616, 0.132217, 0.137863, 0.143554, 0.149289, 0.155070, 0.160896, > 0.166769, 0.172688, 0.178653, 0.184666, 0.190726, 0.196835, 0.202991, 0.209197, > 0.215451, 0.221755, 0.228108, 0.234512, 0.240966, 0.247472, 0.254029, 0.260637, > 0.267298, 0.274012, 0.280779, 0.287599, 0.294473, 0.301401, 0.308385, 0.315423, > 0.322517, 0.329667, 0.336874, 0.344137, 0.351458, 0.358837, 0.366274, 0.373770, > 0.381326, 0.388941, 0.396616, 0.404352, 0.412149, 0.420007, 0.427928, 0.435912, > 0.443958, 0.452068, 0.460243, 0.468481, 0.476785, 0.485155, 0.493591, 0.502093, > 0.510663, 0.519300, 0.528006, 0.536781, 0.545624, 0.554538, 0.563522, 0.572578, > 0.581705, 0.590904, 0.600175, 0.609520, 0.618939, 0.628433, 0.638001, 0.647645, > 0.657365, 0.667162, 0.677037, 0.686990, 0.697021, 0.707132, 0.717322, 0.727593, > 0.737945, 0.748380, 0.758896, 0.769496, 0.780179, 0.790947, 0.801801, 0.812739, > 0.823765, 0.834877, 0.846078, 0.857367, 0.868745, 0.880213, 0.891772, 0.903422, > 0.915164, 0.926999, 0.938928, 0.950950, 0.963068, 0.975282, 0.987592, 1.000000, > }; > > uint8 velocity_table[128]; 1120a1176 > diff 17/tables.h 18/tables.h 60a61 > extern FLOAT_T exp_vol_table[]; diff 17/timidity.c 18/timidity.c 1134a1135 > tone->tva_level = -1; 1395,1423d1395 < /* #extension legato [program] [0 or 1] */ < else if(strcmp(w[0], "legato") == 0) < { < if(words != 3) < { < ctl->cmsg(CMSG_ERROR, VERB_NORMAL, < "%s: line %d: syntax error", name, line); < CHECKERRLIMIT; < continue; < } < if(!bank) < { < ctl->cmsg(CMSG_ERROR, VERB_NORMAL, < "%s: line %d: Must specify tone bank or drum set " < "before assignment", name, line); < CHECKERRLIMIT; < continue; < } < i = atoi(w[1]); < if(i < 0 || i > 127) < { < ctl->cmsg(CMSG_ERROR, VERB_NORMAL, < "%s: line %d: extension legato " < "must be between 0 and 127", name, line); < CHECKERRLIMIT; < continue; < } < bank->tone[i].legato = atoi(w[2]); < } 1683a1656,1683 > } /* #extension legato [program] [0 or 1] */ > else if(strcmp(w[0], "legato") == 0) > { > if(words != 3) > { > ctl->cmsg(CMSG_ERROR, VERB_NORMAL, > "%s: line %d: syntax error", name, line); > CHECKERRLIMIT; > continue; > } > if(!bank) > { > ctl->cmsg(CMSG_ERROR, VERB_NORMAL, > "%s: line %d: Must specify tone bank or drum set " > "before assignment", name, line); > CHECKERRLIMIT; > continue; > } > i = atoi(w[1]); > if(i < 0 || i > 127) > { > ctl->cmsg(CMSG_ERROR, VERB_NORMAL, > "%s: line %d: extension legato " > "must be between 0 and 127", name, line); > CHECKERRLIMIT; > continue; > } > bank->tone[i].legato = atoi(w[2]); 1705c1705 < "%s: line %d: extension fine " --- > "%s: line %d: extension cutoff " 1711c1711 < } /* #extension resoance program resonance */ --- > } /* #extension resonance program resonance */ 1732c1732 < "%s: line %d: extension fine " --- > "%s: line %d: extension resonance " 1737a1738,1764 > } /* #extension level program tva_level */ > else if(strcmp(w[0], "level") == 0) > { > if(words != 3) > { > ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error", name, line); > CHECKERRLIMIT; > continue; > } > if(!bank) > { > ctl->cmsg(CMSG_ERROR, VERB_NORMAL, > "%s: line %d: Must specify tone bank or drum set " > "before assignment", name, line); > CHECKERRLIMIT; > continue; > } > i = atoi(w[1]); > if(i < 0 || i > 127) > { > ctl->cmsg(CMSG_ERROR, VERB_NORMAL, > "%s: line %d: extension level " > "must be between 0 and 127", name, line); > CHECKERRLIMIT; > continue; > } > bank->tone[i].tva_level = atoi(w[2]);