Play preview through the edited track's instrument
StuffMIDIMessage feeds the virtual MIDI keyboard, which only reaches tracks that are armed and monitoring -- normally not the track whose item you are editing. Opening an item in grid mode therefore sounded every preview through whatever instrument happened to be armed, which is confusing when the notes you are writing come back in the wrong voice. Grid mode now borrows the record routing: the edited take's track is armed and monitoring with all MIDI inputs (anything narrower can exclude the virtual keyboard), and every other armed track is stood down so it cannot answer as well. The prior arm, monitor and input of each track touched is saved by GUID in transient ExtState. routePreview re-points lazily, so moving the editor to an item on another track costs nothing until the target actually changes. The daemon hands the routing back when grid mode goes off, when the editor closes, or on exit -- the same way it already restores the loop and repeat state the loop-bar action borrows -- so the project is put back even if grid mode is never toggled off. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+12
-2
@@ -80,6 +80,15 @@ local function loop()
|
||||
end
|
||||
end
|
||||
|
||||
-- Grid mode borrows the record arm/monitor state of the edited track so
|
||||
-- preview plays through its instrument. Give it back as soon as grid mode
|
||||
-- is off or the editor is gone -- here rather than in an action script, so
|
||||
-- closing the editor puts the project back too.
|
||||
if G.getTemp("savedarm", "") ~= ""
|
||||
and (not G.isActive() or not reaper.MIDIEditor_GetActive()) then
|
||||
G.restoreRouting()
|
||||
end
|
||||
|
||||
-- Restore the loop range and repeat state the loop-bar action borrowed,
|
||||
-- once transport has stopped. Doing it here rather than in the action
|
||||
-- script means the project is put back even if you stop with Space.
|
||||
@@ -100,6 +109,7 @@ local function loop()
|
||||
reaper.defer(loop)
|
||||
end
|
||||
|
||||
-- Never leave a note hanging if the daemon is terminated or Reaper quits.
|
||||
reaper.atexit(allOff)
|
||||
-- Never leave a note hanging, or a borrowed record arm unreturned, if the
|
||||
-- daemon is terminated or Reaper quits.
|
||||
reaper.atexit(function() allOff() ; G.restoreRouting() end)
|
||||
loop()
|
||||
|
||||
Reference in New Issue
Block a user