#include EvtManager mgr; bool play0() { trigSound("0.wav"); return true; } bool play1() { trigSound("1.wav"); return true; } bool play2() { trigSound("2.wav"); return true; } bool play3() { trigSound("3.wav"); return true; } bool play4() { trigSound("4.wav"); return true; } bool play5() { trigSound("5.wav"); return true; } bool play6() { trigSound("6.wav"); return true; } bool play7() { trigSound("7.wav"); return true; } bool play8() { trigSound("8.wav"); return true; } bool play9() { trigSound("9.wav"); return true; } bool play10() { trigSound("10.wav"); return true; } void trigSound(String filename ) { eventuallyContext(); playWav1.play(filename.c_str()); delay(5); } bool checkVolume() { float vol = analogRead(15); vol = vol / 1024; sgtl5000_1.volume(vol); } void eventuallyContext () { mgr.resetContext(); mgr.addListener(new EvtTimeListener(10, true, (EvtAction)checkVolume)); mgr.addListener(new EvtPinListener(buttonPins[0], (EvtAction)play0)); mgr.addListener(new EvtPinListener(buttonPins[1], (EvtAction)play1)); mgr.addListener(new EvtPinListener(buttonPins[2], (EvtAction)play2)); mgr.addListener(new EvtPinListener(buttonPins[3], (EvtAction)play3)); mgr.addListener(new EvtPinListener(buttonPins[4], (EvtAction)play4)); mgr.addListener(new EvtPinListener(buttonPins[5], (EvtAction)play5)); mgr.addListener(new EvtPinListener(buttonPins[6], (EvtAction)play6)); mgr.addListener(new EvtPinListener(buttonPins[7], (EvtAction)play7)); mgr.addListener(new EvtPinListener(buttonPins[8], (EvtAction)play8)); mgr.addListener(new EvtPinListener(buttonPins[9], (EvtAction)play9)); mgr.addListener(new EvtPinListener(buttonPins[10], (EvtAction)play10)); }