snapshot
This commit is contained in:
32
libraries/audio-tools/tests-cmake/codec/aac-fdk/aac-fdk.cpp
Normal file
32
libraries/audio-tools/tests-cmake/codec/aac-fdk/aac-fdk.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "Arduino.h"
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioCodecs/CodecAACFDK.h"
|
||||
#include "AudioTools/AudioLibs/PortAudioStream.h"
|
||||
#include "audio.h"
|
||||
|
||||
MemoryStream aac(gs_16b_2c_44100hz_aac, gs_16b_2c_44100hz_aac_len);
|
||||
PortAudioStream portaudio_stream; // Output of sound on desktop
|
||||
EncodedAudioStream dec(&portaudio_stream, new AACDecoderFDK()); // aac data source
|
||||
StreamCopy copier(dec, aac); // copy in to out
|
||||
|
||||
void setup(){
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
dec.addNotifyAudioChange(portaudio_stream);
|
||||
dec.begin();
|
||||
|
||||
portaudio_stream.begin();
|
||||
}
|
||||
|
||||
void loop(){
|
||||
if (aac) {
|
||||
copier.copy();
|
||||
} else {
|
||||
auto info = dec.decoder().audioInfo();
|
||||
LOGI("The audio rate from the aac file is %d", info.sample_rate);
|
||||
LOGI("The channels from the aac file is %d", info.channels);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user