Hmmm - not easy. Added some test code.

pull/1/head
Holger Wirtz 8 years ago
parent 02c9fafb25
commit aa4f31bf3d
  1. 12
      dexed.mh
  2. 27
      src/dexed.cpp
  3. 17
      src/dexed.h

@ -0,0 +1,12 @@
add https://github.com/dcoredump/dexed 0
add http://gareus.org/oss/lv2/stepseq#s4n4 1
add http://ll-plugins.nongnu.org/lv2/lv2pftci/beep2 2
connect ttymidi:MIDI_in effect_0:lv2_events_in
connect effect_1:midiout effect_0:lv2_events_in
connect effect_1:midiout effect_2:midi
connect effect_0:lv2_audio_out_1 system:playback_1
connect effect_0:lv2_audio_out_1 system:playback_2
connect effect_2:right system:playback_1
connect effect_2:left system:playback_2
param_set 1 grid_1_1 1
param_set 1 grid_2_3 1

@ -10,21 +10,25 @@
#include "msfa/freqlut.h"
#include "msfa/controllers.h"
DexedVoice::DexedVoice(double rate, uint8_t fb) : m_key(lvtk::INVALID_KEY), m_rate(rate)
DexedVoice::DexedVoice(double rate) : m_key(lvtk::INVALID_KEY), m_rate(rate)
{
voice.dx7_note=new Dx7Note;
feedback_bitdepth=fb;
}
void DexedVoice::on(unsigned char key, unsigned char velocity)
{
m_key = key;
voice.dx7_note->init(data, key, velocity, feedback_bitdepth);
voice.keydown=true;
printf("Dexed: key-down: %d %d\n",key,velocity);
}
void DexedVoice::off(unsigned char velocity)
{
voice.dx7_note->keyup();
voice.keydown=false;
m_key = lvtk::INVALID_KEY;
printf("Dexed: key-up: %d\n",velocity);
}
unsigned char DexedVoice::get_key(void) const
@ -41,11 +45,10 @@ void DexedVoice::render(uint32_t from, uint32_t to)
{
int32_t s;
//dx7_note->compute(&s, lfovalue, lfodelay, &controllers);
voice.dx7_note->compute(&s, 0, 0, NULL);
voice.dx7_note->compute(&s, lfo.getsample(), lfo.getdelay(), &controllers);
float fs=float(s)/(INT32_MAX);
p(p_lv2_audio_out_1)[i]+=fs;
}
}
}
void DexedVoice::post_process(uint32_t from, uint32_t to)
@ -68,8 +71,6 @@ Dexed::Dexed(double rate) : lvtk::Synth<DexedVoice, Dexed>(p_n_ports, p_lv2_even
PitchEnv::init(rate);
Env::init_sr(rate);
Controllers controllers;
engineType=DEXED_ENGINE_MARKI;
feedback_bitdepth=11;
@ -79,19 +80,9 @@ Dexed::Dexed(double rate) : lvtk::Synth<DexedVoice, Dexed>(p_n_ports, p_lv2_even
data[i] = init_voice[i];
}
add_voices(new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth),new DexedVoice(rate, feedback_bitdepth));
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),new DexedVoice(rate),new DexedVoice(rate),new DexedVoice(rate));
add_audio_outputs(p_lv2_audio_out_1);
}
uint8_t Dexed::get_feedback_bitdepth(void)
{
return(feedback_bitdepth);
}
uint32_t Dexed::get_engineType(void)
{
return(engineType);
}
static int _ = Dexed::register_class(p_uri);

@ -49,7 +49,7 @@ enum DexedEngineResolution {
class DexedVoice : public lvtk::Voice
{
public:
DexedVoice(double rate, uint8_t fb);
DexedVoice(double rate);
void on(unsigned char key, unsigned char velocity);
void off(unsigned char velocity);
unsigned char get_key(void) const;
@ -59,7 +59,6 @@ class DexedVoice : public lvtk::Voice
protected:
unsigned char m_key;
double m_rate;
uint8_t feedback_bitdepth;
ProcessorVoice voice;
};
@ -70,17 +69,21 @@ class Dexed : public lvtk::Synth<DexedVoice, Dexed>
public:
Dexed(double rate);
FmCore *core;
uint8_t get_feedback_bitdepth(void);
uint32_t get_engineType(void);
protected:
// dexed internal
FmCore engineMsfa;
};
// GLOBALS
EngineMkI engineMkI;
EngineOpl engineOpl;
//FmCore engineMsfa;
//EngineOpl engineOpl;
uint8_t feedback_bitdepth;
uint32_t engineType;
};
Lfo lfo;
Controllers controllers;
const char init_voice[] =
{ 99, 99, 99, 99, 99, 99, 99, 00, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 7,

Loading…
Cancel
Save