to_offset(tone->modenvofs[i][j]);
}
}
+ if (tone->envkeyfnum)
+ for (i = 0; i < ip->samples; i++) {
+ sp = &ip->sample[i];
+ if (tone->envkeyfnum == 1) {
+ for (j = 0; j < 6; j++)
+ if (tone->envkeyf[0][j] != -1)
+ sp->envelope_keyf[j] = tone->envkeyf[0][j];
+ } else if (i < tone->envkeyfnum) {
+ for (j = 0; j < 6; j++)
+ if (tone->envkeyf[i][j] != -1)
+ sp->envelope_keyf[j] = tone->envkeyf[i][j];
+ }
+ }
+ if (tone->modenvkeyfnum)
+ for (i = 0; i < ip->samples; i++) {
+ sp = &ip->sample[i];
+ if (tone->modenvkeyfnum == 1) {
+ for (j = 0; j < 6; j++)
+ if (tone->modenvkeyf[0][j] != -1)
+ sp->modenv_keyf[j] = tone->modenvkeyf[0][j];
+ } else if (i < tone->modenvkeyfnum) {
+ for (j = 0; j < 6; j++)
+ if (tone->modenvkeyf[i][j] != -1)
+ sp->modenv_keyf[j] = tone->modenvkeyf[i][j];
+ }
+ }
+ if (tone->modenvvelfnum)
+ for (i = 0; i < ip->samples; i++) {
+ sp = &ip->sample[i];
+ if (tone->modenvvelfnum == 1) {
+ for (j = 0; j < 6; j++)
+ if (tone->modenvvelf[0][j] != -1)
+ sp->modenv_velf[j] = tone->modenvvelf[0][j];
+ } else if (i < tone->modenvvelfnum) {
+ for (j = 0; j < 6; j++)
+ if (tone->modenvvelf[i][j] != -1)
+ sp->modenv_velf[j] = tone->modenvvelf[i][j];
+ }
+ }
+ if (tone->envvelfnum)
+ for (i = 0; i < ip->samples; i++) {
+ sp = &ip->sample[i];
+ if (tone->envvelfnum == 1) {
+ for (j = 0; j < 6; j++)
+ if (tone->envvelf[0][j] != -1)
+ sp->envelope_velf[j] = tone->envvelf[0][j];
+ } else if (i < tone->envvelfnum) {
+ for (j = 0; j < 6; j++)
+ if (tone->envvelf[i][j] != -1)
+ sp->envelope_velf[j] = tone->envvelf[i][j];
+ }
+ }
if (tone->trempitchnum)
for (i = 0; i < ip->samples; i++) {
sp = &ip->sample[i];
&& tone->tremnum == 0 && tone->vibnum == 0
&& tone->sclnotenum == 0 && tone->scltunenum == 0
&& tone->modenvratenum == 0 && tone->modenvofsnum == 0
+ && tone->modenvkeyfnum == 0 && tone->modenvvelfnum == 0
+ && tone->envkeyfnum == 0 && tone->envvelfnum == 0
&& tone->trempitchnum == 0 && tone->tremfcnum == 0
&& tone->modpitchnum == 0 && tone->modfcnum == 0
&& tone->fcnum == 0 && tone->resonum == 0)
elm->modenvofs[i] = (int *) safe_memdup(elm->modenvofs[i],
6 * sizeof(int));
}
+ if (elm->envkeyfnum) {
+ elm->envkeyf = (int **) safe_memdup(elm->envkeyf,
+ elm->envkeyfnum * sizeof(int *));
+ for (i = 0; i < elm->envkeyfnum; i++)
+ elm->envkeyf[i] = (int *) safe_memdup(elm->envkeyf[i],
+ 6 * sizeof(int));
+ }
+ if (elm->envvelfnum) {
+ elm->envvelf = (int **) safe_memdup(elm->envvelf,
+ elm->envvelfnum * sizeof(int *));
+ for (i = 0; i < elm->envvelfnum; i++)
+ elm->envvelf[i] = (int *) safe_memdup(elm->envvelf[i],
+ 6 * sizeof(int));
+ }
+ if (elm->modenvkeyfnum) {
+ elm->modenvkeyf = (int **) safe_memdup(elm->modenvkeyf,
+ elm->modenvkeyfnum * sizeof(int *));
+ for (i = 0; i < elm->modenvkeyfnum; i++)
+ elm->modenvkeyf[i] = (int *) safe_memdup(elm->modenvkeyf[i],
+ 6 * sizeof(int));
+ }
+ if (elm->modenvvelfnum) {
+ elm->modenvvelf = (int **) safe_memdup(elm->modenvvelf,
+ elm->modenvvelfnum * sizeof(int *));
+ for (i = 0; i < elm->modenvvelfnum; i++)
+ elm->modenvvelf[i] = (int *) safe_memdup(elm->modenvvelf[i],
+ 6 * sizeof(int));
+ }
if (elm->trempitchnum)
elm->trempitch = (int16 *) safe_memdup(elm->trempitch,
elm->trempitchnum * sizeof(int16));
if (elm->modenvofsnum)
free_ptr_list(elm->modenvofs, elm->modenvofsnum);
elm->modenvofs = NULL, elm->modenvofsnum = 0;
+ if (elm->envkeyfnum)
+ free_ptr_list(elm->envkeyf, elm->envkeyfnum);
+ elm->envkeyf = NULL, elm->envkeyfnum = 0;
+ if (elm->envvelfnum)
+ free_ptr_list(elm->envvelf, elm->envvelfnum);
+ elm->envvelf = NULL, elm->envvelfnum = 0;
+ if (elm->modenvkeyfnum)
+ free_ptr_list(elm->modenvkeyf, elm->modenvkeyfnum);
+ elm->modenvkeyf = NULL, elm->modenvkeyfnum = 0;
+ if (elm->modenvvelfnum)
+ free_ptr_list(elm->modenvvelf, elm->modenvvelfnum);
+ elm->modenvvelf = NULL, elm->modenvvelfnum = 0;
if (elm->trempitch)
free(elm->trempitch);
elm->trempitch = NULL, elm->trempitchnum = 0;
char *comment;
Instrument *instrument;
int8 note, pan, strip_loop, strip_envelope, strip_tail, loop_timeout,
- font_preset, font_keynote, legato, tva_level, play_note, redamper;
+ font_preset, font_keynote, legato, tva_level, play_note, damper_mode;
uint8 font_bank;
uint8 instype; /* 0: Normal
1: %font
int envratenum, envofsnum;
int **envrate, **envofs;
int modenvratenum, modenvofsnum;
- int **modenvrate, **modenvofs;
+ int **modenvrate, **modenvofs;\r
+ int envvelfnum, envkeyfnum;\r
+ int **envvelf, **envkeyf;\r
+ int modenvvelfnum, modenvkeyfnum;\r
+ int **modenvvelf, **modenvkeyf;
int tremnum, vibnum;
struct Quantity_ **trem, **vib;
int16 vel_to_fc, key_to_fc, vel_to_resonance;
? channel[ch].drums[vp->note]->drum_envelope_rate[eg_stage]
: -1;
else {
+// ctl->cmsg(CMSG_INFO,VERB_NOISY,"keyf: %ld", vp->sample->envelope_keyf[stage]);
if (vp->sample->envelope_keyf[stage]) /* envelope key-follow */
rate *= pow(2.0, (double) (voice[v].note - 60)
* (double)vp->sample->envelope_keyf[stage] / 1200.0f);
static void update_channel_freq(int ch);
static void set_single_note_tuning(int, int, int, int);
static void set_user_temper_entry(int, int, int);
+void recompute_bank_parameter(int, int);
static void init_voice_filter(int);
/* XG Part EQ */
else
{
d[note]->drum_panning = NO_PANNING;
- for(j=0;j<6;j++) {d[note]->drum_envelope_rate[j] = -1;}
+ for(j = 0; j < 6; j++) {d[note]->drum_envelope_rate[j] = -1;}
d[note]->pan_random = 0;
d[note]->drum_level = 1.0f;
d[note]->coarse = 0;
}
}
+static void reset_instrument_parameters(int c)
+{
+ channel[c].legato = 0;
+ channel[c].damper_mode = 0;
+ channel[c].loop_timeout = 0;
+ recompute_bank_parameter(c, 0);
+}
+
static void reset_nrpn_controllers(int c)
{
int i;
free_drum_effect(c);
- channel[c].legato = 0;
- channel[c].redamper = 0;
- channel[c].loop_timeout = 0;
-
channel[c].sysex_gs_msb_addr = channel[c].sysex_gs_msb_val =
channel[c].sysex_xg_msb_addr = channel[c].sysex_xg_msb_val =
channel[c].sysex_msb_addr = channel[c].sysex_msb_val = 0;
channel[c].porta_control_ratio = 0;
channel[c].portamento = 0;
channel[c].last_note_fine = -1;
- for(j=0;j<6;j++) {channel[c].envelope_rate[j] = -1;}
+ for(j = 0; j < 6; j++) {channel[c].envelope_rate[j] = -1;}
update_portamento_controls(c);
set_reverb_level(c, -1);
if(opt_chorus_control == 1)
int i, cnt;
for (i = 0; i < MAX_CHANNELS; i++) {
+ reset_instrument_parameters(i);
reset_controllers(i);
reset_nrpn_controllers(i);
- reset_module_dependent_controllers(i);
+ reset_module_dependent_controllers(i);
/* The rest of these are unaffected
* by the Reset All Controllers event
*/
}
} else {
nprog = channel[ch].program;
- if(nprog == SPECIAL_PROGRAM) {return;}
+ if (nprog == SPECIAL_PROGRAM) {return;}
instrument_map(channel[ch].mapID, &nbank, &nprog);
bank = tonebank[nbank];
- if(bank == NULL) {bank = tonebank[0];}
+ if (bank == NULL) {bank = tonebank[0];}
channel[ch].legato = bank->tone[nprog].legato;
- channel[ch].redamper = bank->tone[nprog].redamper;
+ channel[ch].damper_mode = bank->tone[nprog].damper_mode;
channel[ch].loop_timeout = bank->tone[nprog].loop_timeout;
}
}
{
int uv = upper_voices, i;
- if(ISDRUMCHANNEL(ch) || channel[ch].redamper == 0) {return;}
+ if(ISDRUMCHANNEL(ch) || channel[ch].damper_mode == 0) {return;}
for(i = 0; i < uv; i++)
{
instrument_map(channel[ch].mapID, &b, &p);
play_midi_load_instrument(0, b, p);
}
+ reset_instrument_parameters(ch);
}
}
case ME_SUSTAIN:
channel[ch].sustain = current_event->a;
- if (channel[ch].redamper == 0) { /* half-damper is not allowed. */
+ if (channel[ch].damper_mode == 0) { /* half-damper is not allowed. */
if (channel[ch].sustain >= 64) {channel[ch].sustain = 127;}
else {channel[ch].sustain = 0;}
}
update_redamper_controls(ch);
}
channel[ch].sustain = ev->a;
- if (channel[ch].redamper == 0) { /* half-damper is not allowed. */
+ if (channel[ch].damper_mode == 0) { /* half-damper is not allowed. */
if (channel[ch].sustain >= 64) {channel[ch].sustain = 127;}
else {channel[ch].sustain = 0;}
}
int8 soft_pedal;
int8 sostenuto;
- int8 redamper;
+ int8 damper_mode;
int8 tone_map0_number;
FLOAT_T pitch_offset_fine; /* in Hz */
ChannelBitMask channel_layer;
int port_select;
- struct part_eq_xg eq_xg;
+ struct part_eq_xg eq_xg;\r
int8 dry_level;
int8 note_limit_high, note_limit_low; /* Note Limit (Keyboard Range) */
/* Anything but PANNED_MYSTERY only uses the left volume */
#define ISDRUMCHANNEL(c) IS_SET_CHANNELMASK(drumchannels, c)
+\r
+extern Channel channel[];\r
+extern Voice *voice;\r
/* --module */
extern int opt_default_module;
/* Special modules */
MODULE_TIMIDITY_SPECIAL1 = 0x70,
MODULE_TIMIDITY_DEBUG = 0x7f,
-};
-
-static inline int is_gs_module(void)
-{
- return (opt_default_module >= MODULE_SC55
- && opt_default_module <= MODULE_MU100);
+};\r
+\r
+static inline int get_module() {return opt_default_module;}\r
+
+static inline int is_gs_module()
+{\r
+ int module = get_module();
+ return (module >= MODULE_SC55 && module <= MODULE_MU100);
}
-static inline int is_xg_module(void)
-{
- return (opt_default_module >= MODULE_MU50
- && opt_default_module <= MODULE_MU100);
+static inline int is_xg_module()
+{\r
+ int module = get_module();
+ return (module >= MODULE_MU50 && module <= MODULE_MU100);
}
-static inline int get_module(void) {return opt_default_module;}
-
-extern Channel channel[];
-extern Voice *voice;
-
extern int32 control_ratio, amp_with_poly, amplification;
extern ChannelBitMask default_drumchannel_mask;
tone->modenvrate = config_parse_envelope(cp, &tone->modenvratenum);
else if (! strcmp(opts, "modoffset"))
tone->modenvofs = config_parse_envelope(cp, &tone->modenvofsnum);
+ else if (! strcmp(opts, "envkeyf"))
+ tone->envkeyf = config_parse_envelope(cp, &tone->envkeyfnum);
+ else if (! strcmp(opts, "envvelf"))
+ tone->envvelf = config_parse_envelope(cp, &tone->envvelfnum);
+ else if (! strcmp(opts, "modkeyf"))
+ tone->modenvkeyf = config_parse_envelope(cp, &tone->modenvkeyfnum);
+ else if (! strcmp(opts, "modvelf"))
+ tone->modenvvelf = config_parse_envelope(cp, &tone->modenvvelfnum);
else if (! strcmp(opts, "trempitch"))
tone->trempitch = config_parse_int16(cp, &tone->trempitchnum);
else if (! strcmp(opts, "tremfc"))
tone->amp = -1;
tone->rnddelay = 0;
tone->loop_timeout = 0;
- tone->legato = tone->redamper = tone->key_to_fc = tone->vel_to_fc = 0;
+ tone->legato = tone->damper_mode = tone->key_to_fc = tone->vel_to_fc = 0;
tone->reverb_send = tone->chorus_send = tone->delay_send = -1;
tone->tva_level = -1;
tone->play_note = -1;
continue;
}
bank->tone[i].legato = atoi(w[2]);
- } /* #extension redamper [program] [0 or 1] */
- else if(strcmp(w[0], "redamper") == 0)
+ } /* #extension damper [program] [0 or 1] */
+ else if(strcmp(w[0], "damper") == 0)
{
if(words != 3)
{
if(i < 0 || i > 127)
{
ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
- "%s: line %d: extension redamper "
+ "%s: line %d: extension damper "
"must be between 0 and 127", name, line);
CHECKERRLIMIT;
continue;
}
- bank->tone[i].redamper = atoi(w[2]);
+ bank->tone[i].damper_mode = atoi(w[2]);
} /* #extension rnddelay [program] [0 or 1] */
else if(strcmp(w[0], "rnddelay") == 0)
{