Skip to content

Commit

Permalink
A Collection of 1.6.5 fixes and cleanups (#1534)
Browse files Browse the repository at this point in the history
- Keytrack is bipolar on greenline. Closes #1529
- Envelope LFO is unipolar on greenline. Cloese #1527
- FX VST Display Names have slot number. Closes #1528
- Allow a remap to a note other than 440 without a KBM
  Closes #1526 but still succeptible to the bug in #1533
  • Loading branch information
baconpaul authored Jan 30, 2020
1 parent 3428971 commit 087a3eb
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/common/SurgePatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ SurgePatch::SurgePatch(SurgeStorage* storage)
{
char label[16];
sprintf(label, "p%i", p);
char dawlabel[32];
sprintf(dawlabel, "param %i", p);
param_ptr.push_back(
this->fx[fx].p[p].assign(p_id++, 0, label, "param", ct_none, px, py, 0, cg_FX, fx,
this->fx[fx].p[p].assign(p_id++, 0, label, dawlabel, ct_none, px, py, 0, cg_FX, fx,
true, Surge::ParamConfig::kHorizontal | kHide | ((fx == 0) ? kEasy : 0)));
py += 20;
}
Expand Down
8 changes: 7 additions & 1 deletion src/common/SurgeSynthesizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1674,7 +1674,9 @@ bool SurgeSynthesizer::isBipolarModulation(modsources tms)
// FIX - this will break in S++
if( tms >= ms_lfo1 && tms <= ms_slfo6 )
{
bool isup = storage.getPatch().scene[scene_ms].lfo[tms-ms_lfo1].unipolar.val.i;
bool isup = storage.getPatch().scene[scene_ms].lfo[tms-ms_lfo1].unipolar.val.i ||
storage.getPatch().scene[scene_ms].lfo[tms-ms_lfo1].shape.val.i == ls_constant1;

// For now
return !isup;
}
Expand All @@ -1687,6 +1689,10 @@ bool SurgeSynthesizer::isBipolarModulation(modsources tms)
else
return false;
}
if( tms == ms_keytrack )
{
return true;
}
else
{
return false;
Expand Down
26 changes: 26 additions & 0 deletions src/common/Tunings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,3 +406,29 @@ R"HTML(
return htmls.str();

}

Surge::Storage::KeyboardMapping Surge::Storage::KeyboardMapping::tuneA69To(double freq)
{
// There's a couple of ways to do this but since I want it to stream I will syntheitcally create
// a KBM file
std::ostringstream oss;
oss << R"KBM(! Surge Synthetic Keyboard Tuning to Retune A69
!
! Map Size
0
! First note
0
! Last note
127
! First mapping
60
! Reference Note
69
! Reference Freqency
)KBM" << freq << R"KBM(
! Scale Degree
0
! Mapping)KBM";
std::cout << oss.str() << std::endl;;
return parseKBMData( oss.str() );
}
2 changes: 2 additions & 0 deletions src/common/Tunings.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ struct KeyboardMapping
keys.push_back(i);
}

static KeyboardMapping tuneA69To(double freq);

// TODO
// std::string toHtml();
};
Expand Down
9 changes: 9 additions & 0 deletions src/common/gui/CLFOGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "CLFOGui.h"
#include "LfoModulationSource.h"
#include "UserDefaults.h"
#include "SurgeGUIEditor.h"
#include <chrono>

using namespace VSTGUI;
Expand Down Expand Up @@ -997,6 +998,14 @@ CMouseEventResult CLFOGui::onMouseMoved(CPoint& where, const CButtonState& butto
{
lfodata->shape.val.i = i;
invalid();

// This is such a hack
auto sge = dynamic_cast<SurgeGUIEditor *>(listener);
if( sge )
{
sge->refresh_mod();
}

}
}
}
Expand Down
25 changes: 24 additions & 1 deletion src/common/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2862,7 +2862,7 @@ void SurgeGUIEditor::valueChanged(CControl* control)
modulate = true;
}

if( p->ctrltype == ct_bool_unipolar )
if( p->ctrltype == ct_bool_unipolar || p->ctrltype == ct_lfoshape )
{
// The green line might change so...
refresh_mod();
Expand Down Expand Up @@ -3645,6 +3645,29 @@ VSTGUI::COptionMenu *SurgeGUIEditor::makeTuningMenu(VSTGUI::CRect &menuRect)
);
tid++;

addCallbackMenu( tuningSubMenu, "ReMap A4 (midi #69) frequency directly to...",
[this]()
{
char c[256];
snprintf(c, 256, "440.0");
spawn_miniedit_text(c, 16);
float freq = ::atof(c);
if( freq == 440.0 )
{
this->synth->storage.remapToStandardKeyboard();
}
else
{
auto kb = Surge::Storage::KeyboardMapping::tuneA69To(freq);
if( ! this->synth->storage.remapToKeyboard(kb) )
{
Surge::UserInteractions::promptError( "This .kbm file is not valid", "File format error" );
return;
}
}
}
);

tuningSubMenu->addSeparator();
tid++;
auto *sct = addCallbackMenu(tuningSubMenu, "Show current tuning",
Expand Down
1 change: 1 addition & 0 deletions src/common/gui/SurgeGUIEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class SurgeGUIEditor : public EditorType, public VSTGUI::IControlListener, publi
void controlBeginEdit(VSTGUI::CControl* pControl) override;
void controlEndEdit(VSTGUI::CControl* pControl) override;

public:
void refresh_mod();

#if TARGET_VST3
Expand Down

0 comments on commit 087a3eb

Please sign in to comment.