Multiple SD card

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Multiple SD card

Post by adafruit_support_rick »

Here's what's happening in that example: The first call plays a complete file. The Arduino is completely blocked from doing anything else until the file finishes playing

Code: Select all

  // Play one file, don't return until complete
  musicPlayer.playFullFile("track001.mp3");
When that file finishes, then the sketch starts playing the second file. However, musicPlayer.startPlayingFile returns immediately, allowing the sketch to get out of setup() and get into loop().

Code: Select all

  // Play another file in the background, REQUIRES interrupts!
  musicPlayer.startPlayingFile("track002.mp3");
Loop runs normally, polling the serial monitor for 's' or 'p' characters. This can all happen because there are interrupts happening in the library. At each interrupt, the library sends another chunk of sound data to the VS1053, and reads another chunk of data from the SD.

This will happen many times before the sound is finally complete. Meanwhile, the sketch is free to do other things. It doesnt have to wait for the sound file to finish playing.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”