       }
     }
   }
+  if (state == PLAY_SELECTED) {
+    if (player.stopped()) onStop();
+  }
   return READ_DELAY;
 }
 

    stopPlayingAlbum();
    Serial.print("Stopped album #"); Serial.println(index);
    initializeTrellis(1200);
  } else {
    // Pressed key to play a new album
    if (state == PLAY_SELECTED) stopPlayingAlbum();
    trellis.clear();
    trellis.setLED(index);
    trellis.blinkRate(HT16K33_BLINK_1HZ);
    trellis.writeDisplay();
  
    state = PLAY_SELECTED;
    playingAlbum = index;
    playAlbumNew(index);
   
    Serial.print("Playing album #"); Serial.println(index);
  }
}

void playAlbumNew(byte index) {

void initializeTrellis(int delay) {
  trellis.begin(0x70);
  //trellis.readSwitches(); // ignore already pressed switches
  Serial.println("Trellis initialized");

  trellis.blinkRate(HT16K33_BLINK_OFF);
  trellis.clear();
  trellis.writeDisplay();

  nextIdleTick = millis() + delay;
}

