Fixing pitchbend code for using with LV2

pull/1/head
Holger Wirtz 8 years ago
parent 4f0a4f607a
commit 3f9790f594
  1. 24
      src/Dexed.ttl
  2. 2
      src/dexed.cpp
  3. 7
      src/dexed.h
  4. 2
      src/manifest.ttl
  5. 22
      src/msfa/dx7note.cc

@ -1832,7 +1832,7 @@
lv2:index 152 ; lv2:index 152 ;
lv2:symbol "pitch_bend_range" ; lv2:symbol "pitch_bend_range" ;
lv2:name "PITCH BEND RANGE" ; lv2:name "PITCH BEND RANGE" ;
lv2:default 1 ; lv2:default 12 ;
lv2:minimum 0 ; lv2:minimum 0 ;
lv2:maximum 12 ; lv2:maximum 12 ;
lv2:portProperty lv2:integer ; lv2:portProperty lv2:integer ;
@ -1842,7 +1842,27 @@
lv2:index 153 ; lv2:index 153 ;
lv2:symbol "pitch_bend_step" ; lv2:symbol "pitch_bend_step" ;
lv2:name "PITCH BEND STEP" ; lv2:name "PITCH BEND STEP" ;
lv2:default 0 ; lv2:default 12 ;
lv2:minimum 0 ;
lv2:maximum 12 ;
lv2:portProperty lv2:integer ;
] ,
[
a lv2:InputPort, lv2:ControlPort ;
lv2:index 154 ;
lv2:symbol "mod_wheel_range" ;
lv2:name "MOD WHEEL RANGE" ;
lv2:default 12 ;
lv2:minimum 0 ;
lv2:maximum 12 ;
lv2:portProperty lv2:integer ;
] ,
[
a lv2:InputPort, lv2:ControlPort ;
lv2:index 155 ;
lv2:symbol "mod_wheel_step" ;
lv2:name "MOD WHEEL STEP" ;
lv2:default 12 ;
lv2:minimum 0 ; lv2:minimum 0 ;
lv2:maximum 12 ; lv2:maximum 12 ;
lv2:portProperty lv2:integer ; lv2:portProperty lv2:integer ;

@ -41,7 +41,7 @@ Dexed::Dexed(double rate) : lvtk::Synth<DexedVoice, Dexed>(p_n_ports, p_midi_in)
voices[i].live = false; voices[i].live = false;
} }
for(i=0;i<156;++i) for(i=0;i<156+4;++i)
data_float[i]=static_cast<float>(data[i]); data_float[i]=static_cast<float>(data[i]);
currentNote = 0; currentNote = 0;

@ -117,9 +117,9 @@ class Dexed : public lvtk::Synth<DexedVoice, Dexed>
private: private:
double _rate; double _rate;
uint8_t _param_counter; uint8_t _param_counter;
float data_float[156]; float data_float[156+4];
//uint8_t data[156]; //uint8_t data[156];
uint8_t data[156]={ uint8_t data[156+4]={
95, 29, 20, 50, 99, 95, 00, 00, 41, 00, 19, 00, 00, 03, 00, 06, 79, 00, 01, 00, 14, 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, 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, 29, 20, 50, 99, 95, 00, 00, 00, 00, 00, 00, 00, 03, 00, 06, 89, 00, 01, 00, 07,
@ -131,7 +131,8 @@ class Dexed : public lvtk::Synth<DexedVoice, Dexed>
34, 33, 00, 00, 00, 04, 34, 33, 00, 00, 00, 04,
03, 24, 03, 24,
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
63 }; 63,
12, 12, 12, 12};
}; };
#endif // PLUGINPROCESSOR_H_INCLUDED #endif // PLUGINPROCESSOR_H_INCLUDED

@ -11,7 +11,7 @@
a lv2:Plugin ; a lv2:Plugin ;
doap:name "Dexed is a LV2 port of the famous DX-7 simulation which is based on MSFA." ; doap:name "Dexed is a LV2 port of the famous DX-7 simulation which is based on MSFA." ;
doap:description "Synth" ; doap:description "Synth" ;
doap:shortdesc "An LV2 port of the Dexed plugin" ; doap:shortdesc "Dexed" ;
lv2:minorVersion 1; lv2:microVersion 0; lv2:minorVersion 1; lv2:microVersion 0;
doap:homepage <https://github.com/dcoredump/dexed/tree/native-lv2> ; doap:homepage <https://github.com/dcoredump/dexed/tree/native-lv2> ;
doap:maintainer [ doap:maintainer [

@ -190,8 +190,22 @@ void Dx7Note::compute(int32_t *buf, int32_t lfo_val, int32_t lfo_delay, const Co
int32_t pitch_mod = max(pmod_1, pmod_2); int32_t pitch_mod = max(pmod_1, pmod_2);
pitch_mod = pitchenv_.getsample() + (pitch_mod * (senslfo < 0 ? -1 : 1)); pitch_mod = pitchenv_.getsample() + (pitch_mod * (senslfo < 0 ? -1 : 1));
/* // ---- PITCH BEND ---- #ifdef DEBUG
// ---- PITCH BEND ----
// hardcodes a pitchbend range of 3 semitones, TODO make configurable
int pitchbend = ctrls->values_[kControllerPitch]; int pitchbend = ctrls->values_[kControllerPitch];
int32_t pb = (pitchbend - 0x2000) << 9;
pitch_mod += pb;
for (int op = 0; op < 6; op++) {
params_[op].level_in = params_[op].gain_out;
int32_t level = env_[op].getsample();
int32_t gain = Exp2::lookup(level - (14 * (1 << 24)));
// int32_t gain = pow(2, 10 + level * (1.0 / (1 << 24)));
params_[op].freq = Freqlut::lookup(basepitch_[op] + pitch_mod);
params_[op].gain_out = gain;
}
/* int pitchbend = ctrls->values_[kControllerPitch];
int32_t pb = (pitchbend - 0x2000); int32_t pb = (pitchbend - 0x2000);
if (pb != 0) { if (pb != 0) {
if (ctrls->values_[kControllerPitchStep] == 0) { if (ctrls->values_[kControllerPitchStep] == 0) {
@ -203,8 +217,10 @@ void Dx7Note::compute(int32_t *buf, int32_t lfo_val, int32_t lfo_delay, const Co
} }
} }
pitch_mod += pb; pitch_mod += pb;
pitch_mod += ctrls->masterTune; pitch_mod += ctrls->masterTune; */
*/ TRACE("pitch_mod=%d pb=%d");
#endif
// ==== AMP MOD ==== // ==== AMP MOD ====
uint32_t amod_1 = ((int64_t) ampmoddepth_ * (int64_t) lfo_delay) >> 8; // Q24 :D uint32_t amod_1 = ((int64_t) ampmoddepth_ * (int64_t) lfo_delay) >> 8; // Q24 :D
amod_1 = ((int64_t) amod_1 * (int64_t) lfo_val) >> 24; amod_1 = ((int64_t) amod_1 * (int64_t) lfo_val) >> 24;

Loading…
Cancel
Save