added check if alarm is active before playing alarm sound