From 0b056c63646cc93788470fd9ab9552fd977a02c5 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 4 Dec 2021 19:19:51 +0100 Subject: [PATCH] Redraw MIDI monitor only as needed This reduces CPU overhead and constant stream of cross thread signals at session's block-size. --- share/scripts/midimon.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/share/scripts/midimon.lua b/share/scripts/midimon.lua index c368f782c9..4a8479ceb8 100644 --- a/share/scripts/midimon.lua +++ b/share/scripts/midimon.lua @@ -61,6 +61,7 @@ end function dsp_runmap (bufs, in_map, out_map, n_samples, offset) local pos = self:shmem():atomic_get_int(0) local buffer = self:shmem():to_int(1):array() + local newdata = false -- passthrough all data ARDOUR.DSP.process_map (bufs, n_out, in_map, out_map, n_samples, offset) @@ -83,12 +84,16 @@ function dsp_runmap (bufs, in_map, out_map, n_samples, offset) for j = e:size()+1, evlen do buffer[(pos-1)*evlen + j] = 0 end + newdata = true end end self:shmem():atomic_set_int(0, pos) - self:queue_draw () + if newdata then + print ("new data", pos) + self:queue_draw () + end end local txt = nil -- a pango context