Coloring Lightpad BLOCK LEDs using the Juce BLOCK module

Hello,

I’m currently trying to display what I want on my lightpad BLOCK so I started by writting a simple program that would set all the LEDs to red but I doesn’t do anything. I also tried to execute the BlockDrawing example but nothing is ever displayed on my lightpad BLOCK. I’m using the block module on the develop branch (the master branch one doesn’t build) of the JUCE GitHub. Any idea why it doesn’t work ?

Here is my code:

class TestBlocksLED : public juce::TopologySource::Listener
{
public:
TestBlocksLED();
~TestBlocksLED();

virtual void topologyChanged();

private:
juce::PhysicalTopologySource _pts;
juce::BitmapLEDProgram *_program;
juce::Block *_activeBlock;
};

TestBlocksLED::TestBlocksLED()
: _activeBlock(NULL)
{
_pts.addListener(this);
}

TestBlocksLED::~TestBlocksLED()
{
}

void TestBlocksLED::topologyChanged()
{
std::cout << “Topology changed” << std::endl;

juce::BlockTopology currentTopology = _pts.getCurrentTopology();

_activeBlock = NULL;

for (int i = 0; i < currentTopology.blocks.size() && !_activeBlock; ++i)
{
if (currentTopology.blocks[i]->getType() == juce::Block::lightPadBlock)
{
_activeBlock = currentTopology.blocks[i];
}
}

if (!_activeBlock)
{
std::cout << “No active block” << std::endl;

return;

}

std::cout << “Active block found” << std::endl;

_program = new BitmapLEDProgram(*_activeBlock);
_activeBlock->setProgram(_program);

int w = _activeBlock->getLEDGrid()->getNumColumns();
int h = _activeBlock->getLEDGrid()->getNumRows();

std::cout << “Setting all LEDs (” << w << " * " << h << “) red” << std::endl;

for (int x = 0; x < w; ++x)
{
for (int y = 0; y < h; ++y)
{
_program->setLED(x, y, juce::Colours::red);
}
}
}

This should be fixed on the develop branch now