From 517f4f54881f12a5f61799e27ab0cb215954a72d Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Sun, 23 Jan 2022 15:43:28 +0000 Subject: [PATCH] Fixes for portamento. --- doc/enable_sysex.url | 1 + doc/porta.url | 1 + src/dexed.cpp | 5 +++-- src/msfa/dx7note.cc | 4 ++-- src/msfa/dx7note.h | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 doc/enable_sysex.url create mode 100644 doc/porta.url diff --git a/doc/enable_sysex.url b/doc/enable_sysex.url new file mode 100644 index 0000000..058fbfc --- /dev/null +++ b/doc/enable_sysex.url @@ -0,0 +1 @@ +https://discourse.zynthian.org/t/receive-sysex-data/4825/3 diff --git a/doc/porta.url b/doc/porta.url new file mode 100644 index 0000000..50801d7 --- /dev/null +++ b/doc/porta.url @@ -0,0 +1 @@ +https://github.com/jpcima/dexed/commits/portamento-wip diff --git a/src/dexed.cpp b/src/dexed.cpp index 1418379..6e8d653 100644 --- a/src/dexed.cpp +++ b/src/dexed.cpp @@ -91,6 +91,7 @@ Dexed::Dexed(double rate) : lvtk::Synth(p_n_ports, p_midi_in) controllers.values_[kControllerPitch] = 0x2000; controllers.values_[kControllerPitchRange] = 0; controllers.values_[kControllerPitchStep] = 0; + controllers.values_[kControllerPortamentoGlissando] = 0; controllers.modwheel_cc = 0; controllers.foot_cc = 0; controllers.breath_cc = 0; @@ -761,7 +762,7 @@ void Dexed::setPortamentoMode(uint8_t portamento_mode, uint8_t portamento_glissa controllers.portamento_cc = portamento_time; controllers.portamento_enable_cc = portamento_mode > 63; - if (portamento_mode > 63 && portamento_time > 0) + if (portamento_time > 0) controllers.portamento_enable_cc = true; else controllers.portamento_enable_cc = false; @@ -799,7 +800,7 @@ TRACE("pitch=%d, velo=%d\n",pitch,velo); voices[note].porta = porta; voices[note].sustained = sustain; voices[note].keydown = true; - voices[note].dx7_note->init(data, pitch, velo, previousKeyDown, porta); + voices[note].dx7_note->init(data, pitch, velo, previousKeyDown, porta, &controllers); if ( data[136] ) voices[note].dx7_note->oscSync(); break; diff --git a/src/msfa/dx7note.cc b/src/msfa/dx7note.cc index dde1752..3619496 100644 --- a/src/msfa/dx7note.cc +++ b/src/msfa/dx7note.cc @@ -152,7 +152,7 @@ Dx7Note::Dx7Note() { } } -void Dx7Note::init(const uint8_t patch[156], int midinote, int velocity, int srcnote, int porta) { +void Dx7Note::init(const uint8_t patch[156], int midinote, int velocity, int srcnote, int porta, const Controllers *ctrls) { int rates[4]; int levels[4]; for (int op = 0; op < 6; op++) { @@ -197,7 +197,7 @@ void Dx7Note::init(const uint8_t patch[156], int midinote, int velocity, int src pitchmodsens_ = pitchmodsenstab[patch[143] & 7]; ampmoddepth_ = (patch[140] * 165) >> 6; porta_rateindex_ = (porta < 128) ? porta : 127; - porta_gliss_ = patch[68]; + porta_gliss_ = ctrls->values_[kControllerPortamentoGlissando]; } void Dx7Note::compute(int32_t *buf, int32_t lfo_val, int32_t lfo_delay, const Controllers *ctrls) { diff --git a/src/msfa/dx7note.h b/src/msfa/dx7note.h index 953e165..bbb9f43 100644 --- a/src/msfa/dx7note.h +++ b/src/msfa/dx7note.h @@ -37,7 +37,7 @@ struct VoiceStatus { class Dx7Note { public: Dx7Note(); - void init(const uint8_t patch[156], int midinote, int velocity, int srcnote, int porta); + void init(const uint8_t patch[156], int midinote, int velocity, int srcnote, int porta, const Controllers *ctrls); // Note: this _adds_ to the buffer. Interesting question whether it's // worth it...