|
|
@ -283,8 +283,6 @@ float PluginFx::getGain(void) |
|
|
|
|
|
|
|
|
|
|
|
Dexed::Dexed(uint8_t maxnotes, int rate) |
|
|
|
Dexed::Dexed(uint8_t maxnotes, int rate) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint8_t i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Exp2::init(); |
|
|
|
Exp2::init(); |
|
|
|
Tanh::init(); |
|
|
|
Tanh::init(); |
|
|
|
Sin::init(); |
|
|
|
Sin::init(); |
|
|
@ -297,19 +295,7 @@ Dexed::Dexed(uint8_t maxnotes, int rate) |
|
|
|
fx.init(rate); |
|
|
|
fx.init(rate); |
|
|
|
|
|
|
|
|
|
|
|
engineMsfa = new FmCore; |
|
|
|
engineMsfa = new FmCore; |
|
|
|
|
|
|
|
|
|
|
|
max_notes=maxnotes; |
|
|
|
max_notes=maxnotes; |
|
|
|
voices=new ProcessorVoice[max_notes]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < max_notes; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
voices[i].dx7_note = new Dx7Note; |
|
|
|
|
|
|
|
voices[i].keydown = false; |
|
|
|
|
|
|
|
voices[i].sustained = false; |
|
|
|
|
|
|
|
voices[i].live = false; |
|
|
|
|
|
|
|
voices[i].key_pressed_timer = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
currentNote = 0; |
|
|
|
currentNote = 0; |
|
|
|
resetControllers(); |
|
|
|
resetControllers(); |
|
|
|
controllers.masterTune = 0; |
|
|
|
controllers.masterTune = 0; |
|
|
@ -317,13 +303,12 @@ Dexed::Dexed(uint8_t maxnotes, int rate) |
|
|
|
lastKeyDown = -1; |
|
|
|
lastKeyDown = -1; |
|
|
|
vuSignal = 0.0; |
|
|
|
vuSignal = 0.0; |
|
|
|
controllers.core = engineMsfa; |
|
|
|
controllers.core = engineMsfa; |
|
|
|
|
|
|
|
|
|
|
|
lfo.reset(data + 137); |
|
|
|
lfo.reset(data + 137); |
|
|
|
|
|
|
|
|
|
|
|
setMonoMode(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sustain = false; |
|
|
|
sustain = false; |
|
|
|
|
|
|
|
voices=NULL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setMaxNotes(max_notes); |
|
|
|
|
|
|
|
setMonoMode(false); |
|
|
|
loadInitVoice(); |
|
|
|
loadInitVoice(); |
|
|
|
|
|
|
|
|
|
|
|
xrun = 0; |
|
|
|
xrun = 0; |
|
|
@ -343,6 +328,47 @@ Dexed::~Dexed() |
|
|
|
delete(engineMsfa); |
|
|
|
delete(engineMsfa); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Dexed::setMaxNotes(uint8_t new_max_notes) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
uint8_t i=0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
max_notes=constrain(max_notes,0,_MAX_NOTES); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.print("Allocating memory for "); |
|
|
|
|
|
|
|
Serial.print(max_notes,DEC); |
|
|
|
|
|
|
|
Serial.println(" notes."); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(voices) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
panic(); |
|
|
|
|
|
|
|
for (i = 0; i < max_notes; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(voices[i].dx7_note) |
|
|
|
|
|
|
|
delete voices[i].dx7_note; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
delete voices; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
max_notes=new_max_notes; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(max_notes>0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
voices=new ProcessorVoice[max_notes]; |
|
|
|
|
|
|
|
for (i = 0; i < max_notes; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
voices[i].dx7_note = new Dx7Note; |
|
|
|
|
|
|
|
voices[i].keydown = false; |
|
|
|
|
|
|
|
voices[i].sustained = false; |
|
|
|
|
|
|
|
voices[i].live = false; |
|
|
|
|
|
|
|
voices[i].key_pressed_timer = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
voices=NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Dexed::activate(void) |
|
|
|
void Dexed::activate(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
panic(); |
|
|
|
panic(); |
|
|
@ -596,7 +622,7 @@ void Dexed::setOPAll(uint8_t ops) |
|
|
|
controllers.opSwitch = ops; |
|
|
|
controllers.opSwitch = ops; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool Dexed::isMonoMode(void) { |
|
|
|
bool Dexed::getMonoMode(void) { |
|
|
|
return monoMode; |
|
|
|
return monoMode; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -604,7 +630,6 @@ void Dexed::setMonoMode(bool mode) { |
|
|
|
if (monoMode == mode) |
|
|
|
if (monoMode == mode) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
//panic();
|
|
|
|
|
|
|
|
notesOff(); |
|
|
|
notesOff(); |
|
|
|
monoMode = mode; |
|
|
|
monoMode = mode; |
|
|
|
} |
|
|
|
} |
|
|
@ -668,16 +693,6 @@ void Dexed::notesOff(void) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Dexed::setMaxNotes(uint8_t n) { |
|
|
|
|
|
|
|
if (n <= max_notes) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
notesOff(); |
|
|
|
|
|
|
|
max_notes = n; |
|
|
|
|
|
|
|
//panic();
|
|
|
|
|
|
|
|
controllers.refresh(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t Dexed::getMaxNotes(void) |
|
|
|
uint8_t Dexed::getMaxNotes(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return max_notes; |
|
|
|
return max_notes; |
|
|
@ -885,9 +900,8 @@ void Dexed::loadVoiceParameters(uint8_t* new_data) |
|
|
|
panic(); |
|
|
|
panic(); |
|
|
|
memcpy(&data, new_data, 155); |
|
|
|
memcpy(&data, new_data, 155); |
|
|
|
doRefreshVoice(); |
|
|
|
doRefreshVoice(); |
|
|
|
strncpy(dexed_voice_name, (char *)&new_data[145], sizeof(dexed_voice_name) - 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
strncpy(dexed_voice_name, (char *)&new_data[145], sizeof(dexed_voice_name) - 1); |
|
|
|
dexed_voice_name[10] = '\0'; |
|
|
|
dexed_voice_name[10] = '\0'; |
|
|
|
|
|
|
|
|
|
|
|
Serial.print(F("Voice [")); |
|
|
|
Serial.print(F("Voice [")); |
|
|
|