Skip to content

Commit

Permalink
Merge pull request surge-synthesizer#1 from surge-synthesizer/main
Browse files Browse the repository at this point in the history
add commits with sst effects interface changes
  • Loading branch information
morganholly authored May 12, 2023
2 parents 1808c4f + 8a80f23 commit b0a8903
Show file tree
Hide file tree
Showing 24 changed files with 463 additions and 448 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if(NOT BUILD_TESTING)
option(BUILD_TESTING "" OFF)
endif()

project(Surge VERSION 1.2.1 LANGUAGES C CXX ASM)
project(Surge VERSION 1.3.0 LANGUAGES C CXX ASM)

# Banner {{{
message(STATUS "It's Surge XT, folks! Version is ${PROJECT_VERSION}")
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ trigger:

pr:
- main
- xt-alpha
- release-xt/*

jobs:
- job: BuildCodeQuality
Expand Down
18 changes: 16 additions & 2 deletions src/common/Parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "Tunings.h"
#include "fmt/core.h"
#include "UnitConversions.h"
#include "sst/basic-blocks/params/ParamMetadata.h"

Parameter::Parameter()
{
Expand Down Expand Up @@ -2355,8 +2356,14 @@ void Parameter::get_display_of_modulation_depth(char *txt, float modulationDepth

if (basicBlocksParamMetaData.has_value() && basicBlocksParamMetaData->supportsStringConversion)
{
auto fs = sst::basic_blocks::params::ParamMetaData::FeatureState()
.withHighPrecision(detailedMode)
.withTemposync(can_temposync() && temposync)
.withAbsolute(can_be_absolute() && absolute)
.withExtended(can_extend_range() && extend_range);

auto res = basicBlocksParamMetaData->modulationNaturalToString(val.f, modulationDepth,
isBipolar, detailedMode);
isBipolar, fs);
if (res.has_value())
{
#if DEBUG_MOD_STRINGS
Expand Down Expand Up @@ -3316,7 +3323,14 @@ std::string Parameter::get_display(bool external, float ef) const
bbf = val.b ? 1.f : 0.f;
if (external)
bbf = basicBlocksParamMetaData->normalized01ToNatural(ef);
auto tryFormat = basicBlocksParamMetaData->valueToString(bbf, detailedMode);

auto fs = sst::basic_blocks::params::ParamMetaData::FeatureState()
.withHighPrecision(detailedMode)
.withTemposync(can_temposync() && temposync)
.withAbsolute(can_be_absolute() && absolute)
.withExtended(can_extend_range() && extend_range);

auto tryFormat = basicBlocksParamMetaData->valueToString(bbf, fs);
if (tryFormat.has_value())
return *tryFormat;
}
Expand Down
26 changes: 13 additions & 13 deletions src/common/SurgePatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,79 +555,79 @@ SurgePatch::SurgePatch(SurgeStorage *storage)
snprintf(label, LABEL_SIZE, "lfo%i_shape", l);
a->push_back(scene[sc].lfo[l].shape.assign(
p_id.next(), id_s++, label, "Type",
fmt::format("{:c}/{}{}/type", 'a' + sc, lt, lid), ct_lfotype,
fmt::format("{:c}/{}/{}/type", 'a' + sc, lt, lid), ct_lfotype,
Surge::Skin::LFO::shape, sc_id, cg_LFO, ms_lfo1 + l));

snprintf(label, LABEL_SIZE, "lfo%i_rate", l);
a->push_back(scene[sc].lfo[l].rate.assign(
p_id.next(), id_s++, label, "Rate",
fmt::format("{:c}/{}{}/rate", 'a' + sc, lt, lid), ct_lforate_deactivatable,
fmt::format("{:c}/{}/{}/rate", 'a' + sc, lt, lid), ct_lforate_deactivatable,
Surge::Skin::LFO::rate, sc_id, cg_LFO, ms_lfo1 + l, true, sceasy, false));

snprintf(label, LABEL_SIZE, "lfo%i_phase", l);
a->push_back(scene[sc].lfo[l].start_phase.assign(
p_id.next(), id_s++, label, "Phase / Shuffle",
fmt::format("{:c}/{}{}/phase", 'a' + sc, lt, lid), ct_lfophaseshuffle,
fmt::format("{:c}/{}/{}/phase", 'a' + sc, lt, lid), ct_lfophaseshuffle,
Surge::Skin::LFO::phase, sc_id, cg_LFO, ms_lfo1 + l, true));

snprintf(label, LABEL_SIZE, "lfo%i_magnitude", l);
a->push_back(scene[sc].lfo[l].magnitude.assign(
p_id.next(), id_s++, label, "Amplitude",
fmt::format("{:c}/{}{}/amplitude", 'a' + sc, lt, lid), ct_lfoamplitude,
fmt::format("{:c}/{}/{}/amplitude", 'a' + sc, lt, lid), ct_lfoamplitude,
Surge::Skin::LFO::amplitude, sc_id, cg_LFO, ms_lfo1 + l, true, sceasy));

snprintf(label, LABEL_SIZE, "lfo%i_deform", l);
a->push_back(scene[sc].lfo[l].deform.assign(
p_id.next(), id_s++, label, "Deform",
fmt::format("{:c}/{}{}/deform", 'a' + sc, lt, lid), ct_lfodeform,
fmt::format("{:c}/{}/{}/deform", 'a' + sc, lt, lid), ct_lfodeform,
Surge::Skin::LFO::deform, sc_id, cg_LFO, ms_lfo1 + l, true));

snprintf(label, LABEL_SIZE, "lfo%i_trigmode", l);
a->push_back(scene[sc].lfo[l].trigmode.assign(
p_id.next(), id_s++, label, "Trigger Mode",
fmt::format("{:c}/{}{}/trigger_mode", 'a' + sc, lt, lid), ct_lfotrigmode,
fmt::format("{:c}/{}/{}/trigger_mode", 'a' + sc, lt, lid), ct_lfotrigmode,
Surge::Skin::LFO::trigger_mode, sc_id, cg_LFO, ms_lfo1 + l, false, kNoPopup));

snprintf(label, LABEL_SIZE, "lfo%i_unipolar", l);
a->push_back(scene[sc].lfo[l].unipolar.assign(
p_id.next(), id_s++, label, "Unipolar",
fmt::format("{:c}/{}{}/unipolar", 'a' + sc, lt, lid), ct_bool_unipolar,
fmt::format("{:c}/{}/{}/unipolar", 'a' + sc, lt, lid), ct_bool_unipolar,
Surge::Skin::LFO::unipolar, sc_id, cg_LFO, ms_lfo1 + l, false));

snprintf(label, LABEL_SIZE, "lfo%i_delay", l);
a->push_back(scene[sc].lfo[l].delay.assign(
p_id.next(), id_s++, label, "Delay",
fmt::format("{:c}/{}{}/eg/delay", 'a' + sc, lt, lid), ct_envtime_deactivatable,
fmt::format("{:c}/{}/{}/eg/delay", 'a' + sc, lt, lid), ct_envtime_deactivatable,
Surge::Skin::LFO::delay, sc_id, cg_LFO, ms_lfo1 + l, true, kMini));

snprintf(label, LABEL_SIZE, "lfo%i_attack", l);
a->push_back(scene[sc].lfo[l].attack.assign(
p_id.next(), id_s++, label, "Attack",
fmt::format("{:c}/{}{}/eg/attack", 'a' + sc, lt, lid), ct_envtime,
fmt::format("{:c}/{}/{}/eg/attack", 'a' + sc, lt, lid), ct_envtime,
Surge::Skin::LFO::attack, sc_id, cg_LFO, ms_lfo1 + l, true, kMini));

snprintf(label, LABEL_SIZE, "lfo%i_hold", l);
a->push_back(scene[sc].lfo[l].hold.assign(
p_id.next(), id_s++, label, "Hold",
fmt::format("{:c}/{}{}/eg/hold", 'a' + sc, lt, lid), ct_envtime,
fmt::format("{:c}/{}/{}/eg/hold", 'a' + sc, lt, lid), ct_envtime,
Surge::Skin::LFO::hold, sc_id, cg_LFO, ms_lfo1 + l, true, kMini));

snprintf(label, LABEL_SIZE, "lfo%i_decay", l);
a->push_back(scene[sc].lfo[l].decay.assign(
p_id.next(), id_s++, label, "Decay",
fmt::format("{:c}/{}{}/eg/decay", 'a' + sc, lt, lid), ct_envtime,
fmt::format("{:c}/{}/{}/eg/decay", 'a' + sc, lt, lid), ct_envtime,
Surge::Skin::LFO::decay, sc_id, cg_LFO, ms_lfo1 + l, true, kMini));

snprintf(label, LABEL_SIZE, "lfo%i_sustain", l);
a->push_back(scene[sc].lfo[l].sustain.assign(
p_id.next(), id_s++, label, "Sustain",
fmt::format("{:c}/{}{}/eg/sustain", 'a' + sc, lt, lid), ct_percent,
fmt::format("{:c}/{}/{}/eg/sustain", 'a' + sc, lt, lid), ct_percent,
Surge::Skin::LFO::sustain, sc_id, cg_LFO, ms_lfo1 + l, true, kMini));

snprintf(label, LABEL_SIZE, "lfo%i_release", l);
a->push_back(scene[sc].lfo[l].release.assign(
p_id.next(), id_s++, label, "Release",
fmt::format("{:c}/{}{}/eg/release", 'a' + sc, lt, lid), ct_envtime_lfodecay,
fmt::format("{:c}/{}/{}/eg/release", 'a' + sc, lt, lid), ct_envtime_lfodecay,
Surge::Skin::LFO::release, sc_id, cg_LFO, ms_lfo1 + l, true, kMini));
}
}
Expand Down
30 changes: 30 additions & 0 deletions src/common/SurgeStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2269,6 +2269,36 @@ bool SurgeStorage::resetToCurrentScaleAndMapping()
return true;
}

void SurgeStorage::loadTuningFromSCL(const fs::path &p)
{
try
{
retuneToScale(Tunings::readSCLFile(p.u8string()));
}
catch (Tunings::TuningError &e)
{
retuneTo12TETScaleC261Mapping();
reportError(e.what(), "SCL Error");
}
if (onTuningChanged)
onTuningChanged();
}

void SurgeStorage::loadMappingFromKBM(const fs::path &p)
{
try
{
remapToKeyboard(Tunings::readKBMFile(p.u8string()));
}
catch (Tunings::TuningError &e)
{
remapToConcertCKeyboard();
reportError(e.what(), "KBM Error");
}
if (onTuningChanged)
onTuningChanged();
}

void SurgeStorage::setTuningApplicationMode(const TuningApplicationMode m)
{
tuningApplicationMode = m;
Expand Down
4 changes: 4 additions & 0 deletions src/common/SurgeStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,10 @@ class alignas(16) SurgeStorage
} hardclipMode = HARDCLIP_TO_18DBFS,
sceneHardclipMode[n_scenes] = {HARDCLIP_TO_18DBFS, HARDCLIP_TO_18DBFS};

void loadTuningFromSCL(const fs::path &p);
void loadMappingFromKBM(const fs::path &p);
std::function<void()> onTuningChanged{nullptr};

float note_to_pitch(float x);
float note_to_pitch_inv(float x);
float note_to_pitch_ignoring_tuning(float x);
Expand Down
Loading

0 comments on commit b0a8903

Please sign in to comment.