Fixed a problem when bypassing plugin.

Fixed a SEGV when deleting the plugin.
pull/1/head
root 8 years ago
parent 56adff66e1
commit 97bac5932d
  1. 42
      src/dexed.cpp
  2. 1
      src/dexed.h
  3. 2
      src/dexed.mk

@ -52,7 +52,7 @@ Dexed::Dexed(double rate) : lvtk::Synth<DexedVoice, Dexed>(p_n_ports, p_midi_in)
engineOpl=new EngineOpl;
engineMsfa=new FmCore;
for(i=0; i<MAX_ACTIVE_NOTES; ++i) {
for(i=0; i<MAX_ACTIVE_NOTES; i++) {
voices[i].dx7_note = new Dx7Note;
voices[i].keydown = false;
voices[i].sustained = false;
@ -105,20 +105,6 @@ Dexed::~Dexed()
{
TRACE("Hi");
delete [] outbuf_;
currentNote = -1;
for (uint8_t note = 0; note < MAX_ACTIVE_NOTES; ++note) {
if ( voices[note].dx7_note != NULL ) {
delete voices[note].dx7_note;
voices[note].dx7_note = NULL;
}
voices[note].keydown = false;
voices[note].sustained = false;
voices[note].live = false;
}
TRACE("Bye");
}
@ -580,10 +566,7 @@ bool Dexed::ProcessMidiMessage(const uint8_t *buf, uint32_t buf_size) {
break;
case 123:
TRACE("MIDI all-notes-off: %d %d",ctrl,value);
for(uint8_t note=0; note<max_notes; note++)
{
voices[note].dx7_note->keyup();
}
notes_off();
return(true);
break;
}
@ -831,12 +814,23 @@ void Dexed::setMonoMode(bool mode) {
}
void Dexed::panic(void) {
for(uint8_t i=0;i<MAX_ACTIVE_NOTES;i++)
{
if(voices[i].live == true) {
voices[i].keydown = false;
voices[i].live = false;
voices[i].sustained = false;
if ( voices[i].dx7_note != NULL ) {
voices[i].dx7_note->oscSync();
}
}
}
}
void Dexed::notes_off(void) {
for(uint8_t i=0;i<MAX_ACTIVE_NOTES;i++) {
voices[i].keydown = false;
voices[i].live = false;
voices[i].sustained = false;
if ( voices[i].dx7_note != NULL ) {
voices[i].dx7_note->oscSync();
if(voices[i].live==true&&voices[i].keydown==true) {
voices[i].keydown=false;
}
}
}

@ -96,6 +96,7 @@ class Dexed : public lvtk::Synth<DexedVoice, Dexed>
void keyup(uint8_t pitch);
void keydown(uint8_t pitch, uint8_t velo);
void panic(void);
void notes_off(void);
static const uint8_t MAX_ACTIVE_NOTES = 32;
uint8_t max_notes=MAX_ACTIVE_NOTES;

@ -5,7 +5,7 @@
######################################
DEXED_DEPENDENCIES = lvtk
DEXED_VERSION = da0fabe3de43de10c1e36899e751791888a7f4e3
DEXED_VERSION = #da0fabe3de43de10c1e36899e751791888a7f4e3
DEXED_BUNDLES = dexed.lv2
DEXED_SITE = $(call github,dcoredump,dexed,$(DEXED_VERSION))
DEXED_TARGET_MAKE = $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) MOD=1

Loading…
Cancel
Save