diff --git a/modules/juce_blocks_basics/blocks/juce_Block.h b/modules/juce_blocks_basics/blocks/juce_Block.h index 9898612f88..042ee63d4f 100644 --- a/modules/juce_blocks_basics/blocks/juce_Block.h +++ b/modules/juce_blocks_basics/blocks/juce_Block.h @@ -151,7 +151,7 @@ public: neither delete it or use it after the lifetime of this Block object has finished. If there are no LEDs, then this method will return nullptr. */ - virtual LEDRow* getLEDRow() const = 0; + virtual LEDRow* getLEDRow() = 0; /** If this block has any status LEDs, this will return an array of objects to control them. Note that the objects in the array belong to this Block object, and the caller must diff --git a/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp b/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp index ef5c5c013a..1d2a1ae5c8 100644 --- a/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp +++ b/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp @@ -1470,9 +1470,6 @@ struct PhysicalTopologySource::Internal for (auto&& s : modelData.statusLEDs) statusLights.add (new StatusLightImplementation (*this, s)); - if (modelData.numLEDRowLEDs > 0) - ledRow.reset (new LEDRowImplementation (*this)); - updateMidiConnectionListener(); } @@ -1546,7 +1543,14 @@ struct PhysicalTopologySource::Internal TouchSurface* getTouchSurface() const override { return touchSurface.get(); } LEDGrid* getLEDGrid() const override { return ledGrid.get(); } - LEDRow* getLEDRow() const override { return ledRow.get(); } + + LEDRow* getLEDRow() override + { + if (ledRow == nullptr && modelData.numLEDRowLEDs > 0) + ledRow.reset (new LEDRowImplementation (*this)); + + return ledRow.get(); + } juce::Array getButtons() const override {