Simple SD audio

I am new to arduino (UNO Atmega328p) and I know I have jumped in the deep end as far as understanding code goes.

void setup()
{ 
  // If your SD card CS-Pin is not at Pin 4, enable and adapt the following line:
  // SdPlay.setSDCSPin(10);
  
  // Init SdPlay and set audio mode and activate autoworker
  if (!SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO | SSDA_MODE_AUTOWORKER)) {
    while(1); // Error while initialization of SD card -> stop.
  } 
  
  // Select file to play
  if(!SdPlay.setFile("hornshep.AFM")) {
    while(1); // Error file not found -> stop.
  }   
}

void loop(void) {
  // Start playback
  SdPlay.play();
  
  // Optional: Wait until playback is finished
  while(!SdPlay.isStopped()) {
	; // no SdPlay.worker() required anymore :-)
  }
}

I want to change this code to play another file after a delay of say 10 secs, and then another after that.
I tried copying the code and pasting it on the end with different file names but that didn't work. Sorry I didn't keep that to show.

I was successful with Simple Sd Audio sketch - bare minimum. I edited the file with audacity to mono and raw - .AFM. I converted it with "Full rate @ 8Mhz_mono.bat and then played the sound file reasonable quality. I used a micro sd card in SDsheild and connected it to the microcontroller and then ot TBA820M kit and 8 ohm speaker.

On my model railway I want sound effects, not continuous but varied I want to use sound as a background, train and animal sounds etc.

Try this for your loop function:-

void loop(void) {
  // Start playback
  SdPlay.play();
 
  // Optional: Wait until playback is finished
  while(!SdPlay.isStopped()) {
  ; // no SdPlay.worker() required anymore :-)
  }
   SdPlay.setFile("file2.AFM");
   SdPlay.play();
   while(!SdPlay.isStopped()) { }
   
   SdPlay.setFile("file3.AFM");
   SdPlay.play();
   while(!SdPlay.isStopped()) { }
   
}

thank you Grumpy_Mike

Success with the loop. code shown below I inserted another file and added a delay. It works fine.

In my previous post I forgot to credit Lutz Lisseck with the original sketch.

 // Select file to play
  if(!SdPlay.setFile("trackno.AFM")) {
    while(1); // Error file not found -> stop.
  }   
}



void loop(void) {
  // Start playback
  SdPlay.play();
 
  // Optional: Wait until playback is finished
  while(!SdPlay.isStopped()) {
  ; // no SdPlay.worker() required anymore :-)
  }

  SdPlay.setFile("dhorn.AFM");
   SdPlay.play();
   while(!SdPlay.isStopped()) { }
   
   SdPlay.setFile("trackno.AFM");
   SdPlay.play();
   while(!SdPlay.isStopped()) { }
   delay(5000);
   
   
   SdPlay.setFile("sheep.AFM");
   SdPlay.play();
   while(!SdPlay.isStopped()) { }
   delay(8000);
   
}