 //  BELOW THIS LINE THE MP3 PLAYER CONTROL IS DEFINED
 //
 // included in while loop of playTrack() for checks for volume changes
-#ifdef VOLUMEPOT
 static void plrAdjustVolume() {
-  // volume control functions
-  const byte volSensorDrift = 7;    // difference to last received sensor value that must be exceeded to activate a change in the volume
-  word volCompareValue      = 0;    // just a convenience variable to make comparison easier
-  
-  // read the input on analog pin 0 and check if we have a change in volume.
-  const word volSensorValue = analogRead(volPotPin);
-  if (lastVolSensorValue > volSensorValue) {
-    volCompareValue = lastVolSensorValue - volSensorValue;
-  } else {
-    volCompareValue = volSensorValue - lastVolSensorValue;
-  }
-  
-  // If we have a high enough difference in the sensor reading, calculate it so we may set it on the player
-  if (volCompareValue > volSensorDrift) {
-    const byte soundVolume = volSensorValue / 10; // map the sensor value to a sound volume
-    #ifdef DEBUG
-      Serial.print(F("old sensor: ")); Serial.print(lastVolSensorValue); 
-      Serial.print(F(", new sensor: ")); Serial.print(volSensorValue); 
-      Serial.print(F(", vol: -")); Serial.println(soundVolume);
-    #endif
-    lastVolSensorValue = volSensorValue;
-    musicPlayer.setVolume(soundVolume, soundVolume);
-  } // end of change sound volume
-}
-#endif
+  #ifdef VOLUMEPOT
+    // volume control functions
+    const byte volSensorDrift = 7;    // difference to last received sensor value that must be exceeded to activate a change in the volume
+    word volCompareValue      = 0;    // just a convenience variable to make comparison easier
+    
+    // read the input on analog pin 0 and check if we have a change in volume.
+    const word volSensorValue = analogRead(volPotPin);
+    if (lastVolSensorValue > volSensorValue) {
+      volCompareValue = lastVolSensorValue - volSensorValue;
+    } else {
+      volCompareValue = volSensorValue - lastVolSensorValue;
+    }
+    
+    // If we have a high enough difference in the sensor reading, calculate it so we may set it on the player
+    if (volCompareValue > volSensorDrift) {
+      const byte soundVolume = volSensorValue / 10; // map the sensor value to a sound volume
+      #ifdef DEBUG
+        Serial.print(F("old sensor: ")); Serial.print(lastVolSensorValue); 
+        Serial.print(F(", new sensor: ")); Serial.print(volSensorValue); 
+        Serial.print(F(", vol: -")); Serial.println(soundVolume);
+      #endif
+      lastVolSensorValue = volSensorValue;
+      musicPlayer.setVolume(soundVolume, soundVolume);
+    } // end of change sound volume
+  #endif
+}
 
 
 //

  strcat(filename, "track");
  strcat(filename, curTrackCharNumber);
  strcat(filename, ".mp3");
  
  // return true or false for the filename created - this is checked
  return (SD.exists(filename));
}


// store uid, plrCurrentFolder and firstTrackToPlay in the char array trackDbEntry[]
// so we may write it to the track Db file
#ifdef NFCTRACKDB
static void setTrackDbEntry() {
  char tmpbuf[4];                                 // temp buffer for one number of the uid
    
  // create the entry for the  "Tag UID <-> directory + track number"  connection
  memset(trackDbEntry, 0, sizeof(trackDbEntry));
  for (byte i = 0; i <= uidLength ; i++) {
    sprintf( tmpbuf, "%d", uid[i] );              // print one byte of the uid as decimal into tmpbuf, so
    strcat( charUid, tmpbuf );                    // we can add it to the charUid 
  }
  
  memcpy(trackDbEntry, charUid, sizeof(charUid)); // finally we add the charUid to the trackDbENtry 
  strcat(trackDbEntry, ":");                      // add a seperator :
  strcat(trackDbEntry, plrCurrentFolder);         // the folder of the album this tag is connected with
  char cstr[4];                                   // a new char array that will hold firstTrackToPlay as a char array
  itoa(firstTrackToPlay, cstr, 10);               // converting firstTrackToPlay to char and place it in cstr
  strcat(trackDbEntry, ":");                      // and the number of the track
  strcat(trackDbEntry, cstr);                     // and the number of the track
  strcat(trackDbEntry, "\n");                     // and a newline :-)
}
#endif


#ifdef RAMCHECK

//       PP        RR    RR  OO    OO     TT     OO    OO     TT        YY     PP        EE          SS
//       PP        RR    RR   OOOOOO      TT      OOOOOO      TT        YY     PP        EEEEEE  SSSSS
//
static boolean checkForTagPresence(void);       // checks if there is a tag on the reader, either Speedmaster or Adafruit style
static boolean checkForSameTag(void);           // checks if the same tag as the one for currently played album is still on the reader
                                                // this one can only be used with the Adafruit library and TrackDB implementation

static void plrAdjustVolume(void);              // function to check for changes on the volume control and adjust volume accrodingly

                                                // these are the prototypes for the mp3 player controller
static void plrStop(void);                      // stops the player
static void plrTogglePause(void);               // pause and unpause the player
static char playAlbum(uint8_t);                 // plays the album from plrCurrentFolder: returns -1 for error or a higher 
                                                // calls playTrack to actually play a track and check if that was successful and which 
                                                // track number to play next
static char playTrack(uint8_t);                 // plays a track as defined by the global var filename.
                                                // returns -1 for error, 0 for success and track number to play next
                                                // this can either be provided char+1 or char-1


                                                // these are the prototypes to work on files and general helpers
static uint8_t countFiles(File);                // return the number of files in a directory passed as a File descriptor
static boolean checkIfFileExists(void);         // returns true if the file from global vars plrCurrentFolder and plrCurrentFile exists on sd


                                                // helper functions to set global vars
static void setFileNameToPlay(byte);            // sets filename of the track to play from global vars plrCurrentFolder and plrCurrentFile


                                                // helper functions for the TrackDb 
                                                // these are the prototypes to retrieve and set directory and tracks to play
static boolean getDirAndTrackToPlay(boolean);   // retrieves the directory and track number 

static void checkAndSetCurTrack(byte, uint8_t); // function called from playAlbum for every file played. it checks if the current track is
                                                // the last in the album and if so sets firstTrackToPlay to 1. Otherwise firstTrackToPlay is set 
                                                // to curTrack and afterwards setTrackDbEntry is called to store the track
static void setTrackDbEntry(void);              // setTrackDbEntry stores the currently played file in the TrackDb plus (plus optionally the AlbumNFC 
                                                // file) to allow resuming a played album on the current track in case the box is turned off                                                
static boolean writeTrackDbEntry(void);         // store Tag UID, plrCurrentFolder and firstTrackToPlay in the trackDb (files on SD)


static void issueWarning(const char[], const char[], boolean); // the new warning method


                                                // these are the prototypes for the led
static void switchLightState(void);             // switch the boolean var lightOn from true to false and vice versa 
                                                // - in case light is lightOn is set to true, lightStartUpTime is set to millis()



