From e432b47f22eabc0940dd7e31488ef4d1d8f66c45 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Sun, 18 Dec 2016 14:05:33 +0000 Subject: [PATCH] Fixes... fixes... --- src/Dexed.ttl | 20 ++++++++++++++++++++ src/dexed.cpp | 33 +++++++++++++++++++++------------ src/dexed.h | 8 ++++---- src/msfa/controllers.h | 8 ++++---- 4 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/Dexed.ttl b/src/Dexed.ttl index ba95648..1fb1df3 100644 --- a/src/Dexed.ttl +++ b/src/Dexed.ttl @@ -1826,6 +1826,26 @@ lv2:minimum 0 ; lv2:maximum 7 ; lv2:portProperty lv2:integer ; + ] , + [ + a lv2:InputPort, lv2:ControlPort ; + lv2:index 152 ; + lv2:symbol "pitch_bend_range" ; + lv2:name "PITCH BEND RANGE" ; + lv2:default 1 ; + lv2:minimum 0 ; + lv2:maximum 12 ; + lv2:portProperty lv2:integer ; + ] , + [ + a lv2:InputPort, lv2:ControlPort ; + lv2:index 153 ; + lv2:symbol "pitch_bend_step" ; + lv2:name "PITCH BEND STEP" ; + lv2:default 0 ; + lv2:minimum 0 ; + lv2:maximum 12 ; + lv2:portProperty lv2:integer ; ] ; doap:name "Dexed" ; diff --git a/src/dexed.cpp b/src/dexed.cpp index 98f3ad1..5f6fd9f 100644 --- a/src/dexed.cpp +++ b/src/dexed.cpp @@ -15,6 +15,8 @@ Dexed::Dexed(double rate) : lvtk::Synth(p_n_ports, p_midi_in) { + uint8_t i; + TRACE("Hi"); engineMkI=new EngineMkI; @@ -31,13 +33,16 @@ Dexed::Dexed(double rate) : lvtk::Synth(p_n_ports, p_midi_in) 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; + for(i=0; i(data[i]); + currentNote = 0; controllers.values_[kControllerPitch] = 0x2000; controllers.modwheel_cc = 0; @@ -64,7 +69,7 @@ Dexed::Dexed(double rate) : lvtk::Synth(p_n_ports, p_midi_in) engineType=0xff; setEngineType(DEXED_ENGINE_MARKI); - add_voices(new DexedVoice(rate)); + //add_voices(new DexedVoice(rate)); add_audio_outputs(p_audio_out); @@ -96,10 +101,9 @@ void Dexed::activate(void) { TRACE("Hi"); - Plugin::activate(); - set_params(); - refreshVoice=true; + + Plugin::activate(); TRACE("Bye"); } @@ -306,6 +310,10 @@ void Dexed::set_params(void) // 10 bytes (145-154) are the name of the patch onParam(155,0x3f); // operator on/off => All OPs on + // Pitch bend + controllers.values_[kControllerPitchRange]=static_cast(*p(p_pitch_bend_range)); + controllers.values_[kControllerPitchStep]=static_cast(*p(p_pitch_bend_step)); + //TRACE("Bye"); } @@ -318,7 +326,7 @@ void Dexed::run (uint32_t sample_count) Plugin::run(sample_count); - if(++_param_counter==16) + if(++_param_counter>=16) { set_params(); // pre_process: copy actual voice params _param_counter=0; @@ -506,7 +514,7 @@ void Dexed::ProcessMidiMessage(const uint8_t *buf, uint32_t buf_size) { } break; } - +/* case 0xc0 : //setCurrentProgram(buf[1]); break; @@ -520,6 +528,7 @@ void Dexed::ProcessMidiMessage(const uint8_t *buf, uint32_t buf_size) { TRACE("MIDI pitchbend 0xe0 event: %d %d",buf[1],buf[2]); controllers.values_[kControllerPitch] = buf[1] | (buf[2] << 7); break; +*/ default: TRACE("MIDI event unknown: cmd=%d, val1=%d, val2=%d",buf[0],buf[1],buf[2]); break; @@ -656,7 +665,6 @@ void Dexed::setEngineType(uint8_t tp) { if(engineType==tp) return; - panic(); switch (tp) { case DEXED_ENGINE_MARKI: TRACE("DEXED_ENGINE_MARKI:%d",DEXED_ENGINE_MARKI); @@ -675,6 +683,7 @@ void Dexed::setEngineType(uint8_t tp) { break; } engineType = tp; + panic(); } bool Dexed::isMonoMode(void) { diff --git a/src/dexed.h b/src/dexed.h index 6e730e9..56c5f2e 100644 --- a/src/dexed.h +++ b/src/dexed.h @@ -115,11 +115,11 @@ class Dexed : public lvtk::Synth uint32_t extra_buf_size_; private: + double _rate; uint8_t _param_counter; float data_float[156]; - uint8_t data[156]; - double _rate; -/* uint8_t data[156]={ + //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, @@ -131,7 +131,7 @@ class Dexed : public lvtk::Synth 34, 33, 00, 00, 00, 04, 03, 24, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, - 63 }; */ + 63 }; }; #endif // PLUGINPROCESSOR_H_INCLUDED diff --git a/src/msfa/controllers.h b/src/msfa/controllers.h index 5ad5874..96143fe 100755 --- a/src/msfa/controllers.h +++ b/src/msfa/controllers.h @@ -28,9 +28,9 @@ #endif // State of MIDI controllers -const int kControllerPitch = 128; -const int kControllerPitchRange = 129; -const int kControllerPitchStep = 130; +const int kControllerPitch = 0; +const int kControllerPitchRange = 1; +const int kControllerPitchStep = 2; class FmCore; @@ -77,7 +77,7 @@ class Controllers { } public: - int values_[131]; + int values_[3]; char opSwitch[7];