Display signals from the multiplexer capelet
This sketch displays the values of up to 64 analog inputs connected by the multiplexer capelet. The capelet is a separate piece of hardware that attaches to the Bela cape.
To run the sketch, the multiplexer capelet needs to be enabled using the IDE or with the -X command line option. The multiplexer capelet requires 8 analog inputs to work, and depending on the settings can use either 2, 4 or 8 multiplexer channels per analog input (for a total of 16, 32 or 64 inputs).
#include <unistd.h>
bool gIsStdoutTty;
unsigned int gPrintCount = 0;
{
rt_printf("Please enable the Multiplexer Capelet to run this example.\n");
return false;
}
gIsStdoutTty = isatty(1);
return true;
}
{
gPrintCount = 0;
if(gIsStdoutTty)
rt_printf("\e[1;1H\e[2J");
rt_printf("Input %d: ", input);
rt_printf("%f ", sample);
}
rt_printf("\n");
}
}
}
{
}
static float multiplexerAnalogRead(BelaContext *context, int input, int muxChannel)
Read an audio input, specifying the frame number (when to read) and the channel.
Definition Bela.h:1571
void render(BelaContext *context, void *userData)
User-defined callback function to process audio and sensor data.
Definition render.cpp:68
bool setup(BelaContext *context, void *userData)
User-defined initialisation function which runs before audio rendering begins.
Definition render.cpp:51
void cleanup(BelaContext *context, void *userData)
User-defined cleanup function which runs when the program finishes.
Definition render.cpp:96
Structure holding audio and sensor settings and pointers to I/O data buffers.
Definition Bela.h:231
const uint32_t multiplexerChannels
Number of multiplexer channels for each analog input.
Definition Bela.h:385
const uint32_t analogFrames
The number of analog frames per block.
Definition Bela.h:341
const uint32_t analogInChannels
The number of analog input channels.
Definition Bela.h:346
const float analogSampleRate
Analog sample rate in Hz.
Definition Bela.h:362