GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add pitchmap key, scale and mode presets for v0.2.4 · hexamorphical/hypercut@be1c654

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • CHANGELOG.md
  • plugins/LiveCut
    • DistrhoPluginInfo.h
    • LiveCut.cpp
    • LiveCutControls.hpp
    • LiveCutUI.cpp
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎CHANGELOG.md‎

Copy file name to clipboardExpand all lines: CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## v0.2.4
4+
5+
- **Pitchmap key presets.** The spectral pitchmap now uses three dropdowns — **KEY**, **SCALE** (Major, Melodic Minor,
6+
Pentatonic, Custom) and **MODE**. Major offers Ionian through Locrian. Melodic Minor offers Melodic Minor, Dorian #2,
7+
Lydian Augmented, Lydian Dominant, Mixo b6, Locrian #2, Altered and Phrygian Dominant. MODE is disabled for
8+
Pentatonic and Custom. The piano editor is only shown for Custom scales, where clicking a key adds or removes that
9+
note. Existing sessions keep their scale and sound; the new custom-scale parameter is appended.
10+
311
## v0.2.3
412

513
- **Circular min/max knobs.** Every per-slice min/max range is now a rotary knob with a Serum-style modulation arc:
Collapse file

‎plugins/LiveCut/DistrhoPluginInfo.h‎

Copy file name to clipboardExpand all lines: plugins/LiveCut/DistrhoPluginInfo.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
// Release shown in the UI header. Packaging derives the installer version from the git tag;
4848
// getVersion() stays at the original LiveCut ABI version for session compatibility.
49-
#define HYPERCUT_DISPLAY_VERSION "0.2.3"
49+
#define HYPERCUT_DISPLAY_VERSION "0.2.4"
5050

5151
#define DISTRHO_PLUGIN_IS_RT_SAFE 0
5252
#define DISTRHO_PLUGIN_NUM_INPUTS 2
Collapse file

‎plugins/LiveCut/LiveCut.cpp‎

Copy file name to clipboardExpand all lines: plugins/LiveCut/LiveCut.cpp
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ class HyperCut : public Plugin
533533
setEnum(parameter, labels, LVC_NUM_SCALES);
534534
break;
535535
}
536+
case LVC_CHCUSTOM:
537+
// twelve pitch classes of the Custom scale (bit i = LVC_CHKEY + i), edited from the piano keyboard
538+
parameter.name = "Pitchmap Custom Scale"; parameter.hints |= kParameterIsInteger;
539+
break;
536540
case LVC_CHCOLOR: parameter.name = "Pitchmap Color"; break;
537541
case LVC_CHPITCH:
538542
parameter.name = "Pitchmap Pitch"; parameter.unit = "st";
@@ -950,7 +954,8 @@ class HyperCut : public Plugin
950954
midiLatched = 0; // start from the key / scale until notes arrive
951955
midiModeWas = midi;
952956
// MIDI mode: the pitch classes of the held notes; after release the last chord stays (latched)
953-
const uint16_t mask = (midi && midiLatched != 0) ? midiLatched : lvcScalePitchClasses(scale, key);
957+
const uint16_t custom = static_cast<uint16_t>(control[LVC_CHCUSTOM]) & 0x0FFF;
958+
const uint16_t mask = (midi && midiLatched != 0) ? midiLatched : lvcScalePitchClasses(scale, key, custom);
954959
chroma.setPitchClasses(mask);
955960
chroma.setColor(control[LVC_CHCOLOR]);
956961
chroma.setPitch(std::round(control[LVC_CHPITCH]));
Collapse file

‎plugins/LiveCut/LiveCutControls.hpp‎

Copy file name to clipboardExpand all lines: plugins/LiveCut/LiveCutControls.hpp
+95-7Lines changed: 95 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ enum LiveCutControls{
189189
LVC_FILTERDRIVE = 145, // filter input saturation, 0 = clean
190190
LVC_CRUSHMIX = 146, // crusher dry / wet (1 = fully crushed)
191191
LVC_CRUSHLP = 147, // crusher post lowpass, Hz (20000 = bypassed)
192-
LVC_CONTROL_NR = 148
192+
// Appended so existing sessions keep their parameter ids. Bit i = the note i semitones above LVC_CHKEY.
193+
LVC_CHCUSTOM = 148, // custom pitch classes of the pitchmap scale (used when LVC_CHSCALE = Custom)
194+
LVC_CONTROL_NR = 149
193195
};
194196

195197
static const std::array<std::pair<float, float>, LVC_CONTROL_NR> controlLimits =
@@ -261,7 +263,7 @@ static const std::array<std::pair<float, float>, LVC_CONTROL_NR> controlLimits =
261263
{0.0f, 1.0f}, // LVC_CHROMA
262264
{0.0f, 5.0f}, // LVC_CHPOS
263265
{0.0f, 11.0f}, // LVC_CHKEY
264-
{0.0f, 23.0f}, // LVC_CHSCALE (LVC_NUM_SCALES - 1)
266+
{0.0f, 30.0f}, // LVC_CHSCALE (LVC_NUM_SCALES - 1)
265267
{0.0f, 2.0f}, // LVC_CHCOLOR
266268
{-24.0f, 24.0f}, // LVC_CHPITCH (semitones)
267269
{-50.0f, 50.0f}, // LVC_CHTUNE (cents)
@@ -341,7 +343,8 @@ static const std::array<std::pair<float, float>, LVC_CONTROL_NR> controlLimits =
341343
{0.0f, 1.0f}, // LVC_DLYROUTE
342344
{0.0f, 1.0f}, // LVC_FILTERDRIVE
343345
{0.0f, 1.0f}, // LVC_CRUSHMIX
344-
{20.0f, 20000.0f} // LVC_CRUSHLP
346+
{20.0f, 20000.0f}, // LVC_CRUSHLP
347+
{0.0f, 4095.0f} // LVC_CHCUSTOM (12 pitch classes)
345348
}};
346349

347350
static const float LVC_DEFAULTS[LVC_CONTROL_NR] = {
@@ -493,6 +496,7 @@ static const float LVC_DEFAULTS[LVC_CONTROL_NR] = {
493496
0.0f, // LVC_FILTERDRIVE (clean: old sessions sound the same)
494497
1.0f, // LVC_CRUSHMIX (fully wet: old sessions sound the same)
495498
20000.0f, // LVC_CRUSHLP (open: old sessions sound the same)
499+
2741.0f, // LVC_CHCUSTOM (C major: 0x0AB5, used when Custom is selected)
496500
};
497501

498502
// Parameter symbols (stable identifiers used by hosts, sessions and preset files). Never reorder or rename.
@@ -645,6 +649,7 @@ static const char* const LVC_SYMBOLS[LVC_CONTROL_NR] = {
645649
"livecut_filterdrive",
646650
"livecut_crushmix",
647651
"livecut_crushlp",
652+
"livecut_chcustom",
648653
};
649654

650655
// Chroma scales: bit i set = the note i semitones above the root belongs to the scale.
@@ -681,18 +686,101 @@ static const LvcScale LVC_SCALES[] = {
681686
{ "Fifths", lvcMask({0, 7}), -1, 0 },
682687
{ "Root Only", lvcMask({0}), -1, 0 },
683688
{ "Chromatic", 0x0FFF, -1, 0 },
689+
// Modes of melodic minor (appended: old sessions keep their indices)
690+
{ "Dorian #2", lvcMask({0, 1, 3, 5, 7, 9, 10}), -1, 0 }, // 24
691+
{ "Lydian Augmented", lvcMask({0, 2, 4, 6, 8, 9, 11}), -1, 0 }, // 25
692+
{ "Lydian Dominant", lvcMask({0, 2, 4, 6, 7, 9, 10}), -1, 0 }, // 26
693+
{ "Mixo b6", lvcMask({0, 2, 4, 5, 7, 8, 10}), -1, 0 }, // 27
694+
{ "Locrian #2", lvcMask({0, 2, 3, 5, 6, 8, 10}), -1, 0 }, // 28
695+
{ "Altered", lvcMask({0, 1, 3, 4, 6, 8, 10}), -1, 0 }, // 29
696+
{ "Custom", 0, -1, 0 }, // 30: mask comes from LVC_CHCUSTOM
684697
};
685698
static constexpr int LVC_NUM_SCALES = static_cast<int>(sizeof(LVC_SCALES) / sizeof(LVC_SCALES[0]));
686-
static_assert(LVC_NUM_SCALES == 24, "LVC_CHSCALE range must match the scale table");
699+
static constexpr int kLvcCustomScale = 30;
700+
static_assert(LVC_NUM_SCALES == 31, "LVC_CHSCALE range must match the scale table");
701+
static_assert(kLvcCustomScale == LVC_NUM_SCALES - 1, "Custom must be the last scale");
687702

688703
static const char* const LVC_KEY_NAMES[12] = { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" };
689704

705+
// The pitchmap's three preset dropdowns. LVC_CHSCALE stays the single source of truth, so sessions saved before
706+
// the dropdowns existed keep selecting exactly the same scale. The mode groups below map the new UI onto those
707+
// indices; scales from older sessions that are not part of a group are shown as Custom (their sound is unchanged).
708+
enum LvcScaleFamily { kLvcMajor = 0, kLvcMelodicMinor, kLvcPentatonic, kLvcCustomFamily, kLvcFamilyCount };
709+
710+
static const char* const LVC_FAMILY_NAMES[kLvcFamilyCount] = { "Major", "Melodic Minor", "Pentatonic", "Custom" };
711+
712+
static const char* const LVC_MAJOR_MODES[] = { "Ionian", "Dorian", "Phrygian", "Lydian", "Mixolydian", "Aeolian", "Locrian" };
713+
static const int LVC_MAJOR_MODE_SCALES[] = { 0, 4, 5, 6, 7, 1, 8 };
714+
715+
static const char* const LVC_MM_MODES[] = { "Melodic Minor", "Dorian #2", "Lydian Augmented", "Lydian Dominant",
716+
"Mixo b6", "Locrian #2", "Altered", "Phrygian Dominant" };
717+
static const int LVC_MM_MODE_SCALES[] = { 3, 24, 25, 26, 27, 28, 29, 12 };
718+
719+
static const char* const LVC_PENTA_MODES[] = { "Pentatonic", "Minor Pentatonic" };
720+
static const int LVC_PENTA_MODE_SCALES[] = { 9, 10 };
721+
722+
static const char* const LVC_CUSTOM_MODES[] = { "Custom" };
723+
static const int LVC_CUSTOM_MODE_SCALES[] = { kLvcCustomScale };
724+
725+
struct LvcModeGroup { const char* name; const char* const* modes; const int* scales; int count; };
726+
static const LvcModeGroup LVC_MODE_GROUPS[kLvcFamilyCount] = {
727+
{ LVC_FAMILY_NAMES[0], LVC_MAJOR_MODES, LVC_MAJOR_MODE_SCALES,
728+
static_cast<int>(sizeof(LVC_MAJOR_MODE_SCALES) / sizeof(LVC_MAJOR_MODE_SCALES[0])) },
729+
{ LVC_FAMILY_NAMES[1], LVC_MM_MODES, LVC_MM_MODE_SCALES,
730+
static_cast<int>(sizeof(LVC_MM_MODE_SCALES) / sizeof(LVC_MM_MODE_SCALES[0])) },
731+
{ LVC_FAMILY_NAMES[2], LVC_PENTA_MODES, LVC_PENTA_MODE_SCALES,
732+
static_cast<int>(sizeof(LVC_PENTA_MODE_SCALES) / sizeof(LVC_PENTA_MODE_SCALES[0])) },
733+
{ LVC_FAMILY_NAMES[3], LVC_CUSTOM_MODES, LVC_CUSTOM_MODE_SCALES,
734+
static_cast<int>(sizeof(LVC_CUSTOM_MODE_SCALES) / sizeof(LVC_CUSTOM_MODE_SCALES[0])) },
735+
};
736+
737+
static inline int lvcClampScale(int scale)
738+
{
739+
return scale < 0 ? 0 : (scale >= LVC_NUM_SCALES ? LVC_NUM_SCALES - 1 : scale);
740+
}
741+
742+
static inline int lvcFamilyOfScale(int scale)
743+
{
744+
scale = lvcClampScale(scale);
745+
if (scale == kLvcCustomScale) return kLvcCustomFamily;
746+
for (int f = 0; f < kLvcFamilyCount - 1; ++f)
747+
for (int m = 0; m < LVC_MODE_GROUPS[f].count; ++m)
748+
if (LVC_MODE_GROUPS[f].scales[m] == scale) return f;
749+
return kLvcCustomFamily; // legacy scale outside the preset groups
750+
}
751+
752+
static inline int lvcModeOfScale(int scale)
753+
{
754+
const int f = lvcFamilyOfScale(scale);
755+
if (f == kLvcCustomFamily) return -1;
756+
scale = lvcClampScale(scale);
757+
for (int m = 0; m < LVC_MODE_GROUPS[f].count; ++m)
758+
if (LVC_MODE_GROUPS[f].scales[m] == scale) return m;
759+
return -1;
760+
}
761+
762+
static inline int lvcScaleForMode(int family, int mode)
763+
{
764+
family = family < 0 ? 0 : (family >= kLvcFamilyCount ? kLvcFamilyCount - 1 : family);
765+
const LvcModeGroup& g = LVC_MODE_GROUPS[family];
766+
mode = mode < 0 ? 0 : (mode >= g.count ? g.count - 1 : mode);
767+
return g.scales[mode];
768+
}
769+
770+
// Name shown in the MODE field and the pitchmap chip, including legacy custom scales.
771+
static inline const char* lvcModeLabel(int scale)
772+
{
773+
const int m = lvcModeOfScale(scale);
774+
if (m >= 0) return LVC_MODE_GROUPS[lvcFamilyOfScale(scale)].modes[m];
775+
return LVC_SCALES[lvcClampScale(scale)].name;
776+
}
777+
690778
// absolute pitch classes (bit 0 = C) of a scale on a root
691-
static inline uint16_t lvcScalePitchClasses(int scale, int root)
779+
static inline uint16_t lvcScalePitchClasses(int scale, int root, uint16_t customMask = 0)
692780
{
693-
scale = scale < 0 ? 0 : (scale >= LVC_NUM_SCALES ? LVC_NUM_SCALES - 1 : scale);
781+
scale = lvcClampScale(scale);
694782
root = ((root % 12) + 12) % 12;
695-
const uint32_t m = LVC_SCALES[scale].mask;
783+
const uint32_t m = scale == kLvcCustomScale ? (customMask & 0x0FFF) : LVC_SCALES[scale].mask;
696784
return static_cast<uint16_t>(((m << root) | (m >> (12 - root))) & 0x0FFF);
697785
}
698786

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.