In addition to what @CrossRoads said, I would change the organization of the code a little -- for example
void loop() {
currentMillis = millis();
readButtons();
checkAlarm();
soundAlarm();
}
void activateAlarm() {
if (buttonPressed = true) {
alarmStartMillis = millis();
alarmSounding = true;
}
}
void soundAlarm() {
if (alarmSounding == true) {
if (currentMillis - alarmStartMillis <= alarmDurationMillis) {
// whatever makes the noise
}
else {
// whatever stops the noise
alarmSounding = false;
}
}
else
}
}
And I suggest you start with a simplified sketch that doesn't bother with switch debouncing.
...R