pull/4/head
Holger Wirtz 7 years ago
parent ab4a7de34d
commit 25862c59b1
  1. 19
      MicroDexed.ino
  2. 453
      dexed.cpp
  3. 19
      dexed.h

@ -79,8 +79,8 @@ void loop()
{
dexed->ProcessMidiMessage(MIDI.getType(), MIDI.getData1(), MIDI.getData2());
}
/* uint8_t i = 0;
Serial.println("Before:");
uint8_t i = 0;
/* Serial.println("Before:");
for (i = 0; i < 128; i++)
{
Serial.print(audio_buffer[i]);
@ -90,13 +90,22 @@ void loop()
dexed->GetSamples(RATE, audio_buffer);
/* Serial.println("After:");
for (i = 0; i < 128; i++)
{
if ((i % 16) == 0)
Serial.println();
if (i < 10)
Serial.print(" ");
if (i > 9 && i < 100)
Serial.print(" ");
Serial.print("[");
Serial.print(i, DEC);
Serial.print("]:");
Serial.print(audio_buffer[i]);
Serial.print(",");
Serial.print(" ");
}
Serial.println();*/
Serial.println();
#ifdef TEENSY
// play the current buffer

@ -117,226 +117,6 @@ void Dexed::deactivate(void)
; // Nothing to do - please reboot ;-)
}
/*
void Dexed::set_params(void)
{
_param_change_counter=0;
bool polymono=bool(*p(p_polymono));
uint8_t engine=uint8_t(*p(p_engine));
float f_gain=*p(p_output);
float f_cutoff=*p(p_cutoff);
float f_reso=*p(p_resonance);
// Dexed-Unisono
if(isMonoMode()!=polymono)
setMonoMode(polymono);
// Dexed-Engine
if(controllers.core==NULL || getEngineType()!=engine)
{
setEngineType(engine);
refreshVoice=true;
}
// Dexed-Filter
if(fx.uiCutoff!=f_cutoff)
{
fx.uiCutoff=f_cutoff;
refreshVoice=true;
}
if(fx.uiReso!=f_reso)
{
fx.uiReso=f_reso;
refreshVoice=true;
}
if(fx.uiGain!=f_gain)
{
fx.uiGain=f_gain;
refreshVoice=true;
}
// OP6
onParam(0,*p(p_op6_eg_rate_1));
onParam(1,*p(p_op6_eg_rate_2));
onParam(2,*p(p_op6_eg_rate_3));
onParam(3,*p(p_op6_eg_rate_4));
onParam(4,*p(p_op6_eg_level_1));
onParam(5,*p(p_op6_eg_level_2));
onParam(6,*p(p_op6_eg_level_3));
onParam(7,*p(p_op6_eg_level_4));
onParam(8,*p(p_op6_kbd_lev_scl_brk_pt));
onParam(9,*p(p_op6_kbd_lev_scl_lft_depth));
onParam(10,*p(p_op6_kbd_lev_scl_rht_depth));
onParam(11,*p(p_op6_kbd_lev_scl_lft_curve));
onParam(12,*p(p_op6_kbd_lev_scl_rht_curve));
onParam(13,*p(p_op6_kbd_rate_scaling));
onParam(14,*p(p_op6_amp_mod_sensitivity));
onParam(15,*p(p_op6_key_vel_sensitivity));
onParam(16,*p(p_op6_operator_output_level));
onParam(17,*p(p_op6_osc_mode));
onParam(18,*p(p_op6_osc_freq_coarse));
onParam(19,*p(p_op6_osc_freq_fine));
onParam(20,*p(p_op6_osc_detune)+7);
// OP5
onParam(21,*p(p_op5_eg_rate_1));
onParam(22,*p(p_op5_eg_rate_2));
onParam(23,*p(p_op5_eg_rate_3));
onParam(24,*p(p_op5_eg_rate_4));
onParam(25,*p(p_op5_eg_level_1));
onParam(26,*p(p_op5_eg_level_2));
onParam(27,*p(p_op5_eg_level_3));
onParam(28,*p(p_op5_eg_level_4));
onParam(29,*p(p_op5_kbd_lev_scl_brk_pt));
onParam(30,*p(p_op5_kbd_lev_scl_lft_depth));
onParam(31,*p(p_op5_kbd_lev_scl_rht_depth));
onParam(32,*p(p_op5_kbd_lev_scl_lft_curve));
onParam(33,*p(p_op5_kbd_lev_scl_rht_curve));
onParam(34,*p(p_op5_kbd_rate_scaling));
onParam(35,*p(p_op5_amp_mod_sensitivity));
onParam(36,*p(p_op5_key_vel_sensitivity));
onParam(37,*p(p_op5_operator_output_level));
onParam(38,*p(p_op5_osc_mode));
onParam(39,*p(p_op5_osc_freq_coarse));
onParam(40,*p(p_op5_osc_freq_fine));
onParam(41,*p(p_op5_osc_detune)+7);
// OP4
onParam(42,*p(p_op4_eg_rate_1));
onParam(43,*p(p_op4_eg_rate_2));
onParam(44,*p(p_op4_eg_rate_3));
onParam(45,*p(p_op4_eg_rate_4));
onParam(46,*p(p_op4_eg_level_1));
onParam(47,*p(p_op4_eg_level_2));
onParam(48,*p(p_op4_eg_level_3));
onParam(49,*p(p_op4_eg_level_4));
onParam(50,*p(p_op4_kbd_lev_scl_brk_pt));
onParam(51,*p(p_op4_kbd_lev_scl_lft_depth));
onParam(52,*p(p_op4_kbd_lev_scl_rht_depth));
onParam(53,*p(p_op4_kbd_lev_scl_lft_curve));
onParam(54,*p(p_op4_kbd_lev_scl_rht_curve));
onParam(55,*p(p_op4_kbd_rate_scaling));
onParam(56,*p(p_op4_amp_mod_sensitivity));
onParam(57,*p(p_op4_key_vel_sensitivity));
onParam(58,*p(p_op4_operator_output_level));
onParam(59,*p(p_op4_osc_mode));
onParam(60,*p(p_op4_osc_freq_coarse));
onParam(61,*p(p_op4_osc_freq_fine));
onParam(62,*p(p_op4_osc_detune)+7);
// OP3
onParam(63,*p(p_op3_eg_rate_1));
onParam(64,*p(p_op3_eg_rate_2));
onParam(65,*p(p_op3_eg_rate_3));
onParam(66,*p(p_op3_eg_rate_4));
onParam(67,*p(p_op3_eg_level_1));
onParam(68,*p(p_op3_eg_level_2));
onParam(69,*p(p_op3_eg_level_3));
onParam(70,*p(p_op3_eg_level_4));
onParam(71,*p(p_op3_kbd_lev_scl_brk_pt));
onParam(72,*p(p_op3_kbd_lev_scl_lft_depth));
onParam(73,*p(p_op3_kbd_lev_scl_rht_depth));
onParam(74,*p(p_op3_kbd_lev_scl_lft_curve));
onParam(75,*p(p_op3_kbd_lev_scl_rht_curve));
onParam(76,*p(p_op3_kbd_rate_scaling));
onParam(77,*p(p_op3_amp_mod_sensitivity));
onParam(78,*p(p_op3_key_vel_sensitivity));
onParam(79,*p(p_op3_operator_output_level));
onParam(80,*p(p_op3_osc_mode));
onParam(81,*p(p_op3_osc_freq_coarse));
onParam(82,*p(p_op3_osc_freq_fine));
onParam(83,*p(p_op3_osc_detune)+7);
// OP2
onParam(84,*p(p_op2_eg_rate_1));
onParam(85,*p(p_op2_eg_rate_2));
onParam(86,*p(p_op2_eg_rate_3));
onParam(87,*p(p_op2_eg_rate_4));
onParam(88,*p(p_op2_eg_level_1));
onParam(89,*p(p_op2_eg_level_2));
onParam(90,*p(p_op2_eg_level_3));
onParam(91,*p(p_op2_eg_level_4));
onParam(92,*p(p_op2_kbd_lev_scl_brk_pt));
onParam(93,*p(p_op2_kbd_lev_scl_lft_depth));
onParam(94,*p(p_op2_kbd_lev_scl_rht_depth));
onParam(95,*p(p_op2_kbd_lev_scl_lft_curve));
onParam(96,*p(p_op2_kbd_lev_scl_rht_curve));
onParam(97,*p(p_op2_kbd_rate_scaling));
onParam(98,*p(p_op2_amp_mod_sensitivity));
onParam(99,*p(p_op2_key_vel_sensitivity));
onParam(100,*p(p_op2_operator_output_level));
onParam(101,*p(p_op2_osc_mode));
onParam(102,*p(p_op2_osc_freq_coarse));
onParam(103,*p(p_op2_osc_freq_fine));
onParam(104,*p(p_op2_osc_detune)+7);
// OP1
onParam(105,*p(p_op1_eg_rate_1));
onParam(106,*p(p_op1_eg_rate_2));
onParam(107,*p(p_op1_eg_rate_3));
onParam(108,*p(p_op1_eg_rate_4));
onParam(109,*p(p_op1_eg_level_1));
onParam(110,*p(p_op1_eg_level_2));
onParam(111,*p(p_op1_eg_level_3));
onParam(112,*p(p_op1_eg_level_4));
onParam(113,*p(p_op1_kbd_lev_scl_brk_pt));
onParam(114,*p(p_op1_kbd_lev_scl_lft_depth));
onParam(115,*p(p_op1_kbd_lev_scl_rht_depth));
onParam(116,*p(p_op1_kbd_lev_scl_lft_curve));
onParam(117,*p(p_op1_kbd_lev_scl_rht_curve));
onParam(118,*p(p_op1_kbd_rate_scaling));
onParam(119,*p(p_op1_amp_mod_sensitivity));
onParam(120,*p(p_op1_key_vel_sensitivity));
onParam(121,*p(p_op1_operator_output_level));
onParam(122,*p(p_op1_osc_mode));
onParam(123,*p(p_op1_osc_freq_coarse));
onParam(124,*p(p_op1_osc_freq_fine));
onParam(125,*p(p_op1_osc_detune)+7);
// Global for all OPs
onParam(126,*p(p_pitch_eg_rate_1));
onParam(127,*p(p_pitch_eg_rate_2));
onParam(128,*p(p_pitch_eg_rate_3));
onParam(129,*p(p_pitch_eg_rate_4));
onParam(130,*p(p_pitch_eg_level_1));
onParam(131,*p(p_pitch_eg_level_2));
onParam(132,*p(p_pitch_eg_level_3));
onParam(133,*p(p_pitch_eg_level_4));
onParam(134,*p(p_algorithm_num)-1);
onParam(135,*p(p_feedback));
onParam(136,*p(p_oscillator_sync));
onParam(137,*p(p_lfo_speed));
onParam(138,*p(p_lfo_delay));
onParam(139,*p(p_lfo_pitch_mod_depth));
onParam(140,*p(p_lfo_amp_mod_depth));
onParam(141,*p(p_lfo_sync));
onParam(142,*p(p_lfo_waveform));
onParam(143,*p(p_pitch_mod_sensitivity));
onParam(144,*p(p_transpose));
// 10 bytes (145-154) are the name of the patch
// Controllers (added at the end of the data[])
onParam(155,*p(p_pitch_bend_range));
onParam(156,*p(p_pitch_bend_step));
onParam(157,*p(p_mod_wheel_range));
onParam(158,*p(p_mod_wheel_assign));
onParam(159,*p(p_foot_ctrl_range));
onParam(160,*p(p_foot_ctrl_assign));
onParam(161,*p(p_breath_ctrl_range));
onParam(162,*p(p_breath_ctrl_assign));
onParam(163,*p(p_aftertouch_range));
onParam(164,*p(p_aftertouch_assign));
onParam(165,*p(p_master_tune));
onParam(166,*p(p_op1_enable));
onParam(167,*p(p_op2_enable));
onParam(168,*p(p_op3_enable));
onParam(169,*p(p_op4_enable));
onParam(170,*p(p_op5_enable));
onParam(171,*p(p_op6_enable));
onParam(172,*p(p_number_of_voices));
if(_param_change_counter>PARAM_CHANGE_LEVEL)
{
panic();
controllers.refresh();
}
}
*/
void Dexed::GetSamples(uint32_t n_samples, int16_t* buffer)
{
uint32_t i;
@ -719,24 +499,223 @@ void Dexed::notes_off(void) {
}
}
//==============================================================================
/*
void Dexed::set_params(void)
{
_param_change_counter=0;
bool polymono=bool(*p(p_polymono));
uint8_t engine=uint8_t(*p(p_engine));
float f_gain=*p(p_output);
float f_cutoff=*p(p_cutoff);
float f_reso=*p(p_resonance);
DexedVoice::~DexedVoice()
{
;
}
// Dexed-Unisono
if(isMonoMode()!=polymono)
setMonoMode(polymono);
void DexedVoice::on(unsigned char key, unsigned char velocity)
{
m_key = key;
}
// Dexed-Engine
if(controllers.core==NULL || getEngineType()!=engine)
{
setEngineType(engine);
refreshVoice=true;
}
void DexedVoice::off(unsigned char velocity)
{
m_key = -1;
}
// Dexed-Filter
if(fx.uiCutoff!=f_cutoff)
{
fx.uiCutoff=f_cutoff;
refreshVoice=true;
}
if(fx.uiReso!=f_reso)
{
fx.uiReso=f_reso;
refreshVoice=true;
}
if(fx.uiGain!=f_gain)
{
fx.uiGain=f_gain;
refreshVoice=true;
}
// OP6
onParam(0,*p(p_op6_eg_rate_1));
onParam(1,*p(p_op6_eg_rate_2));
onParam(2,*p(p_op6_eg_rate_3));
onParam(3,*p(p_op6_eg_rate_4));
onParam(4,*p(p_op6_eg_level_1));
onParam(5,*p(p_op6_eg_level_2));
onParam(6,*p(p_op6_eg_level_3));
onParam(7,*p(p_op6_eg_level_4));
onParam(8,*p(p_op6_kbd_lev_scl_brk_pt));
onParam(9,*p(p_op6_kbd_lev_scl_lft_depth));
onParam(10,*p(p_op6_kbd_lev_scl_rht_depth));
onParam(11,*p(p_op6_kbd_lev_scl_lft_curve));
onParam(12,*p(p_op6_kbd_lev_scl_rht_curve));
onParam(13,*p(p_op6_kbd_rate_scaling));
onParam(14,*p(p_op6_amp_mod_sensitivity));
onParam(15,*p(p_op6_key_vel_sensitivity));
onParam(16,*p(p_op6_operator_output_level));
onParam(17,*p(p_op6_osc_mode));
onParam(18,*p(p_op6_osc_freq_coarse));
onParam(19,*p(p_op6_osc_freq_fine));
onParam(20,*p(p_op6_osc_detune)+7);
// OP5
onParam(21,*p(p_op5_eg_rate_1));
onParam(22,*p(p_op5_eg_rate_2));
onParam(23,*p(p_op5_eg_rate_3));
onParam(24,*p(p_op5_eg_rate_4));
onParam(25,*p(p_op5_eg_level_1));
onParam(26,*p(p_op5_eg_level_2));
onParam(27,*p(p_op5_eg_level_3));
onParam(28,*p(p_op5_eg_level_4));
onParam(29,*p(p_op5_kbd_lev_scl_brk_pt));
onParam(30,*p(p_op5_kbd_lev_scl_lft_depth));
onParam(31,*p(p_op5_kbd_lev_scl_rht_depth));
onParam(32,*p(p_op5_kbd_lev_scl_lft_curve));
onParam(33,*p(p_op5_kbd_lev_scl_rht_curve));
onParam(34,*p(p_op5_kbd_rate_scaling));
onParam(35,*p(p_op5_amp_mod_sensitivity));
onParam(36,*p(p_op5_key_vel_sensitivity));
onParam(37,*p(p_op5_operator_output_level));
onParam(38,*p(p_op5_osc_mode));
onParam(39,*p(p_op5_osc_freq_coarse));
onParam(40,*p(p_op5_osc_freq_fine));
onParam(41,*p(p_op5_osc_detune)+7);
// OP4
onParam(42,*p(p_op4_eg_rate_1));
onParam(43,*p(p_op4_eg_rate_2));
onParam(44,*p(p_op4_eg_rate_3));
onParam(45,*p(p_op4_eg_rate_4));
onParam(46,*p(p_op4_eg_level_1));
onParam(47,*p(p_op4_eg_level_2));
onParam(48,*p(p_op4_eg_level_3));
onParam(49,*p(p_op4_eg_level_4));
onParam(50,*p(p_op4_kbd_lev_scl_brk_pt));
onParam(51,*p(p_op4_kbd_lev_scl_lft_depth));
onParam(52,*p(p_op4_kbd_lev_scl_rht_depth));
onParam(53,*p(p_op4_kbd_lev_scl_lft_curve));
onParam(54,*p(p_op4_kbd_lev_scl_rht_curve));
onParam(55,*p(p_op4_kbd_rate_scaling));
onParam(56,*p(p_op4_amp_mod_sensitivity));
onParam(57,*p(p_op4_key_vel_sensitivity));
onParam(58,*p(p_op4_operator_output_level));
onParam(59,*p(p_op4_osc_mode));
onParam(60,*p(p_op4_osc_freq_coarse));
onParam(61,*p(p_op4_osc_freq_fine));
onParam(62,*p(p_op4_osc_detune)+7);
// OP3
onParam(63,*p(p_op3_eg_rate_1));
onParam(64,*p(p_op3_eg_rate_2));
onParam(65,*p(p_op3_eg_rate_3));
onParam(66,*p(p_op3_eg_rate_4));
onParam(67,*p(p_op3_eg_level_1));
onParam(68,*p(p_op3_eg_level_2));
onParam(69,*p(p_op3_eg_level_3));
onParam(70,*p(p_op3_eg_level_4));
onParam(71,*p(p_op3_kbd_lev_scl_brk_pt));
onParam(72,*p(p_op3_kbd_lev_scl_lft_depth));
onParam(73,*p(p_op3_kbd_lev_scl_rht_depth));
onParam(74,*p(p_op3_kbd_lev_scl_lft_curve));
onParam(75,*p(p_op3_kbd_lev_scl_rht_curve));
onParam(76,*p(p_op3_kbd_rate_scaling));
onParam(77,*p(p_op3_amp_mod_sensitivity));
onParam(78,*p(p_op3_key_vel_sensitivity));
onParam(79,*p(p_op3_operator_output_level));
onParam(80,*p(p_op3_osc_mode));
onParam(81,*p(p_op3_osc_freq_coarse));
onParam(82,*p(p_op3_osc_freq_fine));
onParam(83,*p(p_op3_osc_detune)+7);
// OP2
onParam(84,*p(p_op2_eg_rate_1));
onParam(85,*p(p_op2_eg_rate_2));
onParam(86,*p(p_op2_eg_rate_3));
onParam(87,*p(p_op2_eg_rate_4));
onParam(88,*p(p_op2_eg_level_1));
onParam(89,*p(p_op2_eg_level_2));
onParam(90,*p(p_op2_eg_level_3));
onParam(91,*p(p_op2_eg_level_4));
onParam(92,*p(p_op2_kbd_lev_scl_brk_pt));
onParam(93,*p(p_op2_kbd_lev_scl_lft_depth));
onParam(94,*p(p_op2_kbd_lev_scl_rht_depth));
onParam(95,*p(p_op2_kbd_lev_scl_lft_curve));
onParam(96,*p(p_op2_kbd_lev_scl_rht_curve));
onParam(97,*p(p_op2_kbd_rate_scaling));
onParam(98,*p(p_op2_amp_mod_sensitivity));
onParam(99,*p(p_op2_key_vel_sensitivity));
onParam(100,*p(p_op2_operator_output_level));
onParam(101,*p(p_op2_osc_mode));
onParam(102,*p(p_op2_osc_freq_coarse));
onParam(103,*p(p_op2_osc_freq_fine));
onParam(104,*p(p_op2_osc_detune)+7);
// OP1
onParam(105,*p(p_op1_eg_rate_1));
onParam(106,*p(p_op1_eg_rate_2));
onParam(107,*p(p_op1_eg_rate_3));
onParam(108,*p(p_op1_eg_rate_4));
onParam(109,*p(p_op1_eg_level_1));
onParam(110,*p(p_op1_eg_level_2));
onParam(111,*p(p_op1_eg_level_3));
onParam(112,*p(p_op1_eg_level_4));
onParam(113,*p(p_op1_kbd_lev_scl_brk_pt));
onParam(114,*p(p_op1_kbd_lev_scl_lft_depth));
onParam(115,*p(p_op1_kbd_lev_scl_rht_depth));
onParam(116,*p(p_op1_kbd_lev_scl_lft_curve));
onParam(117,*p(p_op1_kbd_lev_scl_rht_curve));
onParam(118,*p(p_op1_kbd_rate_scaling));
onParam(119,*p(p_op1_amp_mod_sensitivity));
onParam(120,*p(p_op1_key_vel_sensitivity));
onParam(121,*p(p_op1_operator_output_level));
onParam(122,*p(p_op1_osc_mode));
onParam(123,*p(p_op1_osc_freq_coarse));
onParam(124,*p(p_op1_osc_freq_fine));
onParam(125,*p(p_op1_osc_detune)+7);
// Global for all OPs
onParam(126,*p(p_pitch_eg_rate_1));
onParam(127,*p(p_pitch_eg_rate_2));
onParam(128,*p(p_pitch_eg_rate_3));
onParam(129,*p(p_pitch_eg_rate_4));
onParam(130,*p(p_pitch_eg_level_1));
onParam(131,*p(p_pitch_eg_level_2));
onParam(132,*p(p_pitch_eg_level_3));
onParam(133,*p(p_pitch_eg_level_4));
onParam(134,*p(p_algorithm_num)-1);
onParam(135,*p(p_feedback));
onParam(136,*p(p_oscillator_sync));
onParam(137,*p(p_lfo_speed));
onParam(138,*p(p_lfo_delay));
onParam(139,*p(p_lfo_pitch_mod_depth));
onParam(140,*p(p_lfo_amp_mod_depth));
onParam(141,*p(p_lfo_sync));
onParam(142,*p(p_lfo_waveform));
onParam(143,*p(p_pitch_mod_sensitivity));
onParam(144,*p(p_transpose));
// 10 bytes (145-154) are the name of the patch
// Controllers (added at the end of the data[])
onParam(155,*p(p_pitch_bend_range));
onParam(156,*p(p_pitch_bend_step));
onParam(157,*p(p_mod_wheel_range));
onParam(158,*p(p_mod_wheel_assign));
onParam(159,*p(p_foot_ctrl_range));
onParam(160,*p(p_foot_ctrl_assign));
onParam(161,*p(p_breath_ctrl_range));
onParam(162,*p(p_breath_ctrl_assign));
onParam(163,*p(p_aftertouch_range));
onParam(164,*p(p_aftertouch_assign));
onParam(165,*p(p_master_tune));
onParam(166,*p(p_op1_enable));
onParam(167,*p(p_op2_enable));
onParam(168,*p(p_op3_enable));
onParam(169,*p(p_op4_enable));
onParam(170,*p(p_op5_enable));
onParam(171,*p(p_op6_enable));
onParam(172,*p(p_number_of_voices));
if(_param_change_counter>PARAM_CHANGE_LEVEL)
{
panic();
controllers.refresh();
}
}
*/
unsigned char DexedVoice::get_key(void) const
{
return m_key;
}

@ -51,30 +51,11 @@ enum DexedEngineResolution {
//==============================================================================
class DexedVoice
{
public:
explicit DexedVoice(double rate);
~DexedVoice();
void on(unsigned char key, unsigned char velocity);
void off(unsigned char velocity);
unsigned char get_key(void) const;
protected:
unsigned char m_key;
double m_rate;
private:
};
//==============================================================================
class Dexed
{
public:
Dexed(uint16_t rate);
~Dexed();
void run(uint8_t* midi_data);
void activate(void);
void deactivate(void);
uint8_t getEngineType();

Loading…
Cancel
Save