|
|
@ -425,7 +425,7 @@ uint8_t Dexed::getNumNotesPlaying(void) |
|
|
|
return (count_playing_voices); |
|
|
|
return (count_playing_voices); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool Dexed::loadSysexVoice(uint8_t* new_data) |
|
|
|
bool Dexed::loadVoiceParameters(uint8_t* data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint8_t* p_data = data; |
|
|
|
uint8_t* p_data = data; |
|
|
|
uint8_t op; |
|
|
|
uint8_t op; |
|
|
@ -446,21 +446,21 @@ bool Dexed::loadSysexVoice(uint8_t* new_data) |
|
|
|
// DEXED_OP_LEV_SCL_BRK_PT, // 8
|
|
|
|
// DEXED_OP_LEV_SCL_BRK_PT, // 8
|
|
|
|
// DEXED_OP_SCL_LEFT_DEPTH, // 9
|
|
|
|
// DEXED_OP_SCL_LEFT_DEPTH, // 9
|
|
|
|
// DEXED_OP_SCL_RGHT_DEPTH, // 10
|
|
|
|
// DEXED_OP_SCL_RGHT_DEPTH, // 10
|
|
|
|
memcpy(&data[op * 21], &new_data[op * 17], 11); |
|
|
|
memcpy(&data[op * 21], &data[op * 17], 11); |
|
|
|
tmp = new_data[(op * 17) + 11]; |
|
|
|
tmp = data[(op * 17) + 11]; |
|
|
|
*(p_data + DEXED_OP_SCL_LEFT_CURVE + (op * 21)) = (tmp & 0x3); |
|
|
|
*(p_data + DEXED_OP_SCL_LEFT_CURVE + (op * 21)) = (tmp & 0x3); |
|
|
|
*(p_data + DEXED_OP_SCL_RGHT_CURVE + (op * 21)) = (tmp & 0x0c) >> 2; |
|
|
|
*(p_data + DEXED_OP_SCL_RGHT_CURVE + (op * 21)) = (tmp & 0x0c) >> 2; |
|
|
|
tmp = new_data[(op * 17) + 12]; |
|
|
|
tmp = data[(op * 17) + 12]; |
|
|
|
*(p_data + DEXED_OP_OSC_DETUNE + (op * 21)) = (tmp & 0x78) >> 3; |
|
|
|
*(p_data + DEXED_OP_OSC_DETUNE + (op * 21)) = (tmp & 0x78) >> 3; |
|
|
|
*(p_data + DEXED_OP_OSC_RATE_SCALE + (op * 21)) = (tmp & 0x07); |
|
|
|
*(p_data + DEXED_OP_OSC_RATE_SCALE + (op * 21)) = (tmp & 0x07); |
|
|
|
tmp = new_data[(op * 17) + 13]; |
|
|
|
tmp = data[(op * 17) + 13]; |
|
|
|
*(p_data + DEXED_OP_KEY_VEL_SENS + (op * 21)) = (tmp & 0x1c) >> 2; |
|
|
|
*(p_data + DEXED_OP_KEY_VEL_SENS + (op * 21)) = (tmp & 0x1c) >> 2; |
|
|
|
*(p_data + DEXED_OP_AMP_MOD_SENS + (op * 21)) = (tmp & 0x03); |
|
|
|
*(p_data + DEXED_OP_AMP_MOD_SENS + (op * 21)) = (tmp & 0x03); |
|
|
|
*(p_data + DEXED_OP_OUTPUT_LEV + (op * 21)) = new_data[(op * 17) + 14]; |
|
|
|
*(p_data + DEXED_OP_OUTPUT_LEV + (op * 21)) = data[(op * 17) + 14]; |
|
|
|
tmp = new_data[(op * 17) + 15]; |
|
|
|
tmp = data[(op * 17) + 15]; |
|
|
|
*(p_data + DEXED_OP_FREQ_COARSE + (op * 21)) = (tmp & 0x3e) >> 1; |
|
|
|
*(p_data + DEXED_OP_FREQ_COARSE + (op * 21)) = (tmp & 0x3e) >> 1; |
|
|
|
*(p_data + DEXED_OP_OSC_MODE + (op * 21)) = (tmp & 0x01); |
|
|
|
*(p_data + DEXED_OP_OSC_MODE + (op * 21)) = (tmp & 0x01); |
|
|
|
*(p_data + DEXED_OP_FREQ_FINE + (op * 21)) = new_data[(op * 17) + 16]; |
|
|
|
*(p_data + DEXED_OP_FREQ_FINE + (op * 21)) = data[(op * 17) + 16]; |
|
|
|
} |
|
|
|
} |
|
|
|
// DEXED_PITCH_EG_R1, // 0
|
|
|
|
// DEXED_PITCH_EG_R1, // 0
|
|
|
|
// DEXED_PITCH_EG_R2, // 1
|
|
|
|
// DEXED_PITCH_EG_R2, // 1
|
|
|
@ -470,41 +470,42 @@ bool Dexed::loadSysexVoice(uint8_t* new_data) |
|
|
|
// DEXED_PITCH_EG_L2, // 5
|
|
|
|
// DEXED_PITCH_EG_L2, // 5
|
|
|
|
// DEXED_PITCH_EG_L3, // 6
|
|
|
|
// DEXED_PITCH_EG_L3, // 6
|
|
|
|
// DEXED_PITCH_EG_L4, // 7
|
|
|
|
// DEXED_PITCH_EG_L4, // 7
|
|
|
|
memcpy(&data[DEXED_VOICE_OFFSET], &new_data[102], 8); |
|
|
|
memcpy(&data[DEXED_VOICE_OFFSET], &data[102], 8); |
|
|
|
tmp = new_data[110]; |
|
|
|
tmp = data[110]; |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_ALGORITHM) = (tmp & 0x1f); |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_ALGORITHM) = (tmp & 0x1f); |
|
|
|
tmp = new_data[111]; |
|
|
|
tmp = data[111]; |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC) = (tmp & 0x08) >> 3; |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC) = (tmp & 0x08) >> 3; |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_FEEDBACK) = (tmp & 0x07); |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_FEEDBACK) = (tmp & 0x07); |
|
|
|
// DEXED_LFO_SPEED, // 11
|
|
|
|
// DEXED_LFO_SPEED, // 11
|
|
|
|
// DEXED_LFO_DELAY, // 12
|
|
|
|
// DEXED_LFO_DELAY, // 12
|
|
|
|
// DEXED_LFO_PITCH_MOD_DEP, // 13
|
|
|
|
// DEXED_LFO_PITCH_MOD_DEP, // 13
|
|
|
|
// DEXED_LFO_AMP_MOD_DEP, // 14
|
|
|
|
// DEXED_LFO_AMP_MOD_DEP, // 14
|
|
|
|
memcpy(&data[DEXED_VOICE_OFFSET + DEXED_LFO_SPEED], &new_data[112], 4); |
|
|
|
memcpy(&data[DEXED_VOICE_OFFSET + DEXED_LFO_SPEED], &data[112], 4); |
|
|
|
tmp = new_data[116]; |
|
|
|
tmp = data[116]; |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS) = (tmp & 0x30) >> 4; |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS) = (tmp & 0x30) >> 4; |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_LFO_WAVE) = (tmp & 0x0e) >> 1; |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_LFO_WAVE) = (tmp & 0x0e) >> 1; |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_LFO_SYNC) = (tmp & 0x01); |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_LFO_SYNC) = (tmp & 0x01); |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_TRANSPOSE) = new_data[117]; |
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_TRANSPOSE) = data[117]; |
|
|
|
memcpy(&data[DEXED_VOICE_OFFSET + DEXED_NAME], &new_data[118], 10); |
|
|
|
memcpy(&data[DEXED_VOICE_OFFSET + DEXED_NAME], &data[118], 10); |
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE) = 1; |
|
|
|
|
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP) = 1; |
|
|
|
//panic();
|
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_RANGE) = 99; |
|
|
|
doRefreshVoice(); |
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_ASSIGN) = 7; |
|
|
|
//activate();
|
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_RANGE) = 99; |
|
|
|
|
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_ASSIGN) = 7; |
|
|
|
strncpy(voice_name, (char *)&data[145], sizeof(voice_name) - 1); |
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_RANGE) = 99; |
|
|
|
|
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN) = 7; |
|
|
|
#ifdef DEBUG |
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE) = 99; |
|
|
|
Serial.print(F("Voice [")); |
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN) = 7; |
|
|
|
Serial.print(voice_name); |
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE) = 0; |
|
|
|
Serial.println(F("] loaded.")); |
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP1_ENABLE) = 1; |
|
|
|
#endif |
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP2_ENABLE) = 1; |
|
|
|
|
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP3_ENABLE) = 1; |
|
|
|
return (true); |
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP4_ENABLE) = 1; |
|
|
|
} |
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP5_ENABLE) = 1; |
|
|
|
|
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP6_ENABLE) = 1; |
|
|
|
bool Dexed::loadGlobalParameters(uint8_t* data) |
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MAX_NOTES) = MAX_NOTES; |
|
|
|
{ |
|
|
|
|
|
|
|
uint8_t* p_data = data; |
|
|
|
|
|
|
|
|
|
|
|
controllers.values_[kControllerPitchRange] = data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE]; |
|
|
|
controllers.values_[kControllerPitchRange] = data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE]; |
|
|
|
controllers.values_[kControllerPitchStep] = data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP]; |
|
|
|
controllers.values_[kControllerPitchStep] = data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP]; |
|
|
@ -526,22 +527,46 @@ bool Dexed::loadSysexVoice(uint8_t* new_data) |
|
|
|
(*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP5_ENABLE) << 1) | |
|
|
|
(*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP5_ENABLE) << 1) | |
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP6_ENABLE )); |
|
|
|
*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP6_ENABLE )); |
|
|
|
setMaxNotes(*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MAX_NOTES)); |
|
|
|
setMaxNotes(*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MAX_NOTES)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setMaxNotes(*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MAX_NOTES)); |
|
|
|
//panic();
|
|
|
|
//panic();
|
|
|
|
doRefreshVoice(); |
|
|
|
doRefreshVoice(); |
|
|
|
//activate();
|
|
|
|
//activate();
|
|
|
|
|
|
|
|
|
|
|
|
strncpy(voice_name, (char *)&data[145], sizeof(voice_name) - 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
//char voicename[11];
|
|
|
|
Serial.println(F("Global parameters loaded.")); |
|
|
|
//memset(voicename, 0, sizeof(voicename));
|
|
|
|
#endif |
|
|
|
//strncpy(voicename, (char *)&data[145], sizeof(voicename) - 1);
|
|
|
|
return (true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Serial.print(F("Voice [")); |
|
|
|
bool Dexed::initGlobalParameters(void) |
|
|
|
//Serial.print(voicename);
|
|
|
|
{ |
|
|
|
Serial.print(voice_name); |
|
|
|
uint8_t init_data[18]; |
|
|
|
Serial.println(F("] loaded.")); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.println(F("Initializing global parameters")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
init_data[DEXED_PITCHBEND_RANGE] = 1; |
|
|
|
|
|
|
|
init_data[DEXED_PITCHBEND_STEP] = 1; |
|
|
|
|
|
|
|
init_data[DEXED_MODWHEEL_RANGE] = 99; |
|
|
|
|
|
|
|
init_data[DEXED_MODWHEEL_ASSIGN] = 7; |
|
|
|
|
|
|
|
init_data[DEXED_FOOTCTRL_RANGE] = 99; |
|
|
|
|
|
|
|
init_data[DEXED_FOOTCTRL_ASSIGN] = 7; |
|
|
|
|
|
|
|
init_data[DEXED_BREATHCTRL_RANGE] = 99; |
|
|
|
|
|
|
|
init_data[DEXED_BREATHCTRL_ASSIGN] = 7; |
|
|
|
|
|
|
|
init_data[DEXED_AT_RANGE] = 99; |
|
|
|
|
|
|
|
init_data[DEXED_AT_ASSIGN] = 7; |
|
|
|
|
|
|
|
init_data[DEXED_MASTER_TUNE] = 0; |
|
|
|
|
|
|
|
init_data[DEXED_OP1_ENABLE] = 1; |
|
|
|
|
|
|
|
init_data[DEXED_OP2_ENABLE] = 1; |
|
|
|
|
|
|
|
init_data[DEXED_OP3_ENABLE] = 1; |
|
|
|
|
|
|
|
init_data[DEXED_OP4_ENABLE] = 1; |
|
|
|
|
|
|
|
init_data[DEXED_OP5_ENABLE] = 1; |
|
|
|
|
|
|
|
init_data[DEXED_OP6_ENABLE] = 1; |
|
|
|
|
|
|
|
init_data[DEXED_MAX_NOTES] = MAX_NOTES; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loadGlobalParameters(init_data); |
|
|
|
|
|
|
|
|
|
|
|
return (true); |
|
|
|
return (true); |
|
|
|
} |
|
|
|
} |
|
|
|