Playing WAV audio from SD-card with Arduino DUE

Can the DUE handle to play a WAV file more than once? The sketch below works sometimes. After a while the files play hampered. Same problem when I play the same file (instead of 4 here). Who can help me out? My artwork has a deadline and I’m losing days without progress…
I use a DUE with Adafruit SD-card reader connected to the SPI and 2.5W amp on the DAC0.

/*
  DUE - SD card WAV player BUTTON

 The circuit: use 6-pin SPI connector

  Uno 10  CS   SS     Due  10
      11  DI   MOSI        ICSP-4
      12  DO   MISO        ICSP-1
      13  CLK  SCK         ICSP-3

 */

#include <SPI.h>
#include <SD.h>
#include <Audio.h>


File myFile;

// const int SS = 10; (Chipselect const SS declared in SD.h)

const int btnPin = A2;
const int ledPin = A3;

int trkSel = 1;

int buttonState = LOW;

void setup() {

  Serial.begin(9600);

  pinMode(btnPin, INPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(SS, OUTPUT);

  digitalWrite(ledPin, LOW);

  Serial.print("\nInitializing SD card...");

  if (!SD.begin(SS)) {
    Serial.println(" Failed!");
    return;
  }

  Serial.println(" OK.");

  // 44100kHz stereo => 88200 sample rate, 100 mSec of prebuffering:
  Audio.begin(88200, 100);

}


void loop() {

  // WAV sample file ID scheme = PRF-BNK-TRK.wav
  int sPRF = 1;  // Performance#
  int sBNK = 1;  // Sample bank
  int sTRK = 1;  // Sample track
  int OK;        // return value (0 is ok)

  buttonState = digitalRead(btnPin);
  if (buttonState == HIGH)
  {
    digitalWrite(ledPin, HIGH);
    OK = macePod(sPRF, sBNK, trkSel, 1500, 0, 512);
    Serial.print("\n*** macePod "); Serial.println(OK);

    trkSel++;

    if (trkSel > 4 ) {
      trkSel = 1;
    }

  }

}

int macePod(int PRF, int BNK, int TRK, int duration, int pitch, int vol) {

  char sampleFile[20];
  const int S = 1024; // Number of samples to read in block
  short buffer[S] = {};

  int volume = vol;

  sprintf(sampleFile, "%d-%d-%d.wav", PRF, BNK, TRK);

  Serial.print("[Sample "); Serial.print(TRK); Serial.print("] ");

  // open wave file from sdcard
  myFile = SD.open(sampleFile);
  if (!myFile) {
    return 1;
  }

  int count = 0;
  while (count <= duration / 10) {

    // read from the file into buffer
    myFile.read(buffer, sizeof(buffer));
    // Prepare samples
    Audio.prepare(buffer, S, volume);
    // Feed samples to audio
    Audio.write(buffer, S);

    count++;

  }
  myFile.close();
  digitalWrite(ledPin, LOW);
  return 0;
}

After a while the files play hampered.

What the heck does this mean?

int macePod(int PRF, int BNK, int TRK, int duration, int pitch, int vol) {

By convention, all capital letter names are reserved for constants. Function arguments are, by definition, not constants.

Your code is missing comments where they would be useful, such as

  int count = 0;
  while (count <= duration / 10) {

but has them where they state the obvious, like:

    // read from the file into buffer
    myFile.read(buffer, sizeof(buffer));

There seems to be NO relationship between count and duration.