LAF gives me performance degradation over time.
-
I am customizing an Oscilloscope connected by Scriptnode. When I start HISE I have no problems but as time passes the plugin testing becomes more difficult as it slows down visibly. I think I am doing something wrong in the memory management; I am using persistence buffers to draw customizations of the oscilloscope.
const var dp = Synth.getDisplayBufferSource("HardcodedMasterFX1"); const var rb = dp.getDisplayBuffer(0); const var BUFFER_LENGTH = 512; const var properties = { "BufferLength": BUFFER_LENGTH, "NumChannels": 1 }; rb.setRingBufferProperties(properties); const var P1 = Content.getComponent("P1"); // Buffer for persistence effect const var persistenceBuffers = []; const var NUM_PERSISTENCE_BUFFERS = 3; // Initialize persistence buffers with default paths for (var i = 0; i < NUM_PERSISTENCE_BUFFERS; i++) { persistenceBuffers.push(rb.createPath(P1.getLocalBounds(0), [0, BUFFER_LENGTH, -1.0, 1.0], 0.0)); } // Initialize currentBuffer with a default path P1.data.currentBuffer = rb.createPath(P1.getLocalBounds(0), [0, BUFFER_LENGTH, -1.0, 1.0], 0.0); P1.setTimerCallback(function() { // Update the currentBuffer path with the latest audio data this.data.currentBuffer = rb.createPath(this.getLocalBounds(0), [0, BUFFER_LENGTH, -1.0, 1.0], 0.0); // Update persistence buffers persistenceBuffers.insert(0, this.data.currentBuffer); if (persistenceBuffers.length > NUM_PERSISTENCE_BUFFERS) { persistenceBuffers.remove(NUM_PERSISTENCE_BUFFERS); } // Clear unused buffers to free memory for (var i = NUM_PERSISTENCE_BUFFERS; i < persistenceBuffers.length; i++) { persistenceBuffers.remove(i); } this.repaint(); // Trigger repaint to update the UI }); P1.startTimer(30); P1.setPaintRoutine(function(g) { var area = this.getLocalBounds(0); // Fill background with black g.fillAll(0xFF000000); // Draw persistence buffers with gradually decreasing opacity for (var i = 0; i < persistenceBuffers.length; i++) { var opacity = 0.3 - (i * 0.025); g.setColour(Colours.withAlpha(0x00FFFF, opacity)); g.drawPath(persistenceBuffers[i], area, 1); } // Check if currentBuffer is defined before drawing if (this.data.currentBuffer) { // Draw current buffer with a glow effect g.setColour(0xFF00FFFF); g.setOpacity(0.3); g.drawPath(this.data.currentBuffer, area, 3); // Glow effect with wider stroke g.setOpacity(0.6); g.drawPath(this.data.currentBuffer, area, 2); // Medium stroke for glow g.setOpacity(1.0); g.drawPath(this.data.currentBuffer, area, 1); // Main path drawing with normal stroke } });
HiseSnippet 2196.3oc2Y01aaabGmJ1LsVscXsncau7PvdAypqpjcS5vx5peRJwXw1BVNtEHnv3L4IoClhGG4Q6n0Ef8x8waXeB1Gg8MX62+6HEIskRcDRa1ldgr3c+e94+z8ST9hzTUhSi0NYZrvow66NXZjd7ti4xHm82yowOy8.dpVjvrGsyzXdZpHvoQiUdLcPi0V0w74e806vC4Q9hxibbNUI8EOUNQpKOs+V+QYXXOdf3D4jJP+EasuuJZWUnJCxyJtsch49WvGINjSfcGWmF2safTqRFn4ZQJfYGUvzAiUWEYg+TYp77PA8PGmAfP1ic1crLLnegtl53zvseoluhUy+X2CjAxYmWZA94lKXkXT0Fz3NuJQpyqgH0nhHspUj9P2A9IxXc4Mj77dt6GAGxPNL0UEEKrN24ezzcWEfHR2ZB+BQuD7vLL7dX61qyvW2+QM+7OmcTpO7EpTeUrfMTkvdx9C51DtgTM6RdBKHl8ULSDQqQB8dxz3P9zcxFNTjL.tIPu6YYKq2214dflknlbNPMH9F340tFX67rd85d7YOs6gO9jm.LdPmMpdcbBjrDsTjh699lL74dV57TQzH83686pSg0sfbX1D3.ihDgo.hNMe4iZlbdqTg9XYzHK98mQYuRlTSz52A7rvTB0XW0jXUDdv6d8MJKYAsDyX6.MRkHWA4.LAN0WWUQJuzhBoPO+6pxuCe1Am0u6wC1evIcOb2tmYUrA.tMs7Z+HoVxCk+YQMdcdN8tRpGyBDC4YgZVLWONsIIVdDskfJseD9yueQrAW9oe58ysw2TZaEmkN1CFQ+DAB06Cx60uCYVdpxmGtiJKJHE910YOGAX08IrOqSKbH956Vm0tU66Ca2KutF4mkj.aat8znK7ZZSSvt.tl2pNjeE6MjPAaLvEwHTYojc4ggmi5OdCyh70RUjWg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i+laYpWLM9Qh3DUe.uWJeRbn3XnQqidqJ+KFfQyuY9ZrUf2gfvyOeQqkIs9tug1d1wNhwnC35DIxkbgMvtfZwZfjM3NTFs841zyTTz.QTf4g+M9jeYmYFLbYmhKqTL3Pg9JUxEFmW9ucZ7NVOUpwHe1vW.wmZDiP4FuiK5z2psCFOQcEUSPlGjCWn4r9pvowiUQRe5HKDEh91Sv7N5B4+I7zS3xPJqXPVJpiEbTz..r4EuPQkGpBvub6w8ggcJ0rfxtnJgHTVjzxeVHcMYsLphrvDQJdSLV6DjoIl5Xz6gYE5dq1a4l8MEUcdQmZBvuvkGwCmlJZUClZgx+.rrR8VyUHN8EEkjuV390OwgpfDHdQAg6hfw.T12fNQcm97D9DgVXKGT6gJr0joROMknnwBte5ozsXjUmSoXaxu3riRcwDtI9Xo5aTsfzmXu78b+F9kByahw369Dyyz.9rGiA5SnpocdEuct+9s8syEeqe6bG4qgHbRBOBKVjJ5TkxW6tMpd2dBcVTcvsGUCJR85A0qBbu6VEGtQ0CQmzZDCOWiRGHKat57O+5tlUlFX1Rw95uHaW0le8yBSEeC01sSUDKOdipG+DdR.7K90ZMsR85Zqd6pqUuKcE3mSSi69V3MX9loU+awoQp0pcsBYbfjJlzM5RQHUThjwOB4hl27Two0ysNPEoJJWW50OVnsqzWU1mqBssVi8VKO4i25XQHV6rR91udqmhx07jCLEXWJawq+Kbdt9qekqUbYTAA1+6NE4J+e8Tj29rOTO7+t8h+RWTWdClwUxd63K+oXbxeJ3wDteh5Le6T3TR+6ZNA5cj4ep1ZtGPOy53boc5kRi4Dzx3Le+5j5FHtwxh3lKKhewxh3CVVDe3xh3WtrH9a+gQj5nuclVMwlafwb520NOaC6DNlzDm+Cf0CqX3
-
@Mighty23 (If I understand your question) why wouldn't you simply preallocate the buffers, and let them be? (Why do garbage collection?)
-
@clevername27 Thanks for the explanation. Your comment on the post helped me solve the memory management. Thanks again.