-
-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58714de
commit 14c24a7
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
examples/examples-audiokit/streams-sd_flac-audiokit/streams-sd_flac-audiokit.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* @file streams-sd-audiokit.ino | ||
* @author Phil Schatzmann | ||
* @brief Just a small demo, how to use files with the SD library with a streaming decoder | ||
* @version 0.1 | ||
* @date 2022-10-09 | ||
* | ||
* @copyright Copyright (c) 2022 | ||
* | ||
*/ | ||
#include <SPI.h> | ||
#include <SD.h> | ||
#include "AudioTools.h" | ||
#include "AudioLibs/AudioBoardStream.h" | ||
#include "AudioCodecs/CodecFLAC.h" | ||
|
||
|
||
const int chipSelect=PIN_AUDIO_KIT_SD_CARD_CS; | ||
AudioBoardStream i2s(AudioKitEs8388V1); // final output of decoded stream | ||
FLACDecoder dec; | ||
StreamCopy copier; | ||
File audioFile; | ||
|
||
void setup(){ | ||
Serial.begin(115200); | ||
AudioLogger::instance().begin(Serial, AudioLogger::Info); | ||
|
||
// setup audiokit before SD! | ||
auto config = i2s.defaultConfig(TX_MODE); | ||
config.sd_active = true; | ||
i2s.begin(config); | ||
|
||
// setup file | ||
SD.begin(chipSelect); | ||
audioFile = SD.open("/flac/test2.flac"); | ||
|
||
// setup decoder | ||
dec.setInputStream(audioFile); | ||
dec.setOutputStream(i2s); | ||
dec.begin(); | ||
|
||
} | ||
|
||
void loop(){ | ||
dec.copy(); | ||
} |
File renamed without changes.