Go Down

Topic: Continuous playing of sample (Read 65 times) previous topic - next topic

suraj_150890

Hii,

I am referring the code of groovuino. I want to play the samples continuosly without opening the sd card everytime. That means I want to play the samples from the buffer. Because my samples are very short. I played samples continously but everytime I am opening the sd card. How to play the samples from buffer?. Please find the attachment of the code.
Code: [Select]

boolean buffill()
    {
      boolean ret = false;
      if (play)
      {

        // The buffer must be filled only if the previous buffer was finished to be read

        ret = true;
        // If we the sample read has arrived to the end of the file, we must stop the sample reading
        if (possample >= (endofsample - bufsize))
        {
          closefile = true;

        }

        // OPEN FILE
        if (openfile)
        {
          myFile = SD.open(samplen, O_READ);
          size_t length1 =  myFile.read(&header, sizeof(header));       
          endofsample = header.chunk_size - bufsize;
          length1 = myFile.read(buf, sizeof(buf));
          possample = length1 + sizeof(header);
          openfile = false;
        }
        else
        {
          // CLOSE FILE
          myFile.close();
          play = false;

         }

      }
          return ret;

    }

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy