There was a minor typo in the above example. Where “n” is the track number you are calling.
for (int n = 0; n < 9 ; n++)
{
MP3player.playTrack(n);
while (MP3player.isPlaying());
}
And since it is called by the loop the loop “n” knows which track is playing.
More advanced one could rely on the SdFat Library to know which filename is playing. The below code is the key components for it
SdFile file;
char filename[13];
file.getFilename(filename);
But it has been awhile since I have used them. So it would take some trails to get it going. But likely not too difficult.