|
|
|
@ -425,13 +425,13 @@ uint8_t Dexed::getNumNotesPlaying(void) |
|
|
|
|
return (count_playing_voices); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool Dexed::loadVoiceParameters(uint8_t* data) |
|
|
|
|
bool Dexed::loadPackedVoiceParameters(uint8_t* new_data) |
|
|
|
|
{ |
|
|
|
|
uint8_t* p_data = data; |
|
|
|
|
uint8_t op; |
|
|
|
|
uint8_t tmp; |
|
|
|
|
|
|
|
|
|
//notesOff();
|
|
|
|
|
notesOff(); |
|
|
|
|
|
|
|
|
|
for (op = 0; op < 6; op++) |
|
|
|
|
{ |
|
|
|
@ -446,21 +446,21 @@ bool Dexed::loadVoiceParameters(uint8_t* data) |
|
|
|
|
// DEXED_OP_LEV_SCL_BRK_PT, // 8
|
|
|
|
|
// DEXED_OP_SCL_LEFT_DEPTH, // 9
|
|
|
|
|
// DEXED_OP_SCL_RGHT_DEPTH, // 10
|
|
|
|
|
memcpy(&data[op * 21], &data[op * 17], 11); |
|
|
|
|
tmp = data[(op * 17) + 11]; |
|
|
|
|
memcpy(&data[op * 21], &new_data[op * 17], 11); |
|
|
|
|
tmp = new_data[(op * 17) + 11]; |
|
|
|
|
*(p_data + DEXED_OP_SCL_LEFT_CURVE + (op * 21)) = (tmp & 0x3); |
|
|
|
|
*(p_data + DEXED_OP_SCL_RGHT_CURVE + (op * 21)) = (tmp & 0x0c) >> 2; |
|
|
|
|
tmp = data[(op * 17) + 12]; |
|
|
|
|
tmp = new_data[(op * 17) + 12]; |
|
|
|
|
*(p_data + DEXED_OP_OSC_DETUNE + (op * 21)) = (tmp & 0x78) >> 3; |
|
|
|
|
*(p_data + DEXED_OP_OSC_RATE_SCALE + (op * 21)) = (tmp & 0x07); |
|
|
|
|
tmp = data[(op * 17) + 13]; |
|
|
|
|
tmp = new_data[(op * 17) + 13]; |
|
|
|
|
*(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_OUTPUT_LEV + (op * 21)) = data[(op * 17) + 14]; |
|
|
|
|
tmp = data[(op * 17) + 15]; |
|
|
|
|
*(p_data + DEXED_OP_OUTPUT_LEV + (op * 21)) = new_data[(op * 17) + 14]; |
|
|
|
|
tmp = new_data[(op * 17) + 15]; |
|
|
|
|
*(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_FREQ_FINE + (op * 21)) = data[(op * 17) + 16]; |
|
|
|
|
*(p_data + DEXED_OP_FREQ_FINE + (op * 21)) = new_data[(op * 17) + 16]; |
|
|
|
|
} |
|
|
|
|
// DEXED_PITCH_EG_R1, // 0
|
|
|
|
|
// DEXED_PITCH_EG_R2, // 1
|
|
|
|
@ -470,30 +470,51 @@ bool Dexed::loadVoiceParameters(uint8_t* data) |
|
|
|
|
// DEXED_PITCH_EG_L2, // 5
|
|
|
|
|
// DEXED_PITCH_EG_L3, // 6
|
|
|
|
|
// DEXED_PITCH_EG_L4, // 7
|
|
|
|
|
memcpy(&data[DEXED_VOICE_OFFSET], &data[102], 8); |
|
|
|
|
tmp = data[110]; |
|
|
|
|
memcpy(&data[DEXED_VOICE_OFFSET], &new_data[102], 8); |
|
|
|
|
tmp = new_data[110]; |
|
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_ALGORITHM) = (tmp & 0x1f); |
|
|
|
|
tmp = data[111]; |
|
|
|
|
tmp = new_data[111]; |
|
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC) = (tmp & 0x08) >> 3; |
|
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_FEEDBACK) = (tmp & 0x07); |
|
|
|
|
// DEXED_LFO_SPEED, // 11
|
|
|
|
|
// DEXED_LFO_DELAY, // 12
|
|
|
|
|
// DEXED_LFO_PITCH_MOD_DEP, // 13
|
|
|
|
|
// DEXED_LFO_AMP_MOD_DEP, // 14
|
|
|
|
|
memcpy(&data[DEXED_VOICE_OFFSET + DEXED_LFO_SPEED], &data[112], 4); |
|
|
|
|
tmp = data[116]; |
|
|
|
|
memcpy(&data[DEXED_VOICE_OFFSET + DEXED_LFO_SPEED], &new_data[112], 4); |
|
|
|
|
tmp = new_data[116]; |
|
|
|
|
*(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_SYNC) = (tmp & 0x01); |
|
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_TRANSPOSE) = data[117]; |
|
|
|
|
memcpy(&data[DEXED_VOICE_OFFSET + DEXED_NAME], &data[118], 10); |
|
|
|
|
*(p_data + DEXED_VOICE_OFFSET + DEXED_TRANSPOSE) = new_data[117]; |
|
|
|
|
memcpy(&data[DEXED_VOICE_OFFSET + DEXED_NAME], &new_data[118], 10); |
|
|
|
|
|
|
|
|
|
//panic();
|
|
|
|
|
panic(); |
|
|
|
|
doRefreshVoice(); |
|
|
|
|
//activate();
|
|
|
|
|
|
|
|
|
|
strncpy(voice_name, (char *)&data[145], sizeof(voice_name) - 1); |
|
|
|
|
strncpy(voice_name, (char *)&new_data[145], sizeof(voice_name) - 1); |
|
|
|
|
voice_name[10] = '\0'; |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Voice [")); |
|
|
|
|
Serial.print(voice_name); |
|
|
|
|
Serial.println(F("] loaded.")); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
return (true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool Dexed::loadVoiceParameters(uint8_t* new_data) |
|
|
|
|
{ |
|
|
|
|
notesOff(); |
|
|
|
|
|
|
|
|
|
memcpy(&data, new_data, 155); |
|
|
|
|
|
|
|
|
|
panic(); |
|
|
|
|
doRefreshVoice(); |
|
|
|
|
//activate();
|
|
|
|
|
|
|
|
|
|
strncpy(voice_name, (char *)&new_data[145], sizeof(voice_name) - 1); |
|
|
|
|
voice_name[10] = '\0'; |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Voice [")); |
|
|
|
|
Serial.print(voice_name); |
|
|
|
@ -503,21 +524,21 @@ bool Dexed::loadVoiceParameters(uint8_t* data) |
|
|
|
|
return (true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool Dexed::loadGlobalParameters(uint8_t* data) |
|
|
|
|
bool Dexed::loadGlobalParameters(uint8_t* new_data) |
|
|
|
|
{ |
|
|
|
|
uint8_t* p_data = data; |
|
|
|
|
|
|
|
|
|
controllers.values_[kControllerPitchRange] = data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE]; |
|
|
|
|
controllers.values_[kControllerPitchStep] = data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP]; |
|
|
|
|
controllers.wheel.setRange(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_RANGE]); |
|
|
|
|
controllers.wheel.setTarget(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_ASSIGN]); |
|
|
|
|
controllers.foot.setRange(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_RANGE]); |
|
|
|
|
controllers.foot.setTarget(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_ASSIGN]); |
|
|
|
|
controllers.breath.setRange(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_RANGE]); |
|
|
|
|
controllers.breath.setTarget(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN]); |
|
|
|
|
controllers.at.setRange(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE]); |
|
|
|
|
controllers.at.setTarget(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN]); |
|
|
|
|
controllers.masterTune = (data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] * 0x4000 << 11) * (1.0 / 12); |
|
|
|
|
controllers.values_[kControllerPitchRange] = new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE]; |
|
|
|
|
controllers.values_[kControllerPitchStep] = new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP]; |
|
|
|
|
controllers.wheel.setRange(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_RANGE]); |
|
|
|
|
controllers.wheel.setTarget(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_ASSIGN]); |
|
|
|
|
controllers.foot.setRange(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_RANGE]); |
|
|
|
|
controllers.foot.setTarget(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_ASSIGN]); |
|
|
|
|
controllers.breath.setRange(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_RANGE]); |
|
|
|
|
controllers.breath.setTarget(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN]); |
|
|
|
|
controllers.at.setRange(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE]); |
|
|
|
|
controllers.at.setTarget(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN]); |
|
|
|
|
controllers.masterTune = (new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] * 0x4000 << 11) * (1.0 / 12); |
|
|
|
|
controllers.refresh(); |
|
|
|
|
|
|
|
|
|
setOPs((*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP1_ENABLE) << 5) | |
|
|
|
|