Revert "Fixes for dynamic memory allocation."

Seem to be buggy...

This reverts commit 3a9568fa1a.
pull/2/head
Holger Wirtz 7 years ago
parent 9677d5a792
commit f63c4b35ef
  1. 42
      src/dexed.cpp

@ -49,27 +49,27 @@ Dexed::Dexed(double rate) : lvtk::Synth<DexedVoice, Dexed>(p_n_ports, p_midi_in)
Env::init_sr(rate);
fx.init(rate);
engineMkI=new EngineMkI;
if(!engineMkI)
if((engineMkI=new EngineMkI)==NULL)
{
TRACE("Cannot not create engine EngineMkI");
exit(400);
}
engineOpl=new EngineOpl;
if(!engineOpl)
if((engineOpl=new EngineOpl)==NULL)
{
TRACE("Cannot not create engine EngineOpl");
exit(401);
}
engineMsfa=new FmCore;
if(!engineMsfa)
if((engineMsfa=new FmCore)==NULL)
{
TRACE("Cannot create engine FmCore");
exit(402);
}
for(i=0; i<MAX_ACTIVE_NOTES; i++) {
voices[i].dx7_note = new Dx7Note;
if(!voices[i].dx7_note)
if((voices[i].dx7_note = new Dx7Note)==NULL)
{
TRACE("Cannot create DX7Note [%d]",i);
exit(403);
}
voices[i].keydown = false;
voices[i].sustained = false;
@ -97,14 +97,15 @@ Dexed::Dexed(double rate) : lvtk::Synth<DexedVoice, Dexed>(p_n_ports, p_midi_in)
bufsize_=256;
outbuf_=new float[bufsize_];
if(outbuf_)
if((outbuf_=new float[bufsize_])==NULL)
{
TRACE("Cannot create outbuf_ buffer");
exit(404);
}
lfo.reset(data+137);
setMonoMode(false);
sustain = false;
@ -126,21 +127,22 @@ Dexed::~Dexed()
{
TRACE("Hi");
if(outbuf_)
if(outbuf_!=NULL)
delete [] outbuf_;
for(uint8_t note = 0; note < MAX_ACTIVE_NOTES; ++note)
currentNote = -1;
for (uint8_t note = 0; note < MAX_ACTIVE_NOTES; ++note)
{
if ( voices[note].dx7_note != NULL )
{
if(voices[note].dx7_note)
delete voices[note].dx7_note;
voices[note].dx7_note = NULL;
}
voices[note].keydown = false;
voices[note].sustained = false;
voices[note].live = false;
}
if(engineMkI)
delete(engineMkI);
if(engineOpl)
delete(engineOpl);
if(engineMsfa)
delete(engineMsfa);
TRACE("Bye");
TRACE("--------------------------------------------------------------------------------");

Loading…
Cancel
Save