snapshot
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
# set the project name
|
||||
project(aac-fdk-encode)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (DCMAKE_CXX_FLAGS "-Werror")
|
||||
# add_compile_options(-Wstack-usage=1024)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
# Build with arduino-audio-tools
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../.. ${CMAKE_CURRENT_BINARY_DIR}/arduino-audio-tools )
|
||||
endif()
|
||||
|
||||
# Build with arduino-fdk-aac
|
||||
FetchContent_Declare(fdk_aac GIT_REPOSITORY "https://github.com/pschatzmann/arduino-fdk-aac.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(fdk_aac)
|
||||
if(NOT fdk_aac_POPULATED)
|
||||
FetchContent_Populate(fdk_aac)
|
||||
add_subdirectory(${fdk_aac_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/fdk_aac)
|
||||
endif()
|
||||
|
||||
# build sketch as executable
|
||||
add_executable (aac-fdk-encode aac-fdk-encode.cpp )
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(aac-fdk-encode PUBLIC -DARDUINO -DIS_DESKTOP)
|
||||
|
||||
# specify libraries
|
||||
target_link_libraries(aac-fdk-encode arduino_emulator fdk_aac arduino-audio-tools)
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// Simple wrapper for Arduino sketch to compilable with cpp in cmake
|
||||
#include "Arduino.h"
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioCodecs/CodecAACFDK.h"
|
||||
//#include <stdlib.h> // for rand
|
||||
|
||||
|
||||
HexDumpOutput out(Serial);
|
||||
AACEncoderFDK aac(out);
|
||||
AudioInfo info;
|
||||
int16_t buffer[512];
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
info.channels = 1;
|
||||
info.sample_rate = 16000;
|
||||
aac.begin(info);
|
||||
|
||||
Serial.println("starting...");
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
for (int j=0;j<512;j++){
|
||||
buffer[j] = (rand() % 100) - 50;
|
||||
}
|
||||
if (aac.write((uint8_t*)buffer, 512*sizeof(int16_t))){
|
||||
out.flush();
|
||||
Serial.println("512 samples of random data written");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user