Small fixes.

pull/4/head
Holger Wirtz 6 years ago
parent ffe25453d5
commit 823df46819
  1. 39
      MicroDexed.ino
  2. 225
      dexed.cpp
  3. 1
      dexed.h

@ -19,25 +19,20 @@
//#define DEBUG 1
#define SERIAL_SPEED 38400
#define VOLUME 0.5
#define VOLUME 0.2
#define SAMPLE_RATE 44100
#define DEXED_ENGINE DEXED_ENGINE_MODERN
//#define INIT_AUDIO_QUEUE 1
//#define SHOW_DEXED_TIMING 1
#define SHOW_XRUN 1
#define SHOW_CPU_LOAD_MSEC 5000
#define MAX_NOTES 10
//#define ADD_EFFECT_CHORUS 1
#ifdef ADD_EFFECT_CHORUS
#define AUDIO_MEM 6
#else
#define AUDIO_MEM 2
#endif
// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14
// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
@ -46,15 +41,8 @@
// GUItool: begin automatically generated code
AudioPlayQueue queue1; //xy=84,294
AudioOutputI2S i2s1; //xy=961,276
#ifdef ADD_EFFECT_CHORUS
AudioEffectChorus chorus1; //xy=328,295
AudioConnection patchCord1(queue1, chorus1);
AudioConnection patchCord2(chorus1, 0, i2s1, 0);
AudioConnection patchCord3(chorus1, 0, i2s1, 1);
#else
AudioConnection patchCord2(queue1, 0, i2s1, 0);
AudioConnection patchCord3(queue1, 0, i2s1, 1);
#endif
AudioControlSGTL5000 sgtl5000_1; //xy=507,403
// GUItool: end automatically generated code
@ -63,13 +51,6 @@ Dexed* dexed = new Dexed(SAMPLE_RATE);
IntervalTimer sched;
bool sd_card_available = false;
#ifdef ADD_EFFECT_CHORUS
// Number of samples in each delay line
#define CHORUS_DELAY_LENGTH (16*AUDIO_BLOCK_SAMPLES)
// Allocate the delay lines for left and right channels
short delayline[CHORUS_DELAY_LENGTH];
#endif
void setup()
{
//while (!Serial) ; // wait for Arduino Serial Monitor
@ -124,10 +105,7 @@ void setup()
#endif
dexed->activate();
dexed->setMaxNotes(MAX_NOTES);
#ifdef ADD_EFFECT_CHORUS
chorus1.begin(delayline, CHORUS_DELAY_LENGTH, 8);
#endif
dexed->setEngineType(DEXED_ENGINE);
#ifdef SHOW_CPU_LOAD_MSEC
sched.begin(cpu_and_mem_usage, SHOW_CPU_LOAD_MSEC * 1000);
@ -137,11 +115,6 @@ void setup()
Serial.println(F("setup end"));
cpu_and_mem_usage();
//dexed->setEngineType(DEXED_ENGINE_MODERN);
//dexed->setEngineType(DEXED_ENGINE_MARKI);
//dexed->setEngineType(DEXED_ENGINE_OPL);
#ifdef TEST_MIDI
delay(200);
randomSeed(analogRead(A0));
@ -163,7 +136,6 @@ void setup()
queue_midi_event(0x90, TEST_NOTE + 60, random(TEST_VEL_MIN, TEST_VEL_MAX)); // 16
delay(200);
#endif
}
void loop()
@ -412,10 +384,11 @@ bool load_sysex_voice(File sysex, uint8_t voice_number)
*(p_data + 171) = 1;
*(p_data + 172) = MAX_NOTES;
dexed->setOPs((*(p_data + 166) << 5) | (*(p_data + 167) << 4) | (*(p_data + 168) << 3) | (*(p_data + 166) << 2) | (*(p_data + 170) << 1) | *(p_data + 171));
dexed->setMaxNotes(dexed->data[172]);
dexed->panic();
dexed->setOPs((*(p_data + 166) << 5) | (*(p_data + 167) << 4) | (*(p_data + 168) << 3) | (*(p_data + 166) << 2) | (*(p_data + 170) << 1) | *(p_data + 171));
dexed->setMaxNotes(*(p_data + 172));
dexed->doRefreshVoice();
dexed->activate();
char voicename[11];
memset(voicename, 0, sizeof(voicename));

@ -522,228 +522,3 @@ void Dexed::setMaxNotes(uint8_t n) {
controllers.refresh();
}
}
void Dexed::set_params(void)
{
/* //TRACE("Hi");
_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();
}
//TRACE("Bye");
*/
;
}

@ -61,7 +61,6 @@ class Dexed
void setEngineType(uint8_t tp);
bool isMonoMode(void);
void setMonoMode(bool mode);
void set_params(void);
void GetSamples(uint16_t n_samples, int16_t* buffer);
bool ProcessMidiMessage(uint8_t type, uint8_t data1, uint8_t data2);
void panic(void);

Loading…
Cancel
Save