Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
C# audioaudio-unitavaloniacpp20cross-platformdawdigital-audio-workstationdspjucelinux-audiomcp-servermidimusicmusic-productionpiano-rollplugin-hostsequencersynthesizervstvst3
(fix) Bars follow the time signature (#493)
Chris Laupama002b9feffb62
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 63bc519d..8fa4036f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -258,6 +258,11 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.returns, then the master.### Fixed+- **Bars follow the time signature** (#405): in 3/4, 5/4 or 7/4 the arrangement's bar lines+ and bar numbers, the clip editors' grids and rulers, the step grid, the transport's position+ readout, the clip and Session readouts and Export's range fields count the time signature's+ beats per bar, as the metronome does. Before, every view drew and counted 4/4 bars whatever+ the signature, so a 3/4 bar line fell in the middle of the second bar.- **Drawing a controller no longer changes the rest of the curve** (#169): a stroke in thepiano-roll controller lane replaces only the stretch you draw. A shaped curve on either sidekeeps its bend, and points recorded while the button is down are not replaced by the olderdiff --git a/src/managed/Nota.App/AudioClipEditorView.cs b/src/managed/Nota.App/AudioClipEditorView.csindex ad015846..c1846dc3 100644--- a/src/managed/Nota.App/AudioClipEditorView.cs+++ b/src/managed/Nota.App/AudioClipEditorView.cs@@ -710,7 +710,7 @@ public sealed class AudioClipEditorView : UserControlprivate static readonly IBrush ChipInkHot = NotaPalette.AccentBright;// Ruler 24, marker strip 22, then the wave.private const double RulerH = 24, StripH = 22, WaveTop = RulerH + StripH;- private const int BeatsPerBar = 4; // matches the props-rail bar.beat readouts+ private static int BeatsPerBar => Meter.BeatsPerBar; // the project's bars, as the props-rail readouts (#405)private IBrush _wave = NotaPalette.TrackBrushes[1];private float[]? _peaks, _rms;private int _count;diff --git a/src/managed/Nota.App/ClipEditorKit.cs b/src/managed/Nota.App/ClipEditorKit.csindex a0795de7..7c01e281 100644--- a/src/managed/Nota.App/ClipEditorKit.cs+++ b/src/managed/Nota.App/ClipEditorKit.cs@@ -367,21 +367,23 @@ internal static class ClipEditorKit// ---- positions --------------------------------------------------------- /// <summary>bar.beat.16th (4/4), 1-based: 11.1.1.</summary>+ /// <summary>bar.beat.16th, 1-based, in the project's bars (<see cref="Meter"/>): 11.1.1.</summary>public static string Position(double beat){- int bar = (int)Math.Floor(beat / 4) + 1, be = (int)Math.Floor(beat % 4) + 1, six = (int)Math.Round(beat % 1 * 4) + 1;+ int bpb = Meter.BeatsPerBar;+ int bar = (int)Math.Floor(beat / bpb) + 1, be = (int)Math.Floor(beat % bpb) + 1, six = (int)Math.Round(beat % 1 * 4) + 1;if (six > 4) { six = 1; be++; }- if (be > 4) { be = 1; bar++; }+ if (be > bpb) { be = 1; bar++; }return string.Format(NotaNum.Culture, "{0}.{1}.{2}", bar, be, six);}/// <summary>bars.beats.16ths as a duration (0-based): 2.0.0.</summary>public static string Duration(double beats){- int bars = (int)Math.Floor(beats / 4), be = (int)Math.Floor(beats % 4), six = (int)Math.Round(beats % 1 * 4);+ int bpb = Meter.BeatsPerBar;+ int bars = (int)Math.Floor(beats / bpb), be = (int)Math.Floor(beats % bpb), six = (int)Math.Round(beats % 1 * 4);if (six > 3) { six = 0; be++; }- if (be > 3) { be = 0; bars++; }+ if (be > bpb - 1) { be = 0; bars++; }return string.Format(NotaNum.Culture, "{0}.{1}.{2}", bars, be, six);}diff --git a/src/managed/Nota.App/ClipEditorView.cs b/src/managed/Nota.App/ClipEditorView.csindex 031bd0ec..3b465051 100644--- a/src/managed/Nota.App/ClipEditorView.cs+++ b/src/managed/Nota.App/ClipEditorView.cs@@ -147,6 +147,10 @@ public sealed class ClipEditorView : UserControlreturn button;}+ /// <summary>The bar length changed (#405): the inspector's Start / Length / selection+ /// read-outs re-count (the roll redraws itself from its BeatsPerBar).</summary>+ public void RecountBars(double startBeat) => _props.Recount(startBeat);+/// <summary>Follows a clip that was moved or resized in the arrangement while this editor/// stayed on screen. The roll's own length is pushed by <c>PianoRollView.SetNotes</c>/// (which also refreshes the inspector's LENGTH/LOOP); this carries the pieces thatdiff --git a/src/managed/Nota.App/ClipPropsView.cs b/src/managed/Nota.App/ClipPropsView.csindex 87478a55..33ddb8f6 100644--- a/src/managed/Nota.App/ClipPropsView.cs+++ b/src/managed/Nota.App/ClipPropsView.cs@@ -109,6 +109,13 @@ public sealed class ClipPropsView : UserControl/// left in the arrangement. LENGTH / LOOP follow the roll's own Changed event.</summary>public void SetStart(double startBeat) => _startText.Text = Position(startBeat);+ /// <summary>The bar length changed (#405): every bar.beat read-out re-counts.</summary>+ public void Recount(double startBeat)+ {+ SetStart(startBeat);+ OnRollChanged();+ }+private void OnRollChanged(){double len = _roll.ActiveLengthBeats; // the active clip's own length, several clips open or onediff --git a/src/managed/Nota.App/DrumPatternView.cs b/src/managed/Nota.App/DrumPatternView.csindex 788d3cdb..34780fe3 100644--- a/src/managed/Nota.App/DrumPatternView.cs+++ b/src/managed/Nota.App/DrumPatternView.cs@@ -28,7 +28,7 @@ namespace Nota.App;public sealed class DrumPatternView : UserControl{- private const int BeatsPerBar = 4; // as everywhere else in the app (transport, props rails)+ private static int BeatsPerBar => Meter.BeatsPerBar; // the project's bars, as everywhere else (#405)private const int MaxCells = 64; // steps drawn at once; a longer clip pages in windowsprivate const double NameW = 156;private const double RowH = 20;@@ -56,6 +56,8 @@ public sealed class DrumPatternView : UserControlprivate int _res = _resPersist;private int _steps, _winStart, _win;+ private int _builtBpb; // the bar length the ruler and bar shading were built with+ private int _heldNote = -1; // the pad name cell being auditioned, so a rebuild can release itprivate int _selRow = -1;private int _paint; // 0 = idle, 1 = painting hits in, 2 = painting them outprivate bool _dragging; // a paint / velocity gesture owns the grid@@ -107,7 +109,7 @@ public sealed class DrumPatternView : UserControl{if (_dragging) return; // mid drag: our own writes are already on screenvar pads = ScanPads();- if (StepCount() != _steps || !SamePads(pads)) { Rebuild(); return; }+ if (StepCount() != _steps || !SamePads(pads) || _builtBpb != BeatsPerBar) { Rebuild(); return; } // a new meter redraws the bar marksReadNotes();MapCells();StyleAll();@@ -226,10 +228,21 @@ public sealed class DrumPatternView : UserControl// ---- build ------------------------------------------------------------+ // A held pad's cell is thrown away by a rebuild (a new meter, pads or length) before its+ // release arrives, so the rebuild lets the note go itself.+ private void ReleaseHeld()+ {+ if (_heldNote < 0) return;+ _e.TrackNoteOff(TrackId, _heldNote);+ _heldNote = -1;+ }+private void Rebuild(){+ ReleaseHeld();_pads = ScanPads();_steps = StepCount();+ _builtBpb = BeatsPerBar;int pages = Math.Max(1, (_steps + MaxCells - 1) / MaxCells);_winStart = Math.Clamp(_winStart / MaxCells, 0, pages - 1) * MaxCells;_win = Math.Max(1, Math.Min(MaxCells, _steps - _winStart));@@ -397,10 +410,13 @@ public sealed class DrumPatternView : UserControl{e.Handled = true;SelectRow(r);+ ReleaseHeld();_e.TrackNoteOn(TrackId, pad.Note, 1.0f); // audition this rack only, as the pad grid does (#307)+ _heldNote = pad.Note;e.Pointer.Capture(cell);};- cell.PointerReleased += (_, e) => { _e.TrackNoteOff(TrackId, pad.Note); e.Pointer.Capture(null); };+ cell.PointerReleased += (_, e) => { ReleaseHeld(); e.Pointer.Capture(null); };+ cell.PointerCaptureLost += (_, _) => ReleaseHeld();_nameCells[r] = cell;_nameLabels[r] = name;return cell;diff --git a/src/managed/Nota.App/ExportWindow.cs b/src/managed/Nota.App/ExportWindow.csindex d36f16c8..c96ba7b6 100644--- a/src/managed/Nota.App/ExportWindow.cs+++ b/src/managed/Nota.App/ExportWindow.cs@@ -43,7 +43,9 @@ public sealed class ExportWindow : NotaWindowprivate static readonly int[] Rates = { 44100, 48000, 96000 };private static readonly string[] RateLabels = { "44 100", "48 000", "96 000" };private static readonly int[] Bitrates = { 320, 256, 192, 128 }; // MP3 CBR, best first- private const int BeatsPerBar = 4;+ // The project's bars (#405), read once: the range boxes keep their text while the dialog is+ // open, so a scene changing the signature meanwhile must not re-read them in another meter.+ private readonly int _bpb = Meter.BeatsPerBar;private readonly double _bpm;private double _startBeats, _rangeBeats; // the range: where it starts and how long it is@@ -212,7 +214,7 @@ public sealed class ExportWindow : NotaWindow// MP3 has no bit-depth target; Pcm24 keeps Depth well-formed for the request.var d = fmt == ExportFormat.Mp3 ? WavBitDepth.Pcm24: _depth.SelectedIndex switch { 0 => WavBitDepth.Pcm16, 2 => WavBitDepth.Float32, _ => WavBitDepth.Pcm24 };- double tailBeats = _tailOn ? BeatsPerBar : 0.0;+ double tailBeats = _tailOn ? _bpb : 0.0;bool dither = _dither && d == WavBitDepth.Pcm16; // only meaningful for 16-bit targetsint kbps = Bitrates[_quality.SelectedIndex < 0 ? 0 : _quality.SelectedIndex];Close(new ExportOptions(sr, d, tailBeats, _rangeBeats, _stems, _normalize, dither, fmt, kbps, _startBeats));@@ -287,10 +289,10 @@ public sealed class ExportWindow : NotaWindow}// bar.beat.sixteenth, 1-based, as the readout shows a position.- private static string BarBeatText(double beats)+ private string BarBeatText(double beats){- int bar = (int)Math.Floor(beats / BeatsPerBar) + 1;- double inBar = beats - (bar - 1) * BeatsPerBar;+ int bar = (int)Math.Floor(beats / _bpb) + 1;+ double inBar = beats - (bar - 1) * _bpb;int beat = (int)Math.Floor(inBar) + 1;int six = (int)Math.Floor((inBar - (beat - 1)) * 4 + 1e-9) + 1;return string.Format(NotaNum.Culture, "{0}.{1}.{2}", bar, beat, six);@@ -298,15 +300,15 @@ public sealed class ExportWindow : NotaWindow/// <summary>Reads a typed position — "5", "5.2" or "5.2.3" (bar, beat, sixteenth, all/// 1-based) — as beats from the song start; null when it isn't one.</summary>- internal static double? ParsePosition(string? text)+ internal double? ParsePosition(string? text){var parts = (text ?? "").Trim().Split('.');if (parts.Length > 3) return null;var n = new[] { 1, 1, 1 };for (int i = 0; i < parts.Length; i++)if (!int.TryParse(parts[i], NumberStyles.None, CultureInfo.InvariantCulture, out n[i]) || n[i] < 1) return null;- if (n[1] > BeatsPerBar || n[2] > 4) return null;- return (n[0] - 1) * BeatsPerBar + (n[1] - 1) + (n[2] - 1) / 4.0;+ if (n[1] > _bpb || n[2] > 4) return null;+ return (n[0] - 1) * _bpb + (n[1] - 1) + (n[2] - 1) / 4.0;}private TextBox PositionBox(double beats)@@ -323,7 +325,7 @@ public sealed class ExportWindow : NotaWindowprivate void RefreshEstimate(){if (_estimate is null) return;- double tail = _tailOn ? BeatsPerBar : 0;+ double tail = _tailOn ? _bpb : 0;double sec = _bpm > 0 ? (Math.Max(0, _rangeBeats) + tail) * 60.0 / _bpm : 0;int sr = Rates[_rate.SelectedIndex < 0 ? 1 : _rate.SelectedIndex];int bytesPerSample = _depth.SelectedIndex switch { 0 => 2, 2 => 4, _ => 3 };diff --git a/src/managed/Nota.App/MainWindow.Detail.cs b/src/managed/Nota.App/MainWindow.Detail.csindex eb100f81..8b610e1c 100644--- a/src/managed/Nota.App/MainWindow.Detail.cs+++ b/src/managed/Nota.App/MainWindow.Detail.cs@@ -855,6 +855,24 @@ public partial class MainWindowShowDetail(250, honorPersist: true);}+ // The time signature's numerator changed (typed, a project load, a launched scene): every+ // view that counts bars re-counts (#405). The roll takes its bar length as a property; the+ // audio editor, the step grid and the readouts read Meter as they draw, so a reload repaints+ // them.+ private void ApplyMeter(int numerator)+ {+ int was = Meter.BeatsPerBar;+ Meter.Set(numerator);+ int bpb = Meter.BeatsPerBar;+ if (bpb != was) _session?.Refresh(); // its slot lengths and inspector fields count bars+ if (Timeline.BeatsPerBar != bpb) Timeline.BeatsPerBar = bpb;+ _patternView?.Reload();+ _audioEditor?.Reload();+ if (_editorRoll is not { } roll) return;+ roll.BeatsPerBar = bpb;+ _clipEditor?.RecountBars(roll.ActiveClip.StartBeat); // its Start / Length read-outs+ }+// A clip was trimmed / stretched / moved in the arrangement. Both clip editors snapshot the// clip's geometry when they're built, so push the new start+length into whichever one is// open on that clip — otherwise the editor keeps drawing the pre-drag length until it'sdiff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.csindex ed16db19..8e9b763d 100644--- a/src/managed/Nota.App/MainWindow.axaml.cs+++ b/src/managed/Nota.App/MainWindow.axaml.cs@@ -281,13 +281,18 @@ public partial class MainWindow : Window// mid-drag, where the fader is the one driving.else if (e.PropertyName == nameof(vm.Transport.MasterVolume) && !masterVol.Dragging)masterVol.Value = vm.Transport.MasterVolume;- else if (e.PropertyName == nameof(vm.Transport.TimeSigNumerator)) tsNum.Value = vm.Transport.TimeSigNumerator;+ else if (e.PropertyName == nameof(vm.Transport.TimeSigNumerator))+ {+ tsNum.Value = vm.Transport.TimeSigNumerator;+ ApplyMeter(vm.Transport.TimeSigNumerator); // bar lines and bar numbers follow (#405)+ }else if (e.PropertyName == nameof(vm.Transport.TimeSigDenominator)) tsDen.Value = vm.Transport.TimeSigDenominator;else if (e.PropertyName == nameof(vm.Transport.KeyCode)) ShowProjectKey();// Every ruler reads in the read-out's unit, bars or time (#275).else if (e.PropertyName == nameof(vm.Transport.ShowTimeDisplay)) RulerDisplay.Set(vm.Transport.ShowTimeDisplay);};RulerDisplay.Set(vm.Transport.ShowTimeDisplay);+ ApplyMeter(vm.Transport.TimeSigNumerator);var cpuGreen = (IBrush?)NotaPalette.Success;var cpuAmber = (IBrush?)NotaPalette.Warning;diff --git a/src/managed/Nota.App/Meter.cs b/src/managed/Nota.App/Meter.csnew file mode 100644index 00000000..84595eaf--- /dev/null+++ b/src/managed/Nota.App/Meter.cs@@ -0,0 +1,31 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// The project's bar length for every view that counts bars (#405): the arrangement grid and+// ruler, the clip editors, the props-rail and Session readouts, Export's range fields. A bar is+// the time signature's numerator in beats — as the engine's metronome and count-in count it.+// App-wide like EditorGrids: MainWindow sets it from the transport's time signature (typed,+// loaded with a project, or set by a launched scene) and views read it as they draw.++using System;++namespace Nota.App;++public static class Meter+{+ private static int s_beatsPerBar = 4;++ /// <summary>Beats in one bar (the time signature's numerator, at least 1).</summary>+ public static int BeatsPerBar => s_beatsPerBar;++ /// <summary>Raised on the UI thread after the bar length changes.</summary>+ public static event Action? Changed;++ public static void Set(int numerator)+ {+ int n = Math.Clamp(numerator, 1, 32);+ if (n == s_beatsPerBar) return;+ s_beatsPerBar = n;+ Changed?.Invoke();+ }+}diff --git a/src/managed/Nota.App/SessionView.Inspector.cs b/src/managed/Nota.App/SessionView.Inspector.csindex 810d6999..24bd2b30 100644--- a/src/managed/Nota.App/SessionView.Inspector.cs+++ b/src/managed/Nota.App/SessionView.Inspector.cs@@ -30,13 +30,15 @@ public sealed partial class SessionView(SessionFollowAction.Any, Loc.T("session.inspector.any")), (SessionFollowAction.Other, Loc.T("common.other")), (SessionFollowAction.Stop, Loc.T("common.stop")),(SessionFollowAction.Jump, Loc.T("session.inspector.jump")),};- private static readonly (double Beats, string Label)[] LengthSteps =+ // The bar choices count the project's bars (#405), so "1 bar" in 3/4 is three beats.+ private static double Bars(double n) => n * Meter.BeatsPerBar;+ private static (double Beats, string Label)[] LengthSteps => new[]{- (1, Loc.T("session.inspector.1_beat")), (2, Loc.T("session.inspector.2_beats")), (4, Loc.T("common.1_bar")), (8, Loc.T("session.inspector.2_bars")), (16, Loc.T("session.inspector.4_bars")), (32, Loc.T("session.inspector.8_bars")), (64, Loc.T("session.inspector.16_bars")),+ (1.0, Loc.T("session.inspector.1_beat")), (2, Loc.T("session.inspector.2_beats")), (Bars(1), Loc.T("common.1_bar")), (Bars(2), Loc.T("session.inspector.2_bars")), (Bars(4), Loc.T("session.inspector.4_bars")), (Bars(8), Loc.T("session.inspector.8_bars")), (Bars(16), Loc.T("session.inspector.16_bars")),};- private static readonly (double Beats, string Label)[] FollowTimes =+ private static (double Beats, string Label)[] FollowTimes => new[]{- (0, Loc.T("session.inspector.one_pass")), (1, Loc.T("session.inspector.1_beat")), (2, Loc.T("session.inspector.2_beats")), (4, Loc.T("common.1_bar")), (8, Loc.T("session.inspector.2_bars")), (16, Loc.T("session.inspector.4_bars")), (32, Loc.T("session.inspector.8_bars")), (64, Loc.T("session.inspector.16_bars")),+ (0.0, Loc.T("session.inspector.one_pass")), (1, Loc.T("session.inspector.1_beat")), (2, Loc.T("session.inspector.2_beats")), (Bars(1), Loc.T("common.1_bar")), (Bars(2), Loc.T("session.inspector.2_bars")), (Bars(4), Loc.T("session.inspector.4_bars")), (Bars(8), Loc.T("session.inspector.8_bars")), (Bars(16), Loc.T("session.inspector.16_bars")),};private static readonly (int Num, int Den)[] Signatures = { (0, 0), (2, 4), (3, 4), (4, 4), (5, 4), (6, 8), (7, 8), (12, 8) };@@ -390,7 +392,7 @@ public sealed partial class SessionViewvar rows = new StackPanel { Spacing = 8 };string follow = p.Follow != 0 ? Loc.F("session.inspector.next_n", FormatLength(p.FollowBeats)) : Loc.T("common.off");var followItems = new List<(double, string)> { (0, Loc.T("common.off")) };- foreach (double bars in new[] { 1.0, 2, 4, 8, 16, 32 }) followItems.Add((bars * 4, Loc.F("session.inspector.next_after", FormatLength(bars * 4))));+ foreach (double bars in new[] { 1.0, 2, 4, 8, 16, 32 }) followItems.Add((Bars(bars), Loc.F("session.inspector.next_after", FormatLength(Bars(bars)))));rows.Children.Add(Row(Loc.T("session.inspector.follow_action"), Chip(follow, p.Follow != 0, a => Pick(a, followItems,b => p.Follow == 0 ? b == 0 : Math.Abs(b - p.FollowBeats) < 1e-6,b => Set(x => { x.Follow = b > 0 ? 1 : 0; if (b > 0) x.FollowBeats = b; return x; })))));diff --git a/src/managed/Nota.App/SessionView.cs b/src/managed/Nota.App/SessionView.csindex ee7ce760..a95ea23f 100644--- a/src/managed/Nota.App/SessionView.cs+++ b/src/managed/Nota.App/SessionView.cs@@ -732,16 +732,18 @@ public sealed partial class SessionView : UserControlinternal static string FormatLength(double beats){if (beats <= 0) return "";- if (Math.Abs(beats % 4) < 1e-6) { int n = (int)Math.Round(beats / 4); return Loc.Plural("session.bars", n); }- if (beats < 4) return BeatsText(beats);- return Loc.F("session.bars_n", (int)(beats / 4), NotaNum.Str(beats % 4, "0.##"));+ int bpb = Meter.BeatsPerBar;+ if (Math.Abs(beats % bpb) < 1e-6) { int n = (int)Math.Round(beats / bpb); return Loc.Plural("session.bars", n); }+ if (beats < bpb) return BeatsText(beats);+ return Loc.F("session.bars_n", (int)(beats / bpb), NotaNum.Str(beats % bpb, "0.##"));}/// <summary>bars.beats.sixteenths, 1-based, the way positions read in the transport.</summary>internal static string FormatPosition(double beats){beats = Math.Max(0, beats);- int bar = (int)(beats / 4) + 1, beat = (int)(beats % 4) + 1, six = (int)(beats % 1 * 4) + 1;+ int bpb = Meter.BeatsPerBar;+ int bar = (int)(beats / bpb) + 1, beat = (int)(beats % bpb) + 1, six = (int)(beats % 1 * 4) + 1;return $"{bar}.{beat}.{six}";}@@ -749,6 +751,7 @@ public sealed partial class SessionView : UserControlinternal static string FormatDuration(double beats){beats = Math.Max(0, beats);- return $"{(int)(beats / 4)}.{(int)(beats % 4)}.{(int)Math.Round(beats % 1 * 4)}";+ int bpb = Meter.BeatsPerBar;+ return $"{(int)(beats / bpb)}.{(int)(beats % bpb)}.{(int)Math.Round(beats % 1 * 4)}";}}diff --git a/src/managed/Nota.Presentation/ViewModels/TransportViewModel.cs b/src/managed/Nota.Presentation/ViewModels/TransportViewModel.csindex 47addab1..94b04298 100644--- a/src/managed/Nota.Presentation/ViewModels/TransportViewModel.cs+++ b/src/managed/Nota.Presentation/ViewModels/TransportViewModel.cs@@ -17,7 +17,8 @@ public partial class TransportViewModel(IAudioEngine engine) : ObservableObject{private readonly IAudioEngine _engine = engine;- private const int BeatsPerBar = 4;+ // A bar is the time signature's numerator in beats, as the metronome counts it (#405).+ private int BeatsPerBar => Math.Max(1, TimeSigNumerator);[ObservableProperty] private string _positionText = "1.1.00";[ObservableProperty] private string _playLabel = "▶ Play";@@ -81,7 +82,12 @@ public partial class TransportViewModel(IAudioEngine engine) : ObservableObject_sentBpmAt = Environment.TickCount64;_engine.SetBpm((double)value);}- partial void OnTimeSigNumeratorChanged(int value) => _engine.SetTimeSignature(value, TimeSigDenominator);+ partial void OnTimeSigNumeratorChanged(int value)+ {+ _engine.SetTimeSignature(value, TimeSigDenominator);+ if (!IsCountingIn) UpdatePositionText(_lastBeats); // the readouts re-count at once+ SyncLoop();+ }partial void OnTimeSigDenominatorChanged(int value) => _engine.SetTimeSignature(TimeSigNumerator, value);partial void OnMasterVolumeChanged(double value){@@ -121,8 +127,8 @@ public partial class TransportViewModel(IAudioEngine engine) : ObservableObjectLoopRangeText = FormatRange(s, e);}- private static string FormatRange(double startBeat, double endBeat) => $"{BarBeat(startBeat)}–{BarBeat(endBeat)}"; // closed: plain numbers- private static string BarBeat(double beat)+ private string FormatRange(double startBeat, double endBeat) => $"{BarBeat(startBeat)}–{BarBeat(endBeat)}"; // closed: plain numbers+ private string BarBeat(double beat){int bar = (int)(beat / BeatsPerBar) + 1;int b = (int)(beat % BeatsPerBar) + 1;diff --git a/tests/Nota.SmokeTest/MeterTests.cs b/tests/Nota.SmokeTest/MeterTests.csnew file mode 100644index 00000000..da480ab0--- /dev/null+++ b/tests/Nota.SmokeTest/MeterTests.cs@@ -0,0 +1,36 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// Bars follow the time signature (#405): the transport's bar.beat readout counts a bar as the+// numerator in beats — what the metronome clicks and the arrangement grid now draws — instead+// of a fixed four.++using Nota.Infrastructure;+using Nota.Presentation;++namespace Nota.SmokeTest;++internal static class MeterTests+{+ private const int Chunk = 256;+ private const double Sr = 48000.0;++ public static IEnumerable<(bool, string)> Run()+ {+ using var e = new NotaEngine();+ var vm = new TransportViewModel(e);+ e.Seek(3.0); Apply(e); vm.Tick();+ yield return (vm.PositionText == "1.4.00", "meter: beat 3 reads 1.4 in 4/4");++ vm.TimeSigNumerator = 3;+ yield return (vm.PositionText == "2.1.00", "meter: changing to 3/4 re-counts the readout at once (2.1)");+ e.Seek(7.5); Apply(e); vm.Tick();+ yield return (vm.PositionText == "3.2.50", "meter: beat 7.5 reads 3.2.50 in 3/4");++ vm.TimeSigNumerator = 5;+ yield return (vm.PositionText == "2.3.50", "meter: …and 2.3.50 in 5/4");+ }++ // Stand-in for the audio thread: one render drains the queued commands.+ private static void Apply(NotaEngine e) => e.RenderOffline(new float[Chunk * 2], Chunk, Sr);+}diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.csindex 975c8339..c54ff667 100644--- a/tests/Nota.SmokeTest/Program.cs+++ b/tests/Nota.SmokeTest/Program.cs@@ -15485,6 +15485,8 @@ Console.WriteLine("-- group link --");foreach (var (ok, label) in GroupLinkTests.Run()) Check(ok, label);Console.WriteLine("-- tempo follow --");foreach (var (ok, label) in TempoFollowTests.Run()) Check(ok, label);+Console.WriteLine("-- meter --");+foreach (var (ok, label) in MeterTests.Run()) Check(ok, label);Console.WriteLine("-- nota keys --");foreach (var (ok, label) in KeysTests.Run()) Check(ok, label);Console.WriteLine("-- nota vocoder --");