Merge branch 'native-lv2' of https://github.com/dcoredump/dexed into native-lv2

pull/1/head
Holger Wirtz 8 years ago
commit c93dda1b69
  1. 5
      src/Makefile
  2. 95
      src/dexed.cpp
  3. 16
      src/dexed.h

@ -66,7 +66,7 @@ $(BUNDLE): manifest.ttl Dexed.ttl dexed.so
dexed.so: $(OBJ) dexed.o dexed.so: $(OBJ) dexed.o
$(CXX) $(CXXFLAGS) -shared dexed.o $(OBJ) $(LDFLAGS) -o dexed.so $(CXX) $(CXXFLAGS) -shared dexed.o $(OBJ) $(LDFLAGS) -o dexed.so
dexed.o: Makefile dexed.cpp dexed.peg dexed.o: Makefile dexed.cpp dexed.h dexed.peg
$(CXX) $(CXXFLAGS) -Wall -c dexed.cpp $(CXX) $(CXXFLAGS) -Wall -c dexed.cpp
trace.o: Makefile trace.c trace.h trace.o: Makefile trace.c trace.h
@ -109,5 +109,6 @@ PluginFx.o: Makefile PluginFx.cpp
$(CXX) $(CXXFLAGS) -Wall -c PluginFx.cpp $(CXX) $(CXXFLAGS) -Wall -c PluginFx.cpp
dexed.peg: Dexed.ttl dexed.peg: Dexed.ttl
lv2peg Dexed.ttl dexed.peg #lv2peg Dexed.ttl dexed.peg
ttl2c Dexed.ttl dexed.peg

@ -10,58 +10,19 @@
#include "msfa/freqlut.h" #include "msfa/freqlut.h"
#include "msfa/controllers.h" #include "msfa/controllers.h"
#include "PluginFx.h" #include "PluginFx.h"
#include <unistd.h>
Dexed::Dexed(double rate) : lvtk::Synth<DexedVoice, Dexed>(p_n_ports, p_midi_in) Dexed::Dexed(double rate) : lvtk::Synth<DexedVoice, Dexed>(p_n_ports, p_midi_in)
{ {
TRACE("Hi"); TRACE("Hi");
bufsize_=256;
outbuf_=new float[bufsize_];
Exp2::init();
Tanh::init();
Sin::init();
normalizeDxVelocity = false;
memset(&voiceStatus, 0, sizeof(VoiceStatus));
Freqlut::init(rate);
Lfo::init(rate);
PitchEnv::init(rate);
Env::init_sr(rate);
fx.init(rate);
for (uint8_t note = 0; note < MAX_ACTIVE_NOTES; ++note) {
voices[note].dx7_note = new Dx7Note;
voices[note].keydown = false;
voices[note].sustained = false;
voices[note].live = false;
}
refreshVoice=true;
currentNote = 0;
controllers.values_[kControllerPitch] = 0x2000;
controllers.modwheel_cc = 0;
controllers.foot_cc = 0;
controllers.breath_cc = 0;
controllers.aftertouch_cc = 0;
setEngineType(DEXED_ENGINE_MARKI);
setMonoMode(false);
sustain = false;
lfo.reset(data + 137);
extra_buf_size_ = 0;
add_voices(new DexedVoice(rate)); add_voices(new DexedVoice(rate));
//add_voices(new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate)); //add_voices(new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate));
add_audio_outputs(p_audio_out); add_audio_outputs(p_audio_out);
init(rate);
TRACE("Bye"); TRACE("Bye");
} }
@ -362,7 +323,7 @@ void Dexed::GetSamples(uint32_t n_samples, float* buffer)
if ( voices[i].live ) if ( voices[i].live )
voices[i].dx7_note->update(data, voices[i].midi_note, feedback_bitdepth); voices[i].dx7_note->update(data, voices[i].midi_note, feedback_bitdepth);
} }
lfo.reset(data + 137); lfo.reset(data+137);
refreshVoice = false; refreshVoice = false;
} }
@ -667,6 +628,54 @@ void Dexed::panic(void) {
} }
} }
void Dexed::init(double rate)
{
TRACE("Hi");
bufsize_=256;
outbuf_=new float[bufsize_];
Exp2::init();
Tanh::init();
Sin::init();
normalizeDxVelocity = false;
memset(&voiceStatus, 0, sizeof(VoiceStatus));
Freqlut::init(rate);
Lfo::init(rate);
PitchEnv::init(rate);
Env::init_sr(rate);
fx.init(rate);
for (uint8_t note = 0; note < MAX_ACTIVE_NOTES; ++note) {
voices[note].dx7_note = new Dx7Note;
voices[note].keydown = false;
voices[note].sustained = false;
voices[note].live = false;
}
refreshVoice=true;
currentNote = 0;
controllers.values_[kControllerPitch] = 0x2000;
controllers.modwheel_cc = 0;
controllers.foot_cc = 0;
controllers.breath_cc = 0;
controllers.aftertouch_cc = 0;
setEngineType(DEXED_ENGINE_MARKI);
setMonoMode(false);
sustain = false;
lfo.reset(data+137);
extra_buf_size_ = 0;
}
//============================================================================== //==============================================================================
DexedVoice::DexedVoice(double rate) : m_key(lvtk::INVALID_KEY), m_rate(rate) DexedVoice::DexedVoice(double rate) : m_key(lvtk::INVALID_KEY), m_rate(rate)

@ -85,7 +85,6 @@ class Dexed : public lvtk::Synth<DexedVoice, Dexed>
void set_params(void); void set_params(void);
void GetSamples(uint32_t n_samples, float *buffer); void GetSamples(uint32_t n_samples, float *buffer);
uint8_t data[161];
Controllers controllers; Controllers controllers;
VoiceStatus voiceStatus; VoiceStatus voiceStatus;
@ -95,6 +94,7 @@ class Dexed : public lvtk::Synth<DexedVoice, Dexed>
void keyup(uint8_t pitch); void keyup(uint8_t pitch);
void keydown(uint8_t pitch, uint8_t velo); void keydown(uint8_t pitch, uint8_t velo);
void panic(void); void panic(void);
void init(double rate);
static const uint8_t MAX_ACTIVE_NOTES = 16; static const uint8_t MAX_ACTIVE_NOTES = 16;
ProcessorVoice voices[MAX_ACTIVE_NOTES]; ProcessorVoice voices[MAX_ACTIVE_NOTES];
@ -117,6 +117,20 @@ class Dexed : public lvtk::Synth<DexedVoice, Dexed>
private: private:
uint8_t _param_counter; uint8_t _param_counter;
uint8_t data[156];
/* uint8_t data[156]={
95, 29, 20, 50, 99, 95, 00, 00, 41, 00, 19, 00, 00, 03, 00, 06, 79, 00, 01, 00, 14,
95, 20, 20, 50, 99, 95, 00, 00, 00, 00, 00, 00, 00, 03, 00, 00, 99, 00, 01, 00, 00,
95, 29, 20, 50, 99, 95, 00, 00, 00, 00, 00, 00, 00, 03, 00, 06, 89, 00, 01, 00, 07,
95, 20, 20, 50, 99, 95, 00, 00, 00, 00, 00, 00, 00, 03, 00, 02, 99, 00, 01, 00, 07,
95, 50, 35, 78, 99, 75, 00, 00, 00, 00, 00, 00, 00, 03, 00, 07, 58, 00, 14, 00, 07,
96, 25, 25, 67, 99, 75, 00, 00, 00, 00, 00, 00, 00, 03, 00, 02, 99, 00, 01, 00, 10,
94, 67, 95, 60, 50, 50, 50, 50,
04, 06, 00,
34, 33, 00, 00, 00, 04,
03, 24,
00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
63 }; */
}; };
#endif // PLUGINPROCESSOR_H_INCLUDED #endif // PLUGINPROCESSOR_H_INCLUDED

Loading…
Cancel
Save