43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
/**
|
|
* @file player-sd-audiokit.ino
|
|
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/player-sdmmc-audiokit/README.md
|
|
* Make sure that the pins are set to on, on, on, on, on
|
|
* @author Phil Schatzmann
|
|
* @copyright GPLv3
|
|
*/
|
|
|
|
#include "AudioTools.h"
|
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
|
#include "AudioTools/Disk/AudioSourceSDMMC.h" // or AudioSourceIdxSDMMC.h
|
|
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
|
|
|
|
const char *startFilePath="/";
|
|
const char* ext="mp3";
|
|
AudioSourceSDMMC source(startFilePath, ext);
|
|
AudioBoardStream kit(AudioKitEs8388V1);
|
|
MP3DecoderHelix decoder; // or change to MP3DecoderMAD
|
|
AudioPlayer player(source, kit, decoder);
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
|
|
|
// setup output
|
|
auto cfg = kit.defaultConfig(TX_MODE);
|
|
cfg.sd_active = false;
|
|
kit.begin(cfg);
|
|
|
|
|
|
// setup player
|
|
player.setVolume(0.7);
|
|
player.begin();
|
|
|
|
// select file with setPath() or setIndex()
|
|
//player.setPath("/ZZ Top/Unknown Album/Lowrider.mp3");
|
|
//player.setIndex(1); // 2nd file
|
|
|
|
}
|
|
|
|
void loop() {
|
|
player.copy();
|
|
} |