Pages: [1]   Go Down
Author Topic: How to get Filename by file index??  (Read 957 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi there

Source:: \arduino-1.0\libraries\MusicShieldNewSDLib\examples\MusicPlayRandomly\MusicPlayRandomly.ino
-------------------------------------------------------------------
#include <Arduino.h>
#include <avr/io.h>
#include "config.h"
#include "player.h"
#include "vs10xx.h"

#include <Fat16.h>
#include <Fat16Util.h>
#include "newSDLib.h"

void setup()
{
  Serial.begin(9600);

  InitSPI();

  InitIOForVs10xx();

  InitIOForKeys();

  InitIOForLEDs();

  Mp3Reset();
  if (!initialSDCard())
    return;

  RED_LED_ON();//light red LED
}

void loop()
{
  file.traverseDir("MP3");//find all the .mp3 files in the root directory.
  while(1)playFile();    //shuffle your music you find in the root directory of SD card.
}

-------------------------------------------------------------------------
Is there anyway to print out the full file name which is playing now??
Many thanks
Logged

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3020
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not even sure how that code you have is supposed to actually work.

If I was trying to solve your problem,  (a) I would get an actual list of filenames,   
(b) select one randomly myself,
(c) print the file name,   
(d) play the music,   

and then repeat from (b).

What is  file.traverseDir()  actually doing,   and where do the results of this function go ?
If the answer to this is,   it is a list stored in the "file" object somewhere,   then why isn't
the following call not  "file.playFile()"  if it is expected to get some information from this object ?



Logged

Pages: [1]   Go Up
Jump to: