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) Clip editor follows a playing Session clip's playhead (#152)
Chris Laupama97a07e0088fb
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 0e4ca959..182c594e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -58,6 +58,9 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.pressure. MCP: `get_clip_controllers`, `set_clip_controller`.### Fixed+- **The clip editor shows the playhead of a playing Session clip** (nota-daw/nota#137):+ open a launched slot and the piano roll's cursor, or the Drum Rack step grid's lit+ column, now follows the slot as it loops. Before, only Arrangement clips showed one.- **Notes no longer cut off at the loop seam** (nota-daw/nota#29): when the loop jumpsback to its start, a key you're holding keeps sounding and release tails (pads, strings)ring out. Before, every voice was cut at the seam. A clip note running past the loop enddiff --git a/src/managed/Nota.App/MainWindow.Detail.cs b/src/managed/Nota.App/MainWindow.Detail.csindex 6a63a3d4..354445ab 100644--- a/src/managed/Nota.App/MainWindow.Detail.cs+++ b/src/managed/Nota.App/MainWindow.Detail.cs@@ -226,6 +226,11 @@ public partial class MainWindow// The audio clip editor is open on a Session slot's take.private bool SessionAudioEditorOpen => _audioEditor is not null && SessionClip.SceneOf(_audioEditorClipIndex) >= 0;+ // A Session slot's loop-local playback position in beats, or -1 (hidden) unless that+ // slot is the one playing on its track — the slot loops on its own clock, not the song's.+ private double SessionSlotPlayhead(int trackId, int scene) =>+ Engine.SessionSlotState(trackId, scene) == 3 ? Engine.SessionSlotPosition(trackId) : -1;+private bool IsDrumRackTrack(int trackId) => trackId > 0 && Engine.TrackInstrumentKind(trackId) == 4;// Build the step grid over one clip (scene >= 0: a Session slot). Both note sources arediff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.csindex 2a8f67de..7217ee72 100644--- a/src/managed/Nota.App/MainWindow.axaml.cs+++ b/src/managed/Nota.App/MainWindow.axaml.cs@@ -291,14 +291,26 @@ public partial class MainWindow : Windowif (_audioEditor is { IsEffectivelyVisible: true })_audioEditor.OnPlayhead(beats, vm.Engine.IsPlaying); // live clip playback cursor// Piano-roll playback cursor: map the global beat to clip-local time for the- // open arrangement MIDI clip (session slots run their own clock → skipped).- if (_clipEditor is { IsEffectivelyVisible: true } && _editorRoll is not null- && _editorTrackId > 0 && Engine.TryGetClipInfo(_editorTrackId, _editorClipIndex, out var pci) && pci.IsMidi)- _editorRoll.SetPlayhead(beats - pci.StartBeat, vm.Engine.IsPlaying);- // Same for the Drum Rack step grid (Session slots run their own clock → skipped).- if (_patternView is { IsEffectivelyVisible: true } && _patternTrackId > 0 && _patternScene < 0- && Engine.TryGetClipInfo(_patternTrackId, _patternClipIndex, out var ppi) && ppi.IsMidi)- _patternView.SetPlayhead(beats - ppi.StartBeat, vm.Engine.IsPlaying);+ // open arrangement MIDI clip; a session slot runs its own loop clock, so follow+ // the slot's position instead (#137).+ if (_clipEditor is { IsEffectivelyVisible: true } && _editorRoll is not null)+ {+ if (_editorTrackId > 0)+ {+ if (Engine.TryGetClipInfo(_editorTrackId, _editorClipIndex, out var pci) && pci.IsMidi)+ _editorRoll.SetPlayhead(beats - pci.StartBeat, vm.Engine.IsPlaying);+ }+ else if (_sessionSlotTrack > 0 && _sessionSlotScene >= 0)+ _editorRoll.SetPlayhead(SessionSlotPlayhead(_sessionSlotTrack, _sessionSlotScene), true);+ }+ // Same for the Drum Rack step grid.+ if (_patternView is { IsEffectivelyVisible: true } && _patternTrackId > 0)+ {+ if (_patternScene >= 0)+ _patternView.SetPlayhead(SessionSlotPlayhead(_patternTrackId, _patternScene), true);+ else if (Engine.TryGetClipInfo(_patternTrackId, _patternClipIndex, out var ppi) && ppi.IsMidi)+ _patternView.SetPlayhead(beats - ppi.StartBeat, vm.Engine.IsPlaying);+ }double load = Math.Clamp(vm.Engine.CpuLoad, 0, 1); // live DSP load (Phase 11)int pct = (int)Math.Round(load * 100);