Fixed pitchwheel code.

Added (fixed) master tune.
Changed some initial parameters.
pull/1/head
Holger Wirtz 8 years ago
parent 3d5ec67038
commit ddec7f1023
  1. 8
      src/Dexed.ttl
  2. 4
      src/Makefile
  3. 20
      src/dexed.cpp
  4. 2
      src/dexed.h
  5. 7
      src/dexed.mh
  6. 2
      src/msfa/controllers.h
  7. 6
      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 12 ; lv2:default 1 ;
lv2:minimum 0 ; lv2:minimum 0 ;
lv2:maximum 12 ; lv2:maximum 12 ;
lv2:portProperty lv2:integer ; lv2:portProperty lv2:integer ;
@ -1872,9 +1872,9 @@
lv2:index 156 ; lv2:index 156 ;
lv2:symbol "master_tune" ; lv2:symbol "master_tune" ;
lv2:name "MASTER TUNE" ; lv2:name "MASTER TUNE" ;
lv2:default 0 ; lv2:default 0.0 ;
lv2:minimum -100.0 ; lv2:minimum -1.0 ;
lv2:maximum 100.0 ; lv2:maximum 1.0 ;
] ; ] ;
doap:name "Dexed" ; doap:name "Dexed" ;

@ -4,8 +4,8 @@ TARGET=dexed.so
OBJ=fm_core.o env.o lfo.o dx7note.o sin.o pitchenv.o fm_op_kernel.o freqlut.o exp2.o EngineMkI.o EngineOpl.o PluginFx.o trace.o OBJ=fm_core.o env.o lfo.o dx7note.o sin.o pitchenv.o fm_op_kernel.o freqlut.o exp2.o EngineMkI.o EngineOpl.o PluginFx.o trace.o
CFLAGS=-fPIC -DPIC -std=c++11 -I. -I/usr/local/include/lvtk-2 -DLVTK_DEBUG=false CFLAGS=-fPIC -DPIC -std=c++11 -I. -I/usr/local/include/lvtk-2 -DLVTK_DEBUG=false
LDFLAGS=-L/usr/local/lib -llvtk_plugin2 LDFLAGS=-L/usr/local/lib -llvtk_plugin2
#DEBUG=1
#CFLAGS_OPTIONS+=-DPITCHWHEEL # enable for adding pitchwheel code #FILETRACE=1
ifeq ($(ARCH),) ifeq ($(ARCH),)
ARCH := $(shell uname -m) ARCH := $(shell uname -m)

@ -46,6 +46,7 @@ Dexed::Dexed(double rate) : lvtk::Synth<DexedVoice, Dexed>(p_n_ports, p_midi_in)
currentNote = 0; currentNote = 0;
controllers.values_[kControllerPitch] = 0x2000; controllers.values_[kControllerPitch] = 0x2000;
controllers.values_[kControllerPitchRange] = 12;
controllers.modwheel_cc = 0; controllers.modwheel_cc = 0;
controllers.foot_cc = 0; controllers.foot_cc = 0;
controllers.breath_cc = 0; controllers.breath_cc = 0;
@ -107,10 +108,6 @@ void Dexed::activate(void)
set_params(); set_params();
#ifdef DEBUG
TRACE("Algorithm %d outputs: %d",data[134],controllers.core->op_out(data[134]));
#endif
Plugin::activate(); Plugin::activate();
TRACE("Bye"); TRACE("Bye");
@ -473,7 +470,6 @@ void Dexed::GetSamples(uint32_t n_samples, float* buffer)
{ {
uint8_t op_bit=static_cast<uint8_t>(pow(2,op)); uint8_t op_bit=static_cast<uint8_t>(pow(2,op));
TRACE("op=%d op_out=%d 2^op=%d %d",op,op_out,op_bit,op_out&op_bit);
if((op_carrier&op_bit)>0) if((op_carrier&op_bit)>0)
{ {
// this voice is a carrier! // this voice is a carrier!
@ -548,21 +544,23 @@ void Dexed::ProcessMidiMessage(const uint8_t *buf, uint32_t buf_size) {
} }
break; break;
} }
/*
case 0xc0 : // case 0xc0 :
// setCurrentProgram(buf[1]); // setCurrentProgram(buf[1]);
break; // break;
// aftertouch // aftertouch
case 0xd0 : case 0xd0 :
TRACE("MIDI aftertouch 0xd0 event: %d %d",buf[1]); TRACE("MIDI aftertouch 0xd0 event: %d %d",buf[1]);
controllers.aftertouch_cc = buf[1]; controllers.aftertouch_cc = buf[1];
controllers.refresh(); controllers.refresh();
break; break;
// pitchbend
case 0xe0 : case 0xe0 :
TRACE("MIDI pitchbend 0xe0 event: %d %d",buf[1],buf[2]); TRACE("MIDI pitchbend 0xe0 event: %d %d",buf[1],buf[2]);
controllers.values_[kControllerPitch] = buf[1] | (buf[2] << 7); controllers.values_[kControllerPitch] = buf[1] | (buf[2] << 7);
break; break;
*/
default: default:
TRACE("MIDI event unknown: cmd=%d, val1=%d, val2=%d",buf[0],buf[1],buf[2]); TRACE("MIDI event unknown: cmd=%d, val1=%d, val2=%d",buf[0],buf[1],buf[2]);
break; break;
@ -682,8 +680,8 @@ void Dexed::onParam(uint8_t param_num,float param_val)
if(param_num==160) if(param_num==160)
{ {
controllers.masterTune=param_val; int32_t tune=param_val*0x4000;
return; controllers.masterTune=(tune<<11)*(1.0/12);
} }
if(param_num==144 || param_num==134) if(param_num==144 || param_num==134)

@ -136,7 +136,7 @@ class Dexed : public lvtk::Synth<DexedVoice, Dexed>
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, 00}; 01, 12, 12, 12, 00};
}; };
#endif // PLUGINPROCESSOR_H_INCLUDED #endif // PLUGINPROCESSOR_H_INCLUDED

@ -25,3 +25,10 @@ add https://github.com/dcoredump/dexed.lv2 0
connect system:midi_capture_1 effect_0:midi_in connect system:midi_capture_1 effect_0:midi_in
connect effect_0:audio_out system:playback_1 connect effect_0:audio_out system:playback_1
connect effect_0:audio_out system:playback_2 connect effect_0:audio_out system:playback_2
dexed.lv2 triggered from Kawai MP5 (Variant)
--------------------------------------------
add https://github.com/dcoredump/dexed.lv2 0
connect ttymidi:MIDI_in effect_0:midi_in
connect effect_0:audio_out system:playback_1
connect effect_0:audio_out system:playback_2

@ -77,7 +77,7 @@ class Controllers {
} }
public: public:
int values_[3]; int32_t values_[3];
char opSwitch[7]; char opSwitch[7];

@ -190,8 +190,7 @@ 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));
#ifdef PITCHWHEEL uint32_t pitchbend = ctrls->values_[kControllerPitch];
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) {
@ -205,9 +204,6 @@ 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