Optimized the parameter change method.

pull/1/head
Holger Wirtz 8 years ago
parent 993eb5ca0e
commit 45f7028f4e
  1. 314
      src/dexed.cpp
  2. 3
      src/dexed.h

@ -152,157 +152,157 @@ void Dexed::set_params(void)
} }
// OP6 // OP6
onParam(0,static_cast<uint8_t>(*p(p_op6_eg_rate_1))); onParam(0,*p(p_op6_eg_rate_1));
onParam(1,static_cast<uint8_t>(*p(p_op6_eg_rate_2))); onParam(1,*p(p_op6_eg_rate_2));
onParam(2,static_cast<uint8_t>(*p(p_op6_eg_rate_3))); onParam(2,*p(p_op6_eg_rate_3));
onParam(3,static_cast<uint8_t>(*p(p_op6_eg_rate_4))); onParam(3,*p(p_op6_eg_rate_4));
onParam(4,static_cast<uint8_t>(*p(p_op6_eg_level_1))); onParam(4,*p(p_op6_eg_level_1));
onParam(5,static_cast<uint8_t>(*p(p_op6_eg_level_2))); onParam(5,*p(p_op6_eg_level_2));
onParam(6,static_cast<uint8_t>(*p(p_op6_eg_level_3))); onParam(6,*p(p_op6_eg_level_3));
onParam(7,static_cast<uint8_t>(*p(p_op6_eg_level_4))); onParam(7,*p(p_op6_eg_level_4));
onParam(8,static_cast<uint8_t>(*p(p_op6_kbd_lev_scl_brk_pt))); onParam(8,*p(p_op6_kbd_lev_scl_brk_pt));
onParam(9,static_cast<uint8_t>(*p(p_op6_kbd_lev_scl_lft_depth))); onParam(9,*p(p_op6_kbd_lev_scl_lft_depth));
onParam(10,static_cast<uint8_t>(*p(p_op6_kbd_lev_scl_rht_depth))); onParam(10,*p(p_op6_kbd_lev_scl_rht_depth));
onParam(11,static_cast<uint8_t>(*p(p_op6_kbd_lev_scl_lft_curve))); onParam(11,*p(p_op6_kbd_lev_scl_lft_curve));
onParam(12,static_cast<uint8_t>(*p(p_op6_kbd_lev_scl_rht_curve))); onParam(12,*p(p_op6_kbd_lev_scl_rht_curve));
onParam(13,static_cast<uint8_t>(*p(p_op6_kbd_rate_scaling))); onParam(13,*p(p_op6_kbd_rate_scaling));
onParam(14,static_cast<uint8_t>(*p(p_op6_amp_mod_sensitivity))); onParam(14,*p(p_op6_amp_mod_sensitivity));
onParam(15,static_cast<uint8_t>(*p(p_op6_key_vel_sensitivity))); onParam(15,*p(p_op6_key_vel_sensitivity));
onParam(16,static_cast<uint8_t>(*p(p_op6_operator_output_level))); onParam(16,*p(p_op6_operator_output_level));
onParam(17,static_cast<uint8_t>(*p(p_op6_osc_mode))); onParam(17,*p(p_op6_osc_mode));
onParam(18,static_cast<uint8_t>(*p(p_op6_osc_freq_coarse))); onParam(18,*p(p_op6_osc_freq_coarse));
onParam(19,static_cast<uint8_t>(*p(p_op6_osc_freq_fine))); onParam(19,*p(p_op6_osc_freq_fine));
onParam(20,static_cast<uint8_t>(*p(p_op6_osc_detune)+7)); onParam(20,*p(p_op6_osc_detune)+7);
// OP5 // OP5
onParam(21,static_cast<uint8_t>(*p(p_op5_eg_rate_1))); onParam(21,*p(p_op5_eg_rate_1));
onParam(22,static_cast<uint8_t>(*p(p_op5_eg_rate_2))); onParam(22,*p(p_op5_eg_rate_2));
onParam(23,static_cast<uint8_t>(*p(p_op5_eg_rate_3))); onParam(23,*p(p_op5_eg_rate_3));
onParam(24,static_cast<uint8_t>(*p(p_op5_eg_rate_4))); onParam(24,*p(p_op5_eg_rate_4));
onParam(25,static_cast<uint8_t>(*p(p_op5_eg_level_1))); onParam(25,*p(p_op5_eg_level_1));
onParam(26,static_cast<uint8_t>(*p(p_op5_eg_level_2))); onParam(26,*p(p_op5_eg_level_2));
onParam(27,static_cast<uint8_t>(*p(p_op5_eg_level_3))); onParam(27,*p(p_op5_eg_level_3));
onParam(28,static_cast<uint8_t>(*p(p_op5_eg_level_4))); onParam(28,*p(p_op5_eg_level_4));
onParam(29,static_cast<uint8_t>(*p(p_op5_kbd_lev_scl_brk_pt))); onParam(29,*p(p_op5_kbd_lev_scl_brk_pt));
onParam(30,static_cast<uint8_t>(*p(p_op5_kbd_lev_scl_lft_depth))); onParam(30,*p(p_op5_kbd_lev_scl_lft_depth));
onParam(31,static_cast<uint8_t>(*p(p_op5_kbd_lev_scl_rht_depth))); onParam(31,*p(p_op5_kbd_lev_scl_rht_depth));
onParam(32,static_cast<uint8_t>(*p(p_op5_kbd_lev_scl_lft_curve))); onParam(32,*p(p_op5_kbd_lev_scl_lft_curve));
onParam(33,static_cast<uint8_t>(*p(p_op5_kbd_lev_scl_rht_curve))); onParam(33,*p(p_op5_kbd_lev_scl_rht_curve));
onParam(34,static_cast<uint8_t>(*p(p_op5_kbd_rate_scaling))); onParam(34,*p(p_op5_kbd_rate_scaling));
onParam(35,static_cast<uint8_t>(*p(p_op5_amp_mod_sensitivity))); onParam(35,*p(p_op5_amp_mod_sensitivity));
onParam(36,static_cast<uint8_t>(*p(p_op5_key_vel_sensitivity))); onParam(36,*p(p_op5_key_vel_sensitivity));
onParam(37,static_cast<uint8_t>(*p(p_op5_operator_output_level))); onParam(37,*p(p_op5_operator_output_level));
onParam(38,static_cast<uint8_t>(*p(p_op5_osc_mode))); onParam(38,*p(p_op5_osc_mode));
onParam(39,static_cast<uint8_t>(*p(p_op5_osc_freq_coarse))); onParam(39,*p(p_op5_osc_freq_coarse));
onParam(40,static_cast<uint8_t>(*p(p_op5_osc_freq_fine))); onParam(40,*p(p_op5_osc_freq_fine));
onParam(41,static_cast<uint8_t>(*p(p_op5_osc_detune)+7)); onParam(41,*p(p_op5_osc_detune)+7);
// OP4 // OP4
onParam(42,static_cast<uint8_t>(*p(p_op4_eg_rate_1))); onParam(42,*p(p_op4_eg_rate_1));
onParam(43,static_cast<uint8_t>(*p(p_op4_eg_rate_2))); onParam(43,*p(p_op4_eg_rate_2));
onParam(44,static_cast<uint8_t>(*p(p_op4_eg_rate_3))); onParam(44,*p(p_op4_eg_rate_3));
onParam(45,static_cast<uint8_t>(*p(p_op4_eg_rate_4))); onParam(45,*p(p_op4_eg_rate_4));
onParam(46,static_cast<uint8_t>(*p(p_op4_eg_level_1))); onParam(46,*p(p_op4_eg_level_1));
onParam(47,static_cast<uint8_t>(*p(p_op4_eg_level_2))); onParam(47,*p(p_op4_eg_level_2));
onParam(48,static_cast<uint8_t>(*p(p_op4_eg_level_3))); onParam(48,*p(p_op4_eg_level_3));
onParam(49,static_cast<uint8_t>(*p(p_op4_eg_level_4))); onParam(49,*p(p_op4_eg_level_4));
onParam(50,static_cast<uint8_t>(*p(p_op4_kbd_lev_scl_brk_pt))); onParam(50,*p(p_op4_kbd_lev_scl_brk_pt));
onParam(51,static_cast<uint8_t>(*p(p_op4_kbd_lev_scl_lft_depth))); onParam(51,*p(p_op4_kbd_lev_scl_lft_depth));
onParam(52,static_cast<uint8_t>(*p(p_op4_kbd_lev_scl_rht_depth))); onParam(52,*p(p_op4_kbd_lev_scl_rht_depth));
onParam(53,static_cast<uint8_t>(*p(p_op4_kbd_lev_scl_lft_curve))); onParam(53,*p(p_op4_kbd_lev_scl_lft_curve));
onParam(54,static_cast<uint8_t>(*p(p_op4_kbd_lev_scl_rht_curve))); onParam(54,*p(p_op4_kbd_lev_scl_rht_curve));
onParam(55,static_cast<uint8_t>(*p(p_op4_kbd_rate_scaling))); onParam(55,*p(p_op4_kbd_rate_scaling));
onParam(56,static_cast<uint8_t>(*p(p_op4_amp_mod_sensitivity))); onParam(56,*p(p_op4_amp_mod_sensitivity));
onParam(57,static_cast<uint8_t>(*p(p_op4_key_vel_sensitivity))); onParam(57,*p(p_op4_key_vel_sensitivity));
onParam(58,static_cast<uint8_t>(*p(p_op4_operator_output_level))); onParam(58,*p(p_op4_operator_output_level));
onParam(59,static_cast<uint8_t>(*p(p_op4_osc_mode))); onParam(59,*p(p_op4_osc_mode));
onParam(60,static_cast<uint8_t>(*p(p_op4_osc_freq_coarse))); onParam(60,*p(p_op4_osc_freq_coarse));
onParam(61,static_cast<uint8_t>(*p(p_op4_osc_freq_fine))); onParam(61,*p(p_op4_osc_freq_fine));
onParam(62,static_cast<uint8_t>(*p(p_op4_osc_detune)+7)); onParam(62,*p(p_op4_osc_detune)+7);
// OP3 // OP3
onParam(63,static_cast<uint8_t>(*p(p_op3_eg_rate_1))); onParam(63,*p(p_op3_eg_rate_1));
onParam(64,static_cast<uint8_t>(*p(p_op3_eg_rate_2))); onParam(64,*p(p_op3_eg_rate_2));
onParam(65,static_cast<uint8_t>(*p(p_op3_eg_rate_3))); onParam(65,*p(p_op3_eg_rate_3));
onParam(66,static_cast<uint8_t>(*p(p_op3_eg_rate_4))); onParam(66,*p(p_op3_eg_rate_4));
onParam(67,static_cast<uint8_t>(*p(p_op3_eg_level_1))); onParam(67,*p(p_op3_eg_level_1));
onParam(68,static_cast<uint8_t>(*p(p_op3_eg_level_2))); onParam(68,*p(p_op3_eg_level_2));
onParam(69,static_cast<uint8_t>(*p(p_op3_eg_level_3))); onParam(69,*p(p_op3_eg_level_3));
onParam(70,static_cast<uint8_t>(*p(p_op3_eg_level_4))); onParam(70,*p(p_op3_eg_level_4));
onParam(71,static_cast<uint8_t>(*p(p_op3_kbd_lev_scl_brk_pt))); onParam(71,*p(p_op3_kbd_lev_scl_brk_pt));
onParam(72,static_cast<uint8_t>(*p(p_op3_kbd_lev_scl_lft_depth))); onParam(72,*p(p_op3_kbd_lev_scl_lft_depth));
onParam(73,static_cast<uint8_t>(*p(p_op3_kbd_lev_scl_rht_depth))); onParam(73,*p(p_op3_kbd_lev_scl_rht_depth));
onParam(74,static_cast<uint8_t>(*p(p_op3_kbd_lev_scl_lft_curve))); onParam(74,*p(p_op3_kbd_lev_scl_lft_curve));
onParam(75,static_cast<uint8_t>(*p(p_op3_kbd_lev_scl_rht_curve))); onParam(75,*p(p_op3_kbd_lev_scl_rht_curve));
onParam(76,static_cast<uint8_t>(*p(p_op3_kbd_rate_scaling))); onParam(76,*p(p_op3_kbd_rate_scaling));
onParam(77,static_cast<uint8_t>(*p(p_op3_amp_mod_sensitivity))); onParam(77,*p(p_op3_amp_mod_sensitivity));
onParam(78,static_cast<uint8_t>(*p(p_op3_key_vel_sensitivity))); onParam(78,*p(p_op3_key_vel_sensitivity));
onParam(79,static_cast<uint8_t>(*p(p_op3_operator_output_level))); onParam(79,*p(p_op3_operator_output_level));
onParam(80,static_cast<uint8_t>(*p(p_op3_osc_mode))); onParam(80,*p(p_op3_osc_mode));
onParam(81,static_cast<uint8_t>(*p(p_op3_osc_freq_coarse))); onParam(81,*p(p_op3_osc_freq_coarse));
onParam(82,static_cast<uint8_t>(*p(p_op3_osc_freq_fine))); onParam(82,*p(p_op3_osc_freq_fine));
onParam(83,static_cast<uint8_t>(*p(p_op3_osc_detune)+7)); onParam(83,*p(p_op3_osc_detune)+7);
// OP2 // OP2
onParam(84,static_cast<uint8_t>(*p(p_op2_eg_rate_1))); onParam(84,*p(p_op2_eg_rate_1));
onParam(85,static_cast<uint8_t>(*p(p_op2_eg_rate_2))); onParam(85,*p(p_op2_eg_rate_2));
onParam(86,static_cast<uint8_t>(*p(p_op2_eg_rate_3))); onParam(86,*p(p_op2_eg_rate_3));
onParam(87,static_cast<uint8_t>(*p(p_op2_eg_rate_4))); onParam(87,*p(p_op2_eg_rate_4));
onParam(88,static_cast<uint8_t>(*p(p_op2_eg_level_1))); onParam(88,*p(p_op2_eg_level_1));
onParam(89,static_cast<uint8_t>(*p(p_op2_eg_level_2))); onParam(89,*p(p_op2_eg_level_2));
onParam(90,static_cast<uint8_t>(*p(p_op2_eg_level_3))); onParam(90,*p(p_op2_eg_level_3));
onParam(91,static_cast<uint8_t>(*p(p_op2_eg_level_4))); onParam(91,*p(p_op2_eg_level_4));
onParam(92,static_cast<uint8_t>(*p(p_op2_kbd_lev_scl_brk_pt))); onParam(92,*p(p_op2_kbd_lev_scl_brk_pt));
onParam(93,static_cast<uint8_t>(*p(p_op2_kbd_lev_scl_lft_depth))); onParam(93,*p(p_op2_kbd_lev_scl_lft_depth));
onParam(94,static_cast<uint8_t>(*p(p_op2_kbd_lev_scl_rht_depth))); onParam(94,*p(p_op2_kbd_lev_scl_rht_depth));
onParam(95,static_cast<uint8_t>(*p(p_op2_kbd_lev_scl_lft_curve))); onParam(95,*p(p_op2_kbd_lev_scl_lft_curve));
onParam(96,static_cast<uint8_t>(*p(p_op2_kbd_lev_scl_rht_curve))); onParam(96,*p(p_op2_kbd_lev_scl_rht_curve));
onParam(97,static_cast<uint8_t>(*p(p_op2_kbd_rate_scaling))); onParam(97,*p(p_op2_kbd_rate_scaling));
onParam(98,static_cast<uint8_t>(*p(p_op2_amp_mod_sensitivity))); onParam(98,*p(p_op2_amp_mod_sensitivity));
onParam(99,static_cast<uint8_t>(*p(p_op2_key_vel_sensitivity))); onParam(99,*p(p_op2_key_vel_sensitivity));
onParam(100,static_cast<uint8_t>(*p(p_op2_operator_output_level))); onParam(100,*p(p_op2_operator_output_level));
onParam(101,static_cast<uint8_t>(*p(p_op2_osc_mode))); onParam(101,*p(p_op2_osc_mode));
onParam(102,static_cast<uint8_t>(*p(p_op2_osc_freq_coarse))); onParam(102,*p(p_op2_osc_freq_coarse));
onParam(103,static_cast<uint8_t>(*p(p_op2_osc_freq_fine))); onParam(103,*p(p_op2_osc_freq_fine));
onParam(104,static_cast<uint8_t>(*p(p_op2_osc_detune)+7)); onParam(104,*p(p_op2_osc_detune)+7);
// OP1 // OP1
onParam(105,static_cast<uint8_t>(*p(p_op1_eg_rate_1))); onParam(105,*p(p_op1_eg_rate_1));
onParam(106,static_cast<uint8_t>(*p(p_op1_eg_rate_2))); onParam(106,*p(p_op1_eg_rate_2));
onParam(107,static_cast<uint8_t>(*p(p_op1_eg_rate_3))); onParam(107,*p(p_op1_eg_rate_3));
onParam(108,static_cast<uint8_t>(*p(p_op1_eg_rate_4))); onParam(108,*p(p_op1_eg_rate_4));
onParam(109,static_cast<uint8_t>(*p(p_op1_eg_level_1))); onParam(109,*p(p_op1_eg_level_1));
onParam(110,static_cast<uint8_t>(*p(p_op1_eg_level_2))); onParam(110,*p(p_op1_eg_level_2));
onParam(111,static_cast<uint8_t>(*p(p_op1_eg_level_3))); onParam(111,*p(p_op1_eg_level_3));
onParam(112,static_cast<uint8_t>(*p(p_op1_eg_level_4))); onParam(112,*p(p_op1_eg_level_4));
onParam(113,static_cast<uint8_t>(*p(p_op1_kbd_lev_scl_brk_pt))); onParam(113,*p(p_op1_kbd_lev_scl_brk_pt));
onParam(114,static_cast<uint8_t>(*p(p_op1_kbd_lev_scl_lft_depth))); onParam(114,*p(p_op1_kbd_lev_scl_lft_depth));
onParam(115,static_cast<uint8_t>(*p(p_op1_kbd_lev_scl_rht_depth))); onParam(115,*p(p_op1_kbd_lev_scl_rht_depth));
onParam(116,static_cast<uint8_t>(*p(p_op1_kbd_lev_scl_lft_curve))); onParam(116,*p(p_op1_kbd_lev_scl_lft_curve));
onParam(117,static_cast<uint8_t>(*p(p_op1_kbd_lev_scl_rht_curve))); onParam(117,*p(p_op1_kbd_lev_scl_rht_curve));
onParam(118,static_cast<uint8_t>(*p(p_op1_kbd_rate_scaling))); onParam(118,*p(p_op1_kbd_rate_scaling));
onParam(119,static_cast<uint8_t>(*p(p_op1_amp_mod_sensitivity))); onParam(119,*p(p_op1_amp_mod_sensitivity));
onParam(120,static_cast<uint8_t>(*p(p_op1_key_vel_sensitivity))); onParam(120,*p(p_op1_key_vel_sensitivity));
onParam(121,static_cast<uint8_t>(*p(p_op1_operator_output_level))); onParam(121,*p(p_op1_operator_output_level));
onParam(122,static_cast<uint8_t>(*p(p_op1_osc_mode))); onParam(122,*p(p_op1_osc_mode));
onParam(123,static_cast<uint8_t>(*p(p_op1_osc_freq_coarse))); onParam(123,*p(p_op1_osc_freq_coarse));
onParam(124,static_cast<uint8_t>(*p(p_op1_osc_freq_fine))); onParam(124,*p(p_op1_osc_freq_fine));
onParam(125,static_cast<uint8_t>(*p(p_op1_osc_detune)+7)); onParam(125,*p(p_op1_osc_detune)+7);
// Global for all OPs // Global for all OPs
onParam(126,static_cast<uint8_t>(*p(p_pitch_eg_rate_1))); onParam(126,*p(p_pitch_eg_rate_1));
onParam(127,static_cast<uint8_t>(*p(p_pitch_eg_rate_2))); onParam(127,*p(p_pitch_eg_rate_2));
onParam(128,static_cast<uint8_t>(*p(p_pitch_eg_rate_3))); onParam(128,*p(p_pitch_eg_rate_3));
onParam(129,static_cast<uint8_t>(*p(p_pitch_eg_rate_4))); onParam(129,*p(p_pitch_eg_rate_4));
onParam(130,static_cast<uint8_t>(*p(p_pitch_eg_level_1))); onParam(130,*p(p_pitch_eg_level_1));
onParam(131,static_cast<uint8_t>(*p(p_pitch_eg_level_2))); onParam(131,*p(p_pitch_eg_level_2));
onParam(132,static_cast<uint8_t>(*p(p_pitch_eg_level_3))); onParam(132,*p(p_pitch_eg_level_3));
onParam(133,static_cast<uint8_t>(*p(p_pitch_eg_level_4))); onParam(133,*p(p_pitch_eg_level_4));
onParam(134,static_cast<uint8_t>(*p(p_algorithm_num)-1)); onParam(134,*p(p_algorithm_num)-1);
onParam(135,static_cast<uint8_t>(*p(p_feedback))); onParam(135,*p(p_feedback));
onParam(136,static_cast<uint8_t>(*p(p_oscillator_sync))); onParam(136,*p(p_oscillator_sync));
onParam(137,static_cast<uint8_t>(*p(p_lfo_speed))); onParam(137,*p(p_lfo_speed));
onParam(138,static_cast<uint8_t>(*p(p_lfo_delay))); onParam(138,*p(p_lfo_delay));
onParam(139,static_cast<uint8_t>(*p(p_lfo_pitch_mod_depth))); onParam(139,*p(p_lfo_pitch_mod_depth));
onParam(140,static_cast<uint8_t>(*p(p_lfo_amp_mod_depth))); onParam(140,*p(p_lfo_amp_mod_depth));
onParam(141,static_cast<uint8_t>(*p(p_lfo_sync))); onParam(141,*p(p_lfo_sync));
onParam(142,static_cast<uint8_t>(*p(p_lfo_waveform))); onParam(142,*p(p_lfo_waveform));
onParam(143,static_cast<uint8_t>(*p(p_pitch_mod_sensitivity))); onParam(143,*p(p_pitch_mod_sensitivity));
onParam(144,static_cast<uint8_t>(*p(p_transpose))); onParam(144,*p(p_transpose));
// 10 bytes (145-154) are the name of the patch // 10 bytes (145-154) are the name of the patch
onParam(155,0x3f); // operator on/off => All OPs on onParam(155,0x3f); // operator on/off => All OPs on
@ -627,15 +627,23 @@ TRACE("pitch=%d\n",pitch);
TRACE("Bye"); TRACE("Bye");
} }
void Dexed::onParam(uint8_t param_num,uint8_t param_val) void Dexed::onParam(uint8_t param_num,float param_val)
{ {
if(param_val!=data[param_num]) if(param_val!=data_float[param_num])
{ {
if(param_num==144) #ifdef DEBUG
panic(); uint8_t tmp=data[param_num];
refreshVoice=true; #endif
data[param_num]=param_val;
} if(param_num==144)
panic();
refreshVoice=true;
data[param_num]=static_cast<uint8_t>(param_val);
data_float[param_num]=param_val;
TRACE("Parameter %d change from %d to %d",param_num, tmp, data[param_num]);
}
} }
uint8_t Dexed::getEngineType() { uint8_t Dexed::getEngineType() {

@ -90,7 +90,7 @@ class Dexed : public lvtk::Synth<DexedVoice, Dexed>
protected: protected:
void ProcessMidiMessage(const uint8_t *buf, uint32_t buf_size); void ProcessMidiMessage(const uint8_t *buf, uint32_t buf_size);
void onParam(uint8_t param_num,uint8_t param_val); void onParam(uint8_t param_num,float param_val);
void keyup(uint8_t pitch); void keyup(uint8_t pitch);
void keydown(uint8_t pitch, uint8_t velo); void keydown(uint8_t pitch, uint8_t velo);
void panic(void); void panic(void);
@ -116,6 +116,7 @@ class Dexed : public lvtk::Synth<DexedVoice, Dexed>
private: private:
uint8_t _param_counter; uint8_t _param_counter;
float data_float[156];
uint8_t data[156]; uint8_t data[156];
double _rate; double _rate;
/* uint8_t data[156]={ /* uint8_t data[156]={

Loading…
Cancel
Save