- This topic has 0 replies, 1 voice, and was last updated 8 years, 2 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
|
Microcontroller › Arduino › Need urgent help
Hii all,
I want to play the samples continuosly without opening the sd card everytime. That means I want to play the samples from the buffer. 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.
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;
}