From 786f1b34beb903d48c121d846498e977329b666c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 24 Feb 2018 13:33:28 +0100 Subject: [PATCH] - did not save everything. --- src/sound/timiditypp/effect.cpp | 18 +++++++++--------- src/sound/timiditypp/instrum.cpp | 2 +- src/sound/timiditypp/mix.cpp | 8 ++++---- src/sound/timiditypp/playmidi.cpp | 12 ++++++------ src/sound/timiditypp/reverb.cpp | 20 ++++++++++---------- src/sound/timiditypp/sndfont.cpp | 4 ++-- src/sound/timiditypp/timidity.h | 21 +++++++++------------ 7 files changed, 41 insertions(+), 44 deletions(-) diff --git a/src/sound/timiditypp/effect.cpp b/src/sound/timiditypp/effect.cpp index c76d99c7e..6b2084e9c 100644 --- a/src/sound/timiditypp/effect.cpp +++ b/src/sound/timiditypp/effect.cpp @@ -183,27 +183,27 @@ void Effect::effect_left_right_delay(int32_t *buff, int32_t count) void Effect::do_effect(int32_t *buf, int32_t count) { int32_t nsamples = count * 2; - int reverb_level = (opt_reverb_control < 0) - ? -opt_reverb_control & 0x7f : DEFAULT_REVERB_SEND_LEVEL; + int reverb_level = (timidity_reverb < 0) + ? -timidity_reverb & 0x7f : DEFAULT_REVERB_SEND_LEVEL; /* for static reverb / chorus level */ - if (opt_reverb_control == 2 || opt_reverb_control == 4 - || (opt_reverb_control < 0 && !(opt_reverb_control & 0x80)) - || opt_chorus_control < 0) + if (timidity_reverb == 2 || timidity_reverb == 4 + || (timidity_reverb < 0 && !(timidity_reverb & 0x80)) + || timidity_chorus < 0) { reverb->set_dry_signal(buf, nsamples); /* chorus sounds horrible * if applied globally on top of channel chorus */ - if (opt_reverb_control == 2 || opt_reverb_control == 4 - || (opt_reverb_control < 0 && !(opt_reverb_control & 0x80))) + if (timidity_reverb == 2 || timidity_reverb == 4 + || (timidity_reverb < 0 && !(timidity_reverb & 0x80))) reverb->set_ch_reverb(buf, nsamples, reverb_level); reverb->mix_dry_signal(buf, nsamples); /* chorus sounds horrible * if applied globally on top of channel chorus */ - if (opt_reverb_control == 2 || opt_reverb_control == 4 - || (opt_reverb_control < 0 && !(opt_reverb_control & 0x80))) + if (timidity_reverb == 2 || timidity_reverb == 4 + || (timidity_reverb < 0 && !(timidity_reverb & 0x80))) reverb->do_ch_reverb(buf, nsamples); } /* L/R Delay */ diff --git a/src/sound/timiditypp/instrum.cpp b/src/sound/timiditypp/instrum.cpp index 5b51faea2..988da8730 100644 --- a/src/sound/timiditypp/instrum.cpp +++ b/src/sound/timiditypp/instrum.cpp @@ -948,7 +948,7 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr, pre_resample(sp); /* do pitch detection on drums if surround chorus is used */ - if (dr && opt_surround_chorus) + if (dr && timidity_surround_chorus) { Freq freq; sp->chord = -1; diff --git a/src/sound/timiditypp/mix.cpp b/src/sound/timiditypp/mix.cpp index 110f9748c..b4b19e2ea 100644 --- a/src/sound/timiditypp/mix.cpp +++ b/src/sound/timiditypp/mix.cpp @@ -83,7 +83,7 @@ void Mixer::mix_voice(int32_t *buf, int v, int32_t c) vp->delay -= c; if (vp->tremolo_phase_increment) update_tremolo(v); - if (opt_modulation_envelope && vp->sample->modes & MODES_ENVELOPE) + if (timidity_modulation_envelope && vp->sample->modes & MODES_ENVELOPE) update_modulation_envelope(v); return; } @@ -1052,7 +1052,7 @@ int Mixer::update_signal(int v) return 1; if (vp->tremolo_phase_increment) update_tremolo(v); - if (opt_modulation_envelope && vp->sample->modes & MODES_ENVELOPE) + if (timidity_modulation_envelope && vp->sample->modes & MODES_ENVELOPE) update_modulation_envelope(v); return apply_envelope_to_amp(v); } @@ -1481,7 +1481,7 @@ int Mixer::apply_modulation_envelope(int v) { Voice *vp = &player->voice[v]; - if(!opt_modulation_envelope) {return 0;} + if(!timidity_modulation_envelope) {return 0;} if (vp->sample->modes & MODES_ENVELOPE) { vp->last_modenv_volume = modenv_vol_table[vp->modenv_volume >> 20]; @@ -1574,7 +1574,7 @@ int Mixer::recompute_modulation_envelope(int v) int32_t modenv_width; Voice *vp = &player->voice[v]; - if(!opt_modulation_envelope) {return 0;} + if(!timidity_modulation_envelope) {return 0;} stage = vp->modenv_stage; if (stage > EG_GUS_RELEASE3) {return 1;} diff --git a/src/sound/timiditypp/playmidi.cpp b/src/sound/timiditypp/playmidi.cpp index a66209230..0a1af32fb 100644 --- a/src/sound/timiditypp/playmidi.cpp +++ b/src/sound/timiditypp/playmidi.cpp @@ -71,13 +71,13 @@ CUSTOM_CVAR(Float, timidity_drum_power, 1.0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) / if (self < 0) self = 0; else if (self > MAX_AMPLIFICATION/100.f) self = MAX_AMPLIFICATION/100.f; } -CUSTOM_CVAR(Int, key_adjust, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CUSTOM_CVAR(Int, timidity_key_adjust, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { if (self < -24) self = -24; else if (self > 24) self = 24; } // For testing mainly. -CUSTOM_CVAR(Float, tempo_adjust, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CUSTOM_CVAR(Float, timidity_tempo_adjust, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { if (self < 0.25) self = 0.25; else if (self > 10) self = 10; @@ -5508,8 +5508,8 @@ int Player::play_event(MidiEvent *ev) i += (i > 0) ? -5 : 7, j++; while (abs(j - note_key_offset) > 7) j += (j > note_key_offset) ? -12 : 12; - if (abs(j - key_adjust) >= 12) - j += (j > key_adjust) ? -12 : 12; + if (abs(j - timidity_key_adjust) >= 12) + j += (j > timidity_key_adjust) ? -12 : 12; note_key_offset = j; kill_all_voices(); } @@ -5803,8 +5803,8 @@ void Player::playmidi_stream_init(void) int i; static int first = 1; - note_key_offset = key_adjust; - midi_time_ratio = tempo_adjust; + note_key_offset = timidity_key_adjust; + midi_time_ratio = timidity_tempo_adjust; CLEAR_CHANNELMASK(channel_mute); if (temper_type_mute & 1) FILL_CHANNELMASK(channel_mute); diff --git a/src/sound/timiditypp/reverb.cpp b/src/sound/timiditypp/reverb.cpp index e6adc62fa..c0446c8c6 100644 --- a/src/sound/timiditypp/reverb.cpp +++ b/src/sound/timiditypp/reverb.cpp @@ -1582,8 +1582,8 @@ void Reverb::init_reverb(void) init_filter_lowpass1(&(reverb_status_gs.lpf)); /* Only initialize freeverb if stereo output */ /* Old non-freeverb must be initialized for mono reverb not to crash */ - if ( (opt_reverb_control == 3 || opt_reverb_control == 4 - || (opt_reverb_control < 0 && ! (opt_reverb_control & 0x100)))) { + if ( (timidity_reverb == 3 || timidity_reverb == 4 + || (timidity_reverb < 0 && ! (timidity_reverb & 0x100)))) { switch(reverb_status_gs.character) { /* select reverb algorithm */ case 5: /* Plate Reverb */ do_ch_plate_reverb(NULL, MAGIC_INIT_EFFECT_INFO, &(reverb_status_gs.info_plate_reverb)); @@ -1613,12 +1613,12 @@ void Reverb::init_reverb(void) void Reverb::do_ch_reverb(int32_t *buf, int32_t count) { #ifdef SYS_EFFECT_PRE_LPF - if ((opt_reverb_control == 3 || opt_reverb_control == 4 - || (opt_reverb_control < 0 && ! (opt_reverb_control & 0x100))) && reverb_status_gs.pre_lpf) + if ((timidity_reverb == 3 || timidity_reverb == 4 + || (timidity_reverb < 0 && ! (timidity_reverb & 0x100))) && reverb_status_gs.pre_lpf) do_filter_lowpass1_stereo(reverb_effect_buffer, count, &(reverb_status_gs.lpf)); #endif /* SYS_EFFECT_PRE_LPF */ - if (opt_reverb_control == 3 || opt_reverb_control == 4 - || (opt_reverb_control < 0 && ! (opt_reverb_control & 0x100))) { + if (timidity_reverb == 3 || timidity_reverb == 4 + || (timidity_reverb < 0 && ! (timidity_reverb & 0x100))) { switch(reverb_status_gs.character) { /* select reverb algorithm */ case 5: /* Plate Reverb */ do_ch_plate_reverb(buf, count, &(reverb_status_gs.info_plate_reverb)); @@ -1656,8 +1656,8 @@ void Reverb::init_ch_delay(void) void Reverb::do_ch_delay(int32_t *buf, int32_t count) { #ifdef SYS_EFFECT_PRE_LPF - if ((opt_reverb_control == 3 || opt_reverb_control == 4 - || (opt_reverb_control < 0 && ! (opt_reverb_control & 0x100))) && delay_status_gs.pre_lpf) + if ((timidity_reverb == 3 || timidity_reverb == 4 + || (timidity_reverb < 0 && ! (timidity_reverb & 0x100))) && delay_status_gs.pre_lpf) do_filter_lowpass1_stereo(delay_effect_buffer, count, &(delay_status_gs.lpf)); #endif /* SYS_EFFECT_PRE_LPF */ switch (delay_status_gs.type) { @@ -1953,8 +1953,8 @@ void Reverb::set_ch_chorus(int32_t *sbuffer,int32_t n, int32_t level) void Reverb::do_ch_chorus(int32_t *buf, int32_t count) { #ifdef SYS_EFFECT_PRE_LPF - if ((opt_reverb_control == 3 || opt_reverb_control == 4 - || (opt_reverb_control < 0 && ! (opt_reverb_control & 0x100))) && chorus_status_gs.pre_lpf) + if ((timidity_reverb == 3 || timidity_reverb == 4 + || (timidity_reverb < 0 && ! (timidity_reverb & 0x100))) && chorus_status_gs.pre_lpf) do_filter_lowpass1_stereo(chorus_effect_buffer, count, &(chorus_status_gs.lpf)); #endif /* SYS_EFFECT_PRE_LPF */ diff --git a/src/sound/timiditypp/sndfont.cpp b/src/sound/timiditypp/sndfont.cpp index c38f8d6ab..9e0e51d18 100644 --- a/src/sound/timiditypp/sndfont.cpp +++ b/src/sound/timiditypp/sndfont.cpp @@ -580,7 +580,7 @@ Instrument *Instruments::load_from_file(SFInsts *rec, InstList *ip) pre_resample(sample); /* do pitch detection on drums if surround chorus is used */ - if (ip->pat.bank == 128 && opt_surround_chorus) + if (ip->pat.bank == 128 && timidity_surround_chorus) { Freq freq; sample->chord = -1; @@ -1299,7 +1299,7 @@ void Instruments::set_init_info(SFInfo *sf, SampleList *vp, LayerTable *tbl) val = (int)tbl->val[SF_initialFilterFc]; val = abscent_to_Hz(val); - if(!opt_modulation_envelope) { + if(!timidity_modulation_envelope) { if(tbl->set[SF_env1ToFilterFc] && (int)tbl->val[SF_env1ToFilterFc] > 0) { val = int( val * pow(2.0,(double)tbl->val[SF_env1ToFilterFc] / 1200.0f)); diff --git a/src/sound/timiditypp/timidity.h b/src/sound/timiditypp/timidity.h index 75284ea49..272c35818 100644 --- a/src/sound/timiditypp/timidity.h +++ b/src/sound/timiditypp/timidity.h @@ -37,18 +37,15 @@ #endif -EXTERN_CVAR(Int, key_adjust) -EXTERN_CVAR(Float, tempo_adjust) -EXTERN_CVAR(Bool, opt_modulation_wheel) -EXTERN_CVAR(Bool, opt_portamento) -EXTERN_CVAR(Bool, opt_nrpn_vibrato) -EXTERN_CVAR(Int, opt_reverb_control) -EXTERN_CVAR(Int, opt_chorus_control) -EXTERN_CVAR(Bool, opt_surround_chorus) -EXTERN_CVAR(Bool, opt_channel_pressure) -EXTERN_CVAR(Int, opt_lpf_def) -EXTERN_CVAR(Bool, opt_temper_control) -EXTERN_CVAR(Bool, opt_modulation_envelope) +EXTERN_CVAR(Bool, timidity_modulation_wheel) +EXTERN_CVAR(Bool, timidity_portamento) +EXTERN_CVAR(Int, timidity_reverb) +EXTERN_CVAR(Int, timidity_chorus) +EXTERN_CVAR(Bool, timidity_surround_chorus) +EXTERN_CVAR(Bool, timidity_channel_pressure) +EXTERN_CVAR(Int, timidity_lpf_def) +EXTERN_CVAR(Bool, timidity_temper_control) +EXTERN_CVAR(Bool, timidity_modulation_envelope) /*