Flickering Potentiometer

thanks

so i google it but i don't know where to put this function : Analog::map(std::function<int(int)>)

i watch the code and try to understand but its not easy...
every time i try to write somthing it gaves me a lot of error...
so thats the code that working befor errors

sorryyy for spending your time :frowning:

thanks

#include <MIDI_Controller.h> // Include the library
#include "HystFilter.h"

// USBDebugMIDI_Interface udmi(115200);

AnalogMultiplex 
multiplexer(A0, { 2, 3, 4, 5 } );


Analog potentiometers[] = {
  {multiplexer.pin(0), MIDI_CC::Channel_Volume, 1},
  {multiplexer.pin(1), MIDI_CC::Channel_Volume, 2},
  {multiplexer.pin(2), MIDI_CC::Channel_Volume, 3},
  {multiplexer.pin(3), MIDI_CC::Channel_Volume, 4},
  {multiplexer.pin(4), MIDI_CC::Channel_Volume, 5},
  {multiplexer.pin(5), MIDI_CC::Channel_Volume, 6},
  {multiplexer.pin(6), MIDI_CC::Channel_Volume, 7},
  {multiplexer.pin(7), MIDI_CC::Channel_Volume, 8},
  {multiplexer.pin(8), MIDI_CC::Channel_Volume, 9},
  {multiplexer.pin(9), MIDI_CC::Channel_Volume, 10},
  {multiplexer.pin(10), MIDI_CC::Channel_Volume, 11},
  {multiplexer.pin(11), MIDI_CC::Channel_Volume, 12},
  {multiplexer.pin(12), MIDI_CC::Channel_Volume, 13},
  {multiplexer.pin(13), MIDI_CC::Channel_Volume, 14},
  {multiplexer.pin(14), MIDI_CC::Channel_Volume, 15},
  {multiplexer.pin(15), MIDI_CC::Channel_Volume, 16},
};


HystFilter hystFilters[16];

const size_t nb_pots = sizeof(potentiometers) / sizeof(potentiometers[0]);
const size_t nb_hyst = sizeof(hystFilters) / sizeof(hystFilters[0]);
static_assert(nb_pots == nb_hyst, "Error: number of Analog potentiometers should be the same as the number of HystFilters");

void setup() {
  for (size_t i = 0; i < nb_pots; i++)
    potentiometers[i].map([i](int raw){ return (int) hystFilters[i].getOutputLevel(raw); });
}

void loop() {
  // Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI)
  MIDI_Controller.refresh();
}

PieterP:
If you don't understand the [nobbc]potentiometers[i].map(...)[/nobbc] part, it's a capturing lambda expression (google it).

i search it but i found only java scipts and other strange things