In order to compile and run this application you need to first download and compile the BLOCKS-SDK, which can be obtained from GitHub here.
If you need help with this step, please refer to The standalone BLOCKS SDK section.
The source code for this example can be found in the BLOCKS-SDK repository at examples/BlockFinder/
, with the parts that are specific to different operating systems in the corresponding subdirectories.
The main functionality of the application is contained within the following class:
BlockFinder/BlockFinder.h
:
BlockFinder/BlockFinder.cpp
:
All this class does is create a PhysicalTopologySource and register for TopologySource::Listener::topologyChanged() callbacks — for more information about how this works you should see the Discovering BLOCKS section. When the topology changes we print some information about the available BLOCKS.
The main
function of the macOS application is the easiest to understand.
BlockFinder/MacOS/main.mm
:
Here we simply perform some JUCE initialisation, instantiate a BlockFinder class, then run the event loop. Whilst in the event loop, the finder
object receives TopologySource::Listener::topologyChanged() callbacks and we see output printed to stdout
when BLOCKS are connected or disconnected.