Contrôles: Direction: [Flêches / ZQSD] - A: [J] - B: [K] - Menu: [U] - Home: [I]
Profitez des jeux à pleine vitesse avec son et lumières sur la Gamebuino META !
Emulateur par aoneill
This is a little WAV player.
It will list all WAV files you placed into the "WAVFiles" Folder.
At the moment 100 Files are supported (you can change this at #define MAX_TRACKS 100)
Please don't rename the Folders, because the Player needs a constant path.
Buttons:
A - Start playing of the selected File
UP - Go up
Down - Go down
The wave files included are only for testing and I got them from the "picomon" Game
#include #define MAX_TRACKS 100 const char* path = "/WAVPlayer/WAVFiles/"; String wavFileNames[MAX_TRACKS]; const char* wavFileList[MAX_TRACKS]; String playingTrack = ""; int8_t wavfileCount = 0; int8_t track = -1;void setup() { gb.begin(); SerialUSB.begin(9600); list(); }
void loop() { // put your main code here, to run repeatedly: while (!gb.update()); // clear the previous screen gb.display.clear(); gb.display.println("Playing: "); gb.display.println(playingTrack); gb.display.println(""); gb.display.println("Press A to Stop");
if (gb.buttons.pressed(BUTTON_A)) { gb.sound.stop(track); track = -1; list(); } }
void scan() { wavfileCount = 0; SdBaseFile s; SdFile file; s.open(path, O_READ); while (1) { char name[255]; if (!file.openNext(&s, O_READ)) break; bool isDir = file.isDir(); file.getName(name, 255); file.close(); if (!isDir) { String fileName = String(name); if (fileName.indexOf(".wav") >= 0 || fileName.indexOf(".WAV") >= 0 ) { wavFileNames[wavfileCount] = fileName; wavfileCount++; } } } s.close(); }
void list() { scan(); if (wavfileCount > 0) { for (int i = 0; i < wavfileCount; i++) { wavFileList[i] = (const char *)wavFileNames[i].c_str(); } uint8_t entry = gb.gui.menu("File List", wavFileList, wavfileCount); if (wavFileList[entry] != "") { gb.gui.popup(wavFileList[entry], 200); playingTrack = wavFileList[entry]; String trackPath = String(path) + String(wavFileList[entry]); track = gb.sound.play(trackPath.c_str()); } } }