 
 void setupButtons() {
   for (byte i = 0; i < numberOfChannelButtons; i++) {
-    initButton(channelButtonStart + i, &channelButtons[i], &channelButtonStates[i], &channelButtonDown[i]);
-  }
-  initButton(bankDownPin, &bankDownButton, &bankDownState, &bankDownDown);
-  initButton(bankUpPin, &bankUpButton, &bankUpState, &bankUpDown);
-  initButton(stopPin, &stopButton, &stopState, &stopDown);
-  initButton(playPin, &playButton, &playState, &playDown);
+    //initButton(channelButtonStart + i, &channelButtons[i], &channelButtonStates[i], &channelButtonDown[i]);
+    channelButtons[i].init(channelButtonStart + i);
+  }
+  bankDownButton.init(bankDownPin);
+  bankUpButton.init(bankUpPin);
+  stopButton.init(stopPin);
+  playButton.init(playPin);
 }
 
 void initButton(byte pin, Bounce *button, boolean *state, boolean *down) {


byte bank = 0;

const byte bpmLed = 22;


void OnNoteOn(byte channel, byte note, byte velocity)
{

  delay(200);
}

void debugButton(Button *button) {
  Serial.print("Button: ");
  Serial.print((*button).getPin());
  Serial.print(" Just pressed: ");
  Serial.print((*button).isJustPressed());
  Serial.print(" Pressed: ");
  Serial.print((*button).isPressed());
  Serial.print(" Just released : ");
  Serial.println((*button).isJustReleased());
}

void updateButtons() {
  for (byte i = 0; i < numberOfChannelButtons; i++) {
    if (channelButtons[i].update()) {
      debugButton(&channelButtons[i]);
    }
  }
  if (bankDownButton.update()) {
    debugButton(&bankDownButton);
  }
  if (bankUpButton.update()) {
    debugButton(&bankUpButton);
  }
  if (stopButton.update()) {
    debugButton(&stopButton);
  }
  if (playButton.update()) {
    debugButton(&playButton);
  }
}

