//-------------------------------------------------------------- void testApp::setup() { initInputOutput(); readPlaylist("sounds/lettre/", false); // Jouer un son au hasard //ofSleepMillis(5000); playSound(0); listSounds[0].setVolume(soundVolume); }
//will create new files with the shuffle void writePlaylist(char *songlist ) { FILE *outfp; int songCounter =0; //count how many songs the user has in his/her list char Playlist_of_the_day[7][25] = {"shuffleMonday.txt","shuffleTuesday.txt", "shuffleWednesday.txt","shuffleThursday.txt","shuffleFriday.txt", "shuffleSaturday.txt", "shuffleSunday.txt."}; int i, j; for(i=0; i<7; i++){//performs a shuffle for each day of the week printf("Shuffle Playlist for %s\n",Playlist_of_the_day[i]); if((outfp = fopen(Playlist_of_the_day[i], "w")) ==NULL ) printf("cannot open the file %s\n"); songCounter=0; //resets counter to 0 per day readPlaylist(songlist, &songCounter); shuffle(songlist, songCounter); for(j=0; j<songCounter; j++){ fputs(songlist,outfp); songlist+=100; } fclose (outfp); } }