fork from github
This commit is contained in:
36
examples/PlayWAVFromPROGMEM/PlayWAVFromPROGMEM.ino
Normal file
36
examples/PlayWAVFromPROGMEM/PlayWAVFromPROGMEM.ino
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "AudioFileSourcePROGMEM.h"
|
||||
#include "AudioGeneratorWAV.h"
|
||||
#include "AudioOutputI2SNoDAC.h"
|
||||
|
||||
// VIOLA sample taken from https://ccrma.stanford.edu/~jos/pasp/Sound_Examples.html
|
||||
#include "viola.h"
|
||||
|
||||
AudioGeneratorWAV *wav;
|
||||
AudioFileSourcePROGMEM *file;
|
||||
AudioOutputI2SNoDAC *out;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
Serial.printf("WAV start\n");
|
||||
|
||||
audioLogger = &Serial;
|
||||
file = new AudioFileSourcePROGMEM( viola, sizeof(viola) );
|
||||
out = new AudioOutputI2SNoDAC();
|
||||
wav = new AudioGeneratorWAV();
|
||||
wav->begin(file, out);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
if (wav->isRunning()) {
|
||||
if (!wav->loop()) wav->stop();
|
||||
} else {
|
||||
Serial.printf("WAV done\n");
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user