Skip to content

armgit / nota

Public Imported from GitHub
0

Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.

Fixed broken UI for some synths

Egor Khindikaynena0d883af2b02
diff --git a/DESIGN.md b/DESIGN.md
index a342a728..21320a39 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -199,7 +199,7 @@ now points at the new hue.
| Tab segment (`Seg`) in container (`SegGroup`) | 24 in 30 |
| Filter chip (`Chip`) | 20 |
| Switch | 18 × 10, knob 7, inset 1.5 |
-| Knob (`KnobSecondary` / `KnobRegular` / `KnobMain`) | 34 / 36 / 44 |
+| Knob (`KnobSecondary` / `KnobRegular` / `KnobMain`) | 34 / 36 / 44 · `KnobInline` 24 in a table row |
| Parameter cell (`ParamCell`) | 53 tall |
| Slider track | 3, handle 6 × 7 |
| Meter | 11 wide, 5 between channels |
@@ -291,7 +291,7 @@ Builders live in `DeviceCardKit`; controls in `Controls/`. Reuse before writing
| Control | Spec |
|---|---|
-| `Knob` | 52-grid: groove r21 stroke 5, 270° from −135°, cap r14, pointer 2.4 Brass Light. Sizes snap to 34 / 36 / 44. `IsModified`, `IsDim`, `ArcColor` for a modulation source. |
+| `Knob` | 52-grid: groove r21 stroke 5, 270° from −135°, cap r14, pointer 2.4 Brass Light. Sizes snap to 34 / 36 / 44; `Inline` pins 24 for a knob inside a table row. `IsModified`, `IsDim`, `ArcColor` for a modulation source. |
| `DeviceCardKit.KnobCell` | Knob → label 7/700 caps → value mono 7, no gap; 53 tall under a 34 knob. Label and value go Brass Light when modified or `emphasised`. |
| `SwitchTrack` / `DeviceCardKit.Switch` | 18 × 10, knob 7, inset 1.5; on = brass + panel-coloured knob right, off = Track off + Ink 5 knob left. Word to the right, caps 7 in a device, 11 in the shell. |
| `DeviceCardKit.Segments` | Sunken container; selected = solid brass with dark text. 9 px in a device, 11 in the shell (`ToggleButton.seg` in `Border.segmented`). |
@@ -430,6 +430,9 @@ Decisions taken while aligning the app, kept on purpose:
Division (8), Arp Rate (8) and Order (8), Aurora Warp (5) and Filter (5), Bass LFO wave (5),
Monolith Glide range (6), Pendulum Division (5) and Wave (5).
- **Wide instruments** — Bass, Physical (see § Device cards).
+- **Inline knobs (24)** inside table rows — the oscillator rows and ADSR strips of Consort,
+ Pentad and Monolith (and Monolith's unison pair), as the Consort and Pentad mockups draw
+ them; a 34 knob cannot fit those rows.
- **Preset picker in the device header.** The almanac allows only name, badge and bypass
there; switching presets is frequent enough to stay one click away.
- **Zoom 28 px per beat** by default, not a 16 px bar; the ruler labels every bar once a bar
diff --git a/src/managed/Nota.App/Controls/Knob.cs b/src/managed/Nota.App/Controls/Knob.cs
index 72533abe..2a292d0f 100644
--- a/src/managed/Nota.App/Controls/Knob.cs
+++ b/src/managed/Nota.App/Controls/Knob.cs
@@ -11,6 +11,8 @@
//
// A knob exists in exactly three sizes — 34 secondary · 36 regular · 44 main. Width and
// Height are coerced onto that scale, so a call site asking for 30 or 40 gets 34 or 44.
+// The one exception is an `Inline` knob (24) that sits inside a table row, where a
+// section knob cannot fit — the Consort / Pentad / Monolith oscillator rows and ADSR strips.
using System;
using Avalonia;
@@ -38,12 +40,12 @@ public sealed class Knob : Control
// The almanac draws the knob in a 52-unit box; everything scales from it.
private const double Grid = 52, GrooveR = 21, GrooveStroke = 5, CapR = 14, PointerW = 2.4, PointerLen = 12;
- public const double SizeSecondary = NotaSize.KnobSecondary, SizeRegular = NotaSize.KnobRegular, SizeMain = NotaSize.KnobMain;
+ public const double SizeSecondary = NotaSize.KnobSecondary, SizeRegular = NotaSize.KnobRegular, SizeMain = NotaSize.KnobMain, SizeInline = NotaSize.KnobInline;
static Knob()
{
- WidthProperty.OverrideMetadata<Knob>(new StyledPropertyMetadata<double>(double.NaN, coerce: (_, v) => Snap(v)));
- HeightProperty.OverrideMetadata<Knob>(new StyledPropertyMetadata<double>(double.NaN, coerce: (_, v) => Snap(v)));
+ WidthProperty.OverrideMetadata<Knob>(new StyledPropertyMetadata<double>(double.NaN, coerce: (o, v) => o is Knob { _inline: true } ? SizeInline : Snap(v)));
+ HeightProperty.OverrideMetadata<Knob>(new StyledPropertyMetadata<double>(double.NaN, coerce: (o, v) => o is Knob { _inline: true } ? SizeInline : Snap(v)));
}
/// <summary>Onto the three-size scale: up to 34 is secondary, under 40 regular, else main.</summary>
@@ -55,6 +57,10 @@ public sealed class Knob : Control
: ReferenceEquals(arc, NotaPalette.Rose) ? NotaPalette.RoseBright
: arc;
+ /// <summary>The 24 px table-row knob, outside the three-size scale (see the header).</summary>
+ public bool Inline { get => _inline; init { _inline = value; CoerceValue(WidthProperty); CoerceValue(HeightProperty); } }
+ private readonly bool _inline;
+
/// <summary>Brass value arc instead of neutral grey.</summary>
public bool Accent { get; init; }
diff --git a/src/managed/Nota.App/DeviceCards/InstrumentControls.cs b/src/managed/Nota.App/DeviceCards/InstrumentControls.cs
index c5b31485..0501b17c 100644
--- a/src/managed/Nota.App/DeviceCards/InstrumentControls.cs
+++ b/src/managed/Nota.App/DeviceCards/InstrumentControls.cs
@@ -23,7 +23,7 @@ internal static class InstrumentControls
// Same as InstKnob, but the value readout is formatted with <paramref name="fmt"/>
// (real units — ms / dB / kHz — instead of a bare percentage). The formatter is also
// handed to the live-follow tick so automation moves keep the units.
- internal static Control InstKnob(DeviceCardContext ctx, Dictionary<string, int> idx, string id, string name, Action sync, Func<float, string>? fmt, double knobSize = 38, double cellW = 58, IBrush? arc = null)
+ internal static Control InstKnob(DeviceCardContext ctx, Dictionary<string, int> idx, string id, string name, Action sync, Func<float, string>? fmt, double knobSize = 38, double cellW = 58, IBrush? arc = null, bool inline = false)
{
if (!idx.TryGetValue(id, out var i)) return new Panel();
var engine = ctx.Engine;
@@ -31,7 +31,7 @@ internal static class InstrumentControls
Func<float, string> f = fmt ?? Pct;
var value = new TextBlock { Text = f(engine.PluginParamGet(track, -1, i)), FontSize = 8, Foreground = TextPrimary };
value.BindResource(TextBlock.FontFamilyProperty, "Font.Mono");
- var knob = new Knob(engine.PluginParamGet(track, -1, i), 1.0) { Accent = true, ArcColor = arc, Default = engine.InstrumentParamDefault(track, i), Width = knobSize, Height = knobSize };
+ var knob = new Knob(engine.PluginParamGet(track, -1, i), 1.0) { Accent = true, ArcColor = arc, Default = engine.InstrumentParamDefault(track, i), Inline = inline, Width = knobSize, Height = knobSize };
int pi = i; string pid = id;
knob.ValueChanged += v => { engine.PluginParamSet(track, -1, pi, (float)v); value.Text = f((float)v); sync(); };
knob.GestureBegin += () => engine.BeginAutomationWrite(track, AutomationTarget.PluginParam, -1, -1, pid);
diff --git a/src/managed/Nota.App/DeviceCards/Instruments/ConsortInstrumentCard.cs b/src/managed/Nota.App/DeviceCards/Instruments/ConsortInstrumentCard.cs
index 53dad2cd..c9127feb 100644
--- a/src/managed/Nota.App/DeviceCards/Instruments/ConsortInstrumentCard.cs
+++ b/src/managed/Nota.App/DeviceCards/Instruments/ConsortInstrumentCard.cs
@@ -127,15 +127,15 @@ internal sealed class ConsortInstrumentCard : IInstrumentCard
static Control Right(Control c) { c.HorizontalAlignment = HorizontalAlignment.Right; return c; }
static Control Center(Control c) { c.HorizontalAlignment = HorizontalAlignment.Center; return c; }
- Control K(string id, string name, Func<float, string> fmt, bool mod = false, double sz = 28, double cw = 44)
- => InstrumentControls.InstKnob(ctx, idx, id, name, Refresh, fmt, sz, cw, mod ? TealC : null);
+ Control K(string id, string name, Func<float, string> fmt, bool mod = false, double sz = Knob.SizeSecondary, double cw = 44, bool inline = false)
+ => InstrumentControls.InstKnob(ctx, idx, id, name, Refresh, fmt, sz, cw, mod ? TealC : null, inline);
- // A compact horizontal knob: [knob] value — for the oscillator table.
- Control MiniKnob(string id, Func<float, string> fmt, double size, double valW, IBrush valColor)
+ // A compact horizontal knob: [inline knob] value — for the oscillator table.
+ Control MiniKnob(string id, Func<float, string> fmt, double valW, IBrush valColor)
{
if (I(id) is not (var i and >= 0)) return new Panel();
var value = MonoText(fmt(G(id)), 8, valColor); value.Width = valW;
- var knob = new Knob(G(id), 1.0) { Accent = true, Default = engine.InstrumentParamDefault(track, i), Width = size, Height = size };
+ var knob = new Knob(G(id), 1.0) { Accent = true, Inline = true, Default = engine.InstrumentParamDefault(track, i) };
knob.ValueChanged += v => { engine.PluginParamSet(track, -1, i, (float)v); value.Text = fmt((float)v); Refresh(); };
knob.GestureBegin += () => Begin(id);
knob.GestureEnd += () => End(id);
@@ -157,7 +157,7 @@ internal sealed class ConsortInstrumentCard : IInstrumentCard
Control Chips(string id, string[] names, float[]? values = null, double fs = 7, Func<bool>? dim = null)
{
var vals = values ?? BuildValues(names.Length);
- var seg = DeviceCardKit.Segments(names, () => DeviceCardKit.NearestExact(G(id), vals), iv => { SetP(id, vals[iv]); Refresh(); }, out var sync, dim: dim);
+ var seg = DeviceCardKit.Segments(names, () => DeviceCardKit.NearestExact(G(id), vals), iv => { SetP(id, vals[iv]); Refresh(); }, out var sync, dim: dim, padX: 4, fontSize: fs);
cur.Add(sync);
if (I(id) is var pi and >= 0) MidiLearn.Bind(seg, MidiTarget.PluginParam(track, -1, pi), id);
return seg;
@@ -394,8 +394,8 @@ internal sealed class ConsortInstrumentCard : IInstrumentCard
string p = $"o{n}";
var g = new Grid { ColumnDefinitions = new ColumnDefinitions(OscCols) };
g.Children.Add(Cell(Lbl(n.ToString(), 10, TxtC, FontWeight.SemiBold), 0, HorizontalAlignment.Left));
- g.Children.Add(Cell(MiniKnob($"{p}oct", Foot, 20, 26, AmberLit), 1, HorizontalAlignment.Left));
- g.Children.Add(n == 1 ? Cell(MonoText("master", 8, MutedC), 2, HorizontalAlignment.Left) : Cell(MiniKnob($"{p}freq", Freq, 20, 40, TxtC), 2, HorizontalAlignment.Left));
+ g.Children.Add(Cell(MiniKnob($"{p}oct", Foot, 22, AmberLit), 1, HorizontalAlignment.Left));
+ g.Children.Add(n == 1 ? Cell(MonoText("master", 8, MutedC), 2, HorizontalAlignment.Left) : Cell(MiniKnob($"{p}freq", Freq, 38, TxtC), 2, HorizontalAlignment.Left));
g.Children.Add(Cell(WaveSel($"{p}wave"), 3));
var jd = new ConsortJackDot(11);
ToolTip.SetTip(jd, $"Osc {n} pitch input (patch bay)");
@@ -449,10 +449,10 @@ internal sealed class ConsortInstrumentCard : IInstrumentCard
var graph = new Border { Background = Inset, BorderBrush = BorderIn, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control, Margin = new Thickness(0, 3, 0, 2), Child = curve };
var head = new DockPanel { Height = 12, LastChildFill = false, Children = { Docked(Caps("DUAL LADDER"), Avalonia.Controls.Dock.Left), Docked(MonoText("24\u2009dB/oct", 7, Txt2), Avalonia.Controls.Dock.Right) } };
var knobs = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,*,*") };
- knobs.Children.Add(K("cutoff", "CUTOFF", Cut, false, 28, 50));
- knobs.Children.Add(Col(K("reso", "RESO", v => Tenths(v), false, 28, 46), 1));
- knobs.Children.Add(Col(K("spacing", "SPACING", Space, false, 28, 50), 2));
- knobs.Children.Add(Col(K("fenvamt", "ENVELOPE", EnvAmt, true, 28, 46), 3));
+ knobs.Children.Add(K("cutoff", "CUTOFF", Cut, false, Knob.SizeSecondary, 50));
+ knobs.Children.Add(Col(K("reso", "RESO", v => Tenths(v), false, Knob.SizeSecondary, 46), 1));
+ knobs.Children.Add(Col(K("spacing", "SPACING", Space, false, Knob.SizeSecondary, 50), 2));
+ knobs.Children.Add(Col(K("fenvamt", "ENVELOPE", EnvAmt, true, Knob.SizeSecondary, 46), 3));
var j1 = new ConsortJackDot(11); var j2 = new ConsortJackDot(11);
ToolTip.SetTip(j1, "Filt 1 cutoff input"); ToolTip.SetTip(j2, "Filt 2 cutoff input");
cur.Add(() => { j1.Set(PatchedAt(false, 10)); j2.Set(PatchedAt(false, 11)); });
@@ -476,7 +476,7 @@ internal sealed class ConsortInstrumentCard : IInstrumentCard
head.Children.Add(Docked(Caps(title), Avalonia.Controls.Dock.Left));
head.Children.Add(Docked(times, Avalonia.Controls.Dock.Right));
var graph = new Border { Background = Inset, BorderBrush = BorderIn, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control, Child = curve };
- var knobs = Row(0, K(pre + "attack", "A", Atk, amp, 22, 27), K(pre + "decay", "D", Dec, amp, 22, 27), K(pre + "sustain", "S", v => Pct(v), amp, 22, 27), K(pre + "release", "R", Dec, amp, 22, 27));
+ var knobs = Row(0, K(pre + "attack", "A", Atk, amp, Knob.SizeInline, 30, true), K(pre + "decay", "D", Dec, amp, Knob.SizeInline, 30, true), K(pre + "sustain", "S", v => Pct(v), amp, Knob.SizeInline, 30, true), K(pre + "release", "R", Dec, amp, Knob.SizeInline, 30, true));
knobs.Margin = new Thickness(4, 0, 0, 0);
return new DockPanel { LastChildFill = true, Children = { Docked(head, Avalonia.Controls.Dock.Top), Docked(knobs, Avalonia.Controls.Dock.Right), graph } };
}
@@ -514,10 +514,10 @@ internal sealed class ConsortInstrumentCard : IInstrumentCard
cur.Add(() => { jo.Set(PatchedAt(true, 1)); jr.Set(PatchedAt(false, 1)); });
var head = new DockPanel { Height = 14, LastChildFill = false, Children = { Docked(Caps("LFO"), Avalonia.Controls.Dock.Left), Docked(Row(4, jo, jr), Avalonia.Controls.Dock.Right) } };
var knobs = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,*,*"), Margin = new Thickness(0, 4, 0, 0) };
- knobs.Children.Add(K("lforate", "RATE", LfoRate, true, 28, 44));
- knobs.Children.Add(Col(K("lfopitch", "PITCH", LfoCents, true, 28, 44), 1));
- knobs.Children.Add(Col(K("lfocut", "CUTOFF", v => Pct(v), true, 28, 44), 2));
- knobs.Children.Add(Col(K("lfopwm", "PWM", v => Pct(v), true, 28, 44), 3));
+ knobs.Children.Add(K("lforate", "RATE", LfoRate, true, Knob.SizeSecondary, 44));
+ knobs.Children.Add(Col(K("lfopitch", "PITCH", LfoCents, true, Knob.SizeSecondary, 44), 1));
+ knobs.Children.Add(Col(K("lfocut", "CUTOFF", v => Pct(v), true, Knob.SizeSecondary, 44), 2));
+ knobs.Children.Add(Col(K("lfopwm", "PWM", v => Pct(v), true, Knob.SizeSecondary, 44), 3));
// The switch word carries the synced division ("SYNC 1/4"), refreshed with the card.
var syncT = Switch("Sync", () => On("lfosync"), () => { SetP("lfosync", On("lfosync") ? 0f : 1f); Refresh(); }, out var syncPaint,
liveLabel: () => On("lfosync") ? $"Sync {SyncNames[Math.Clamp((int)Math.Round(G("lforate") * 13), 0, 13)]}" : "Sync");
@@ -543,7 +543,7 @@ internal sealed class ConsortInstrumentCard : IInstrumentCard
var title = (TextBlock)head.Children[0];
cur.Add(() => title.Text = On("dlydigital") ? "DELAY · DIGITAL" : "ANALOG DELAY · BBD");
var graph = new Border { Background = Inset, BorderBrush = BorderIn, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control, Margin = new Thickness(0, 2, 0, 3), Child = view };
- var knobs = Row(0, K("dlytime", "TIME", DlyMs, false, 28, 44), K("dlyspacing", "SPACING", DlySpc, false, 28, 44), K("dlyfb", "FEEDBACK", v => Pct(v), false, 28, 46), K("dlymix", "MIX", v => Pct(v), false, 28, 40));
+ var knobs = Row(0, K("dlytime", "TIME", DlyMs, false, Knob.SizeSecondary, 44), K("dlyspacing", "SPACING", DlySpc, false, Knob.SizeSecondary, 44), K("dlyfb", "FEEDBACK", v => Pct(v), false, Knob.SizeSecondary, 46), K("dlymix", "MIX", v => Pct(v), false, Knob.SizeSecondary, 40));
var opts = new StackPanel { Spacing = 6, VerticalAlignment = VerticalAlignment.Center, Children = { Chips("dlyping", new[] { "Ping", "Stereo" }, new[] { 1f, 0f }), Toggle("dlydigital", "Digital") } };
var bottom = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*") };
bottom.Children.Add(knobs); bottom.Children.Add(Col(Right(opts), 1));
@@ -635,12 +635,13 @@ internal sealed class ConsortInstrumentCard : IInstrumentCard
f.ShowAt(rateBox); e.Handled = true;
};
if (I("seqrate") is var ri and >= 0) MidiLearn.Bind(rateBox, MidiTarget.PluginParam(track, -1, ri), "seqrate");
- var bottom = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 11, Height = 20, Children = {
- Row(4, Caps("RATE"), rateBox),
- Row(4, Caps("SWING"), swingSl),
- Row(4, Caps("ORDER"), Chips("seqorder", new[] { "Fwd", "Back", "Rnd" })),
- Toggle("seqlatch", "Latch"),
- Row(4, Caps("CLK"), gateDot, clkDot) } };
+ var bottom = new DockPanel { LastChildFill = false, Height = 20, Children = {
+ Docked(Row(4, Caps("CLK"), gateDot, clkDot), Avalonia.Controls.Dock.Right),
+ Docked(new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10, Children = {
+ Row(4, Caps("RATE"), rateBox),
+ Row(4, Caps("SWING"), swingSl),
+ Row(4, Caps("ORDER"), Chips("seqorder", new[] { "Fwd", "Back", "Rnd" })),
+ Toggle("seqlatch", "Latch") } }, Avalonia.Controls.Dock.Left) } };
cur = saved;
return new DockPanel { LastChildFill = true, Margin = new Thickness(7, 3, 7, 2), Children = {
Docked(top, Avalonia.Controls.Dock.Top), Docked(grid, Avalonia.Controls.Dock.Top),
@@ -837,7 +838,7 @@ internal sealed class ConsortInstrumentCard : IInstrumentCard
var meters = Row(4, new StackPanel { Spacing = 2, Children = { meterL, Center(Lbl("L", 7, MutedC, FontWeight.Normal)) } },
new StackPanel { Spacing = 2, Children = { meterR, Center(Lbl("R", 7, MutedC, FontWeight.Normal)) } }, scale);
meters.VerticalAlignment = VerticalAlignment.Top;
- var top = Row(12, K("volume", "VOLUME", VolDb, false, 40, 56), meters);
+ var top = Row(12, K("volume", "VOLUME", VolDb, false, Knob.SizeMain, 56), meters);
var body = new DockPanel { LastChildFill = false, Children = {
Docked(top, Avalonia.Controls.Dock.Top),
Docked(Divider(new StackPanel { Spacing = 4, Children = {
diff --git a/src/managed/Nota.App/DeviceCards/Instruments/MonolithInstrumentCard.cs b/src/managed/Nota.App/DeviceCards/Instruments/MonolithInstrumentCard.cs
index b9590e78..b6cbda8f 100644
--- a/src/managed/Nota.App/DeviceCards/Instruments/MonolithInstrumentCard.cs
+++ b/src/managed/Nota.App/DeviceCards/Instruments/MonolithInstrumentCard.cs
@@ -76,8 +76,23 @@ internal sealed class MonolithInstrumentCard : IInstrumentCard
Control Row(double sp, params Control[] cs)
{ var s = new StackPanel { Orientation = Orientation.Horizontal, Spacing = sp, VerticalAlignment = VerticalAlignment.Center }; foreach (var c in cs) s.Children.Add(c); return s; }
- Control K(string id, string name, Func<float, string>? fmt = null, bool mod = false, double sz = 32, double cw = 46)
- => InstrumentControls.InstKnob(ctx, idx, id, name, Refresh, fmt, sz, cw, mod ? TealC : null);
+ Control K(string id, string name, Func<float, string>? fmt = null, bool mod = false, double sz = Knob.SizeSecondary, double cw = 46, bool inline = false)
+ => InstrumentControls.InstKnob(ctx, idx, id, name, Refresh, fmt, sz, cw, mod ? TealC : null, inline);
+
+ // A table-row knob: [inline knob] value, side by side — for the oscillator rows and unison.
+ Control RowKnob(string id, Func<float, string> fmt, double valW, bool mod = false)
+ {
+ if (I(id) is not (var i and >= 0)) return new Panel();
+ var value = new TextBlock { Text = fmt(G(id)), FontSize = 8, Foreground = TxtC, Width = valW, VerticalAlignment = VerticalAlignment.Center };
+ value.BindResource(TextBlock.FontFamilyProperty, "Font.Mono");
+ var knob = new Knob(G(id), 1.0) { Accent = true, Inline = true, ArcColor = mod ? TealC : null, Default = engine.InstrumentParamDefault(track, i) };
+ knob.ValueChanged += v => { engine.PluginParamSet(track, -1, i, (float)v); value.Text = fmt((float)v); Refresh(); };
+ knob.GestureBegin += () => engine.BeginAutomationWrite(track, AutomationTarget.PluginParam, -1, -1, id);
+ knob.GestureEnd += () => engine.EndAutomationWrite(track, AutomationTarget.PluginParam, -1, -1, id);
+ ctx.AddInstFader(i, knob, value, fmt);
+ MidiLearn.Bind(knob, MidiTarget.PluginParam(track, -1, i), id);
+ return Row(4, knob, value);
+ }
// On/off pill toggle backed by a param (>0.5 = on).
Control Toggle(string id, string label)
@@ -92,7 +107,7 @@ internal sealed class MonolithInstrumentCard : IInstrumentCard
Control Chips(string id, string[] names, double fs = 7)
{
int n = names.Length;
- var seg = DeviceCardKit.Segments(names, () => Sel(id, n), iv => { SetP(id, iv / (float)(n - 1)); Refresh(); }, out var sync);
+ var seg = DeviceCardKit.Segments(names, () => Sel(id, n), iv => { SetP(id, iv / (float)(n - 1)); Refresh(); }, out var sync, padX: n > 4 ? 3 : 5, fontSize: fs);
readouts.Add(sync);
if (I(id) is var pi and >= 0) MidiLearn.Bind(seg, MidiTarget.PluginParam(track, -1, pi), id);
return seg;
@@ -197,7 +212,7 @@ internal sealed class MonolithInstrumentCard : IInstrumentCard
T("glideon", "Glide", 0, 0); T("legato", "Legato", 0, 1);
T("decayon", "Decay", 1, 0); T("oscmodon", "Osc mod", 1, 1);
T("filtmodon", "Filter mod", 2, 0); T("osc3kbd", "Osc 3 kbd", 2, 1);
- var knobs = Row(6, K("tune", "TUNE", StFmt, false, 32, 40), K("glide", "GLIDE", GlideFmt, false, 32, 40), K("modmix", "MOD MIX", v => $"{v * 100:0}\u2009%", false, 32, 40));
+ var knobs = Row(6, K("tune", "TUNE", StFmt, false, Knob.SizeSecondary, 40), K("glide", "GLIDE", GlideFmt, false, Knob.SizeSecondary, 40), K("modmix", "MOD MIX", v => $"{v * 100:0}\u2009%", false, Knob.SizeSecondary, 40));
var strip = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*"), ColumnSpacing = 10, Height = 56 };
Grid.SetColumn((Control)knobs, 0); Grid.SetColumn(toggles, 1);
strip.Children.Add((Control)knobs); strip.Children.Add(toggles);
@@ -208,10 +223,10 @@ internal sealed class MonolithInstrumentCard : IInstrumentCard
string p = $"o{n}";
var g = new Grid { ColumnDefinitions = new ColumnDefinitions("14,50,54,*,40"), VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(4, 0) };
g.Children.Add(Cell(Lbl(n.ToString(), 10, TxtC, FontWeight.SemiBold), 0));
- g.Children.Add(Cell(K($"{p}range", "", v => Feet[Math.Clamp((int)Math.Round(v * 5), 0, 5)], false, 24, 46), 1));
+ g.Children.Add(Cell(RowKnob($"{p}range", v => Feet[Math.Clamp((int)Math.Round(v * 5), 0, 5)], 20), 1));
Control freq = n == 1
? new TextBlock { Text = "master", FontSize = 8, Foreground = MutedC, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }
- : K($"{p}tune", "", DetFmt, false, 24, 52);
+ : RowKnob($"{p}tune", DetFmt, 26);
g.Children.Add(Cell(freq, 2));
g.Children.Add(Cell(WaveChips($"{p}wave", n == 3), 3));
string modTxt = n == 3 ? "free" : "kbd";
@@ -219,7 +234,7 @@ internal sealed class MonolithInstrumentCard : IInstrumentCard
mt.BindResource(TextBlock.FontFamilyProperty, "Font.Mono");
if (n == 3) readouts.Add(() => mt.Text = G("osc3kbd") > 0.5f ? "kbd" : "free");
g.Children.Add(Cell(mt, 4));
- return new Border { BorderBrush = BorderIn, BorderThickness = new Thickness(0, 0, 0, n < 3 ? 1 : 0), Height = 44, Child = g };
+ return new Border { BorderBrush = BorderIn, BorderThickness = new Thickness(0, 0, 0, n < 3 ? 1 : 0), Height = 40, Child = g };
}
Control Cell(Control c, int col) { var w = new Panel { Children = { c } }; c.HorizontalAlignment = col == 4 ? HorizontalAlignment.Right : (col == 0 ? HorizontalAlignment.Left : HorizontalAlignment.Center); c.VerticalAlignment = VerticalAlignment.Center; Grid.SetColumn(w, col); return w; }
Control OscTab()
@@ -248,21 +263,21 @@ internal sealed class MonolithInstrumentCard : IInstrumentCard
var graph = new Border { Background = Inset, BorderBrush = BorderIn, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control, Child = filtCurve, Margin = new Thickness(0, 3, 0, 4) };
var knobs = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,*,Auto"), ColumnSpacing = 2, VerticalAlignment = VerticalAlignment.Bottom };
void C(Control c, int col) { Grid.SetColumn(c, col); knobs.Children.Add(c); }
- C(K("cutoff", "CUTOFF", HzFmt, false, 32, 44), 0);
- C(K("emph", "EMPHASIS", EmphFmt, false, 32, 40), 1);
- C(K("contour", "CONTOUR", v => $"{v * 100:0}\u2009%", true, 32, 44), 2);
+ C(K("cutoff", "CUTOFF", HzFmt, false, Knob.SizeSecondary, 44), 0);
+ C(K("emph", "EMPHASIS", EmphFmt, false, Knob.SizeSecondary, 48), 1);
+ C(K("contour", "CONTOUR", v => $"{v * 100:0}\u2009%", true, Knob.SizeSecondary, 44), 2);
var kbd = new StackPanel { Spacing = 2, VerticalAlignment = VerticalAlignment.Center, Children = {
new TextBlock { Text = "KBD CTRL", FontSize = 7, FontWeight = FontWeight.Bold, Foreground = MutedC },
Row(3, Toggle("kbd1", "1/3"), Toggle("kbd2", "2/3")) } };
C(kbd, 3);
var body = new DockPanel { LastChildFill = true, Children = { WithDock(Lbl("FILTER", 7, MutedC), Dock.Top), WithDock(knobs, Dock.Bottom), graph } };
- return new Border { Width = 210, BorderBrush = BorderIn, BorderThickness = new Thickness(0, 0, 1, 0), Padding = new Thickness(6, 4), Child = body };
+ return new Border { Width = 226, BorderBrush = BorderIn, BorderThickness = new Thickness(0, 0, 1, 0), Padding = new Thickness(6, 4), Child = body };
}
Control ContourPanel(string title, string route, MonolithEnvCurve curve, string pre, IBrush col)
{
curve.VerticalAlignment = VerticalAlignment.Stretch;
var graph = new Border { Background = Inset, BorderBrush = BorderIn, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control, Child = curve };
- var knobs = Row(1, K($"{pre}attack", "A", v => TimeFmt(0.001, 10, v), false, 26, 34), K($"{pre}decay", "D", v => TimeFmt(0.004, 20, v), false, 26, 34), K($"{pre}sustain", "S", v => $"{v * 100:0}\u2009%", false, 26, 34));
+ var knobs = Row(1, K($"{pre}attack", "A", v => TimeFmt(0.001, 10, v), false, Knob.SizeInline, 34, true), K($"{pre}decay", "D", v => TimeFmt(0.004, 20, v), false, Knob.SizeInline, 34, true), K($"{pre}sustain", "S", v => $"{v * 100:0}\u2009%", false, Knob.SizeInline, 34, true));
DockPanel.SetDock((Control)knobs, Dock.Right);
((Control)knobs).Margin = new Thickness(6, 0, 0, 0);
var head = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, Height = 11, Margin = new Thickness(0, 0, 0, 3), Children = { Lbl(title, 7, MutedC), new TextBlock { Text = route, FontSize = 7, Foreground = col, VerticalAlignment = VerticalAlignment.Center } } };
@@ -287,7 +302,7 @@ internal sealed class MonolithInstrumentCard : IInstrumentCard
// ======================================================================
Control MixRow(string onId, string lvlId, string name, IBrush? col = null)
{
- var g = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,36,*"), ColumnSpacing = 6, VerticalAlignment = VerticalAlignment.Center };
+ var g = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,42,*"), ColumnSpacing = 6, VerticalAlignment = VerticalAlignment.Center };
var tog = Toggle(onId, ""); Grid.SetColumn(tog, 0);
var lbl = new TextBlock { Text = name, FontSize = 7, FontWeight = FontWeight.Bold, Foreground = MutedC, VerticalAlignment = VerticalAlignment.Center }; Grid.SetColumn(lbl, 1);
var sl = HSlider(lvlId, "", v => $"{v * 10:0.0}", 0, 22, col); sl.HorizontalAlignment = HorizontalAlignment.Stretch; Grid.SetColumn(sl, 2);
@@ -313,13 +328,13 @@ internal sealed class MonolithInstrumentCard : IInstrumentCard
}
Control OutputTab()
{
- var vol = K("volume", "VOLUME", VolFmt, false, 44, 60);
+ var vol = K("volume", "VOLUME", VolFmt, false, Knob.SizeMain, 60);
var sp = new StackPanel { Spacing = 6, Margin = new Thickness(2, 2), Children = {
new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, Children = { vol } },
new Border { BorderBrush = BorderIn, BorderThickness = new Thickness(0, 1, 0, 0), Padding = new Thickness(0, 5, 0, 0), Child = new StackPanel { Spacing = 4, Children = {
Toggle("a440", "A-440 tone"), Toggle("basscomp", "Bass compensation") } } },
new Border { BorderBrush = BorderIn, BorderThickness = new Thickness(0, 1, 0, 0), Padding = new Thickness(0, 5, 0, 0), Child = new StackPanel { Spacing = 5, Children = {
- LblRow("UNISON", Row(4, K("unison", "", v => $"{1 + (int)Math.Round(v * 6)}", false, 24, 30), K("unidetune", "", v => $"{v * 50:0}c", true, 24, 34))),
+ LblRow("UNISON", Row(4, RowKnob("unison", v => $"{1 + (int)Math.Round(v * 6)}", 10), RowKnob("unidetune", v => $"{v * 50:0}\u2009c", 26, true))),
LblRow("PRIORITY", Chips("priority", new[] { "Low", "High", "Last" })),
LblRow("BEND", Chips("bendrange", new[] { "±2", "±4", "±5", "±7", "±9", "±12" })) } } } } };
return sp;
diff --git a/src/managed/Nota.App/DeviceCards/Instruments/PentadInstrumentCard.cs b/src/managed/Nota.App/DeviceCards/Instruments/PentadInstrumentCard.cs
index 0f3dde90..234c5633 100644
--- a/src/managed/Nota.App/DeviceCards/Instruments/PentadInstrumentCard.cs
+++ b/src/managed/Nota.App/DeviceCards/Instruments/PentadInstrumentCard.cs
@@ -124,8 +124,8 @@ internal sealed class PentadInstrumentCard : IInstrumentCard
static Control Col(Control c, int col) { Grid.SetColumn(c, col); return c; }
static Border Divider(Control child, double top = 5) => new() { BorderBrush = BorderIn, BorderThickness = new Thickness(0, 1, 0, 0), Padding = new Thickness(0, top, 0, 0), Child = child };
- Control K(string id, string name, Func<float, string> fmt, bool mod = false, double sz = 26, double cw = 40)
- => InstrumentControls.InstKnob(ctx, idx, id, name, Refresh, fmt, sz, cw, mod ? TealC : null);
+ Control K(string id, string name, Func<float, string> fmt, bool mod = false, double sz = Knob.SizeSecondary, double cw = 40, bool inline = false)
+ => InstrumentControls.InstKnob(ctx, idx, id, name, Refresh, fmt, sz, cw, mod ? TealC : null, inline);
// On/off pill toggle backed by a param (> 0.5 = on).
Control Toggle(string id, string label, List<Action>? into = null)
@@ -261,9 +261,9 @@ internal sealed class PentadInstrumentCard : IInstrumentCard
string p = "o" + o;
var g = new Grid { ColumnDefinitions = new ColumnDefinitions(OscCols) };
g.Children.Add(Cell(Lbl(isA ? "A" : "B", 10, TxtC, FontWeight.SemiBold), 0, HorizontalAlignment.Left));
- g.Children.Add(Cell(K($"{p}oct", "", v => Feet[Math.Clamp((int)Math.Round(v * 3), 0, 3)], false, 26, 40), 1));
- g.Children.Add(Cell(K($"{p}semi", "", v => { int s = (int)Math.Round((v - 0.5f) * 24); return s == 0 ? "0\u2009st" : $"{s:+0;−0}\u2009st"; }, false, 26, 40), 2));
- g.Children.Add(Cell(K($"{p}fine", "", v => { double c = (v - 0.5) * 100; return Math.Abs(c) < 0.5 ? "0\u2009c" : $"{c:+0;−0}\u2009c"; }, false, 26, 40), 3));
+ g.Children.Add(Cell(K($"{p}oct", "", v => Feet[Math.Clamp((int)Math.Round(v * 3), 0, 3)], false, Knob.SizeInline, 40, true), 1));
+ g.Children.Add(Cell(K($"{p}semi", "", v => { int s = (int)Math.Round((v - 0.5f) * 24); return s == 0 ? "0\u2009st" : $"{s:+0;−0}\u2009st"; }, false, Knob.SizeInline, 40, true), 2));
+ g.Children.Add(Cell(K($"{p}fine", "", v => { double c = (v - 0.5) * 100; return Math.Abs(c) < 0.5 ? "0\u2009c" : $"{c:+0;−0}\u2009c"; }, false, Knob.SizeInline, 40, true), 3));
var chips = isA ? Row(3, WaveChip("oasaw", 0), WaveChip("oapulse", 1)) : Row(3, WaveChip("obsaw", 0), WaveChip("obtri", 2), WaveChip("obpulse", 1));
var pw = HSlider($"{p}pw", v => Pct(v), 30, () => !On($"{p}pulse"));
pw.Width = 110;
@@ -284,7 +284,7 @@ internal sealed class PentadInstrumentCard : IInstrumentCard
hdr.Children.Add(Col(t, i));
}
// bottom row: glide · voice mode · voices
- var glide = Row(4, K("glide", "GLIDE", v => Glide(v), false, 26, 44), Chips("glidemode", new[] { "Off", "On", "Leg" }));
+ var glide = Row(4, K("glide", "GLIDE", v => Glide(v), false, Knob.SizeSecondary, 44), Chips("glidemode", new[] { "Off", "On", "Leg" }));
var mode = Row(6, Caps("MODE"), Chips("voicemode", new[] { "Poly", "Uni", "Mono" }));
var strip = new PentadVoiceStrip { Width = 84, Height = 14 }; voiceStrips.Add(strip);
var voices = Row(6, Caps("VOICES"), strip);
@@ -315,11 +315,12 @@ internal sealed class PentadInstrumentCard : IInstrumentCard
var graph = new Border { Background = Inset, BorderBrush = BorderIn, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control, Margin = new Thickness(0, 3, 0, 3), Child = filtCurve };
var keyPct = MonoText("", 7, Txt2);
readouts.Add(() => keyPct.Text = Pct(G("keytrk")));
- var key = new StackPanel { Spacing = 3, VerticalAlignment = VerticalAlignment.Center, Children = { Caps("KEYTRACK"), Chips("keytrk", new[] { "0", "½", "1" }), keyPct } };
+ keyPct.HorizontalAlignment = HorizontalAlignment.Center;
+ var key = new StackPanel { Spacing = 3, Margin = new Thickness(6, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center, Children = { Caps("KEYTRACK"), Chips("keytrk", new[] { "0", "½", "1" }), keyPct } };
var knobs = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,*,Auto") };
- knobs.Children.Add(K("cutoff", "CUTOFF", Cut, false, 32, 44));
- knobs.Children.Add(Col(K("reso", "RESO", v => Tenths(v), false, 32, 44), 1));
- knobs.Children.Add(Col(K("fenvamt", "ENVELOPE", v => Tenths(v), true, 32, 44), 2));
+ knobs.Children.Add(K("cutoff", "CUTOFF", Cut, false, Knob.SizeSecondary, 44));
+ knobs.Children.Add(Col(K("reso", "RESO", v => Tenths(v), false, Knob.SizeSecondary, 44), 1));
+ knobs.Children.Add(Col(K("fenvamt", "ENVELOPE", v => Tenths(v), true, Knob.SizeSecondary, 44), 2));
knobs.Children.Add(Col(key, 3));
var body = new DockPanel { LastChildFill = true, Children = { Docked(Caps("FILTER"), Avalonia.Controls.Dock.Top), Docked(knobs, Avalonia.Controls.Dock.Bottom), graph } };
return new Border { Width = 196, BorderBrush = BorderIn, BorderThickness = new Thickness(0, 0, 1, 0), Padding = new Thickness(7, 4), Child = body };
@@ -333,7 +334,7 @@ internal sealed class PentadInstrumentCard : IInstrumentCard
if (amp) head.Children.Add(Docked(Toggle("releaseon", "Release"), Avalonia.Controls.Dock.Right));
head.Children.Add(Docked(new Border { Margin = new Thickness(6, 0), Child = times }, Avalonia.Controls.Dock.Right));
var graph = new Border { Background = Inset, BorderBrush = BorderIn, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control, Child = curve };
- var knobs = Row(0, K(pre + "attack", "A", Atk, amp, 24, 29), K(pre + "decay", "D", Dec, amp, 24, 29), K(pre + "sustain", "S", v => Pct(v), amp, 24, 29), K(pre + "release", "R", Dec, amp, 24, 29));
+ var knobs = Row(0, K(pre + "attack", "A", Atk, amp, Knob.SizeInline, 30, true), K(pre + "decay", "D", Dec, amp, Knob.SizeInline, 30, true), K(pre + "sustain", "S", v => Pct(v), amp, Knob.SizeInline, 30, true), K(pre + "release", "R", Dec, amp, Knob.SizeInline, 30, true));
knobs.Margin = new Thickness(4, 0, 0, 0);
return new DockPanel { LastChildFill = true, Children = { Docked(head, Avalonia.Controls.Dock.Top), Docked(knobs, Avalonia.Controls.Dock.Right), graph } };
}
@@ -394,7 +395,7 @@ internal sealed class PentadInstrumentCard : IInstrumentCard
var lfoWaves = Row(2, WaveChip("lfotri", 2, 20, 14), WaveChip("lfosaw", 0, 20, 14), WaveChip("lfosquare", 3, 20, 14));
var lfo = new StackPanel { Spacing = 2, Children = {
Caps("LFO"),
- Row(4, K("lforate", "RATE", LfoRate, false, 28, 38), K("lfoamt", "AMOUNT", v => Pct(v), true, 28, 38),
+ Row(4, K("lforate", "RATE", LfoRate, false, Knob.SizeSecondary, 38), K("lfoamt", "AMOUNT", v => Pct(v), true, Knob.SizeSecondary, 38),
new StackPanel { Spacing = 3, VerticalAlignment = VerticalAlignment.Center, Children = { lfoWaves, Chips("lfosync", new[] { "Free", "Sync" }) } }) } };
// Wheel mod
var wmGrid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,*"), RowDefinitions = new RowDefinitions("Auto,Auto"), RowSpacing = 3, ColumnSpacing = 6 };
@@ -444,7 +445,7 @@ internal sealed class PentadInstrumentCard : IInstrumentCard
var meters = Row(4, new StackPanel { Spacing = 2, Children = { meterL, Center(Lbl("L", 7, MutedC, FontWeight.Normal)) } },
new StackPanel { Spacing = 2, Children = { meterR, Center(Lbl("R", 7, MutedC, FontWeight.Normal)) } }, scale);
meters.VerticalAlignment = VerticalAlignment.Top;
- var top = Row(10, K("volume", "VOLUME", VolDb, false, 40, 54), meters);
+ var top = Row(10, K("volume", "VOLUME", VolDb, false, Knob.SizeMain, 54), meters);
var bend = Row(6, new TextBlock { Text = "BEND", FontSize = 7, FontWeight = FontWeight.Bold, Foreground = MutedC, Width = 38, VerticalAlignment = VerticalAlignment.Center },
Chips("bendrange", new[] { "2", "5", "7", "12" }, new[] { 1 / 11f, 4 / 11f, 6 / 11f, 1f }), Lbl("st", 7, MutedC, FontWeight.Normal));
// Velocity → filter: a quick switch over the Velocity Filter amount (0 ↔ 50 %).
diff --git a/src/managed/Nota.App/Theme/NotaGeometry.cs b/src/managed/Nota.App/Theme/NotaGeometry.cs
index 27d9a78d..e39ce8fd 100644
--- a/src/managed/Nota.App/Theme/NotaGeometry.cs
+++ b/src/managed/Nota.App/Theme/NotaGeometry.cs
@@ -51,6 +51,7 @@ internal static class NotaSize
public const double KnobSecondary = 34;
public const double KnobRegular = 36;
public const double KnobMain = 44;
+ public const double KnobInline = 24; // a knob inside a table row (Consort oscillators, ADSR strip)
public const double ParamCell = 53; // knob 34 + label line 9 + value line 10
}
diff --git a/src/managed/Nota.App/Theme/NotaTheme.axaml b/src/managed/Nota.App/Theme/NotaTheme.axaml
index 11bcc38a..13bfa309 100644
--- a/src/managed/Nota.App/Theme/NotaTheme.axaml
+++ b/src/managed/Nota.App/Theme/NotaTheme.axaml
@@ -40,6 +40,7 @@
<sys:Double x:Key="Control.KnobSecondary">34</sys:Double>
<sys:Double x:Key="Control.KnobRegular">36</sys:Double>
<sys:Double x:Key="Control.KnobMain">44</sys:Double>
+ <sys:Double x:Key="Control.KnobInline">24</sys:Double>
<sys:Double x:Key="Control.ParamCell">53</sys:Double> <!-- knob 34 + label line 9 + value line 10 -->
<!-- Spacing. Inside a device everything moves in 2px units, in the shell in 4px. -->