mirror of
https://github.com/pschatzmann/arduino-audio-tools.git
synced 2024-09-21 10:27:27 +00:00
cmake cleanup
This commit is contained in:
parent
820359e8a5
commit
95c6b91892
@ -3,9 +3,12 @@ cmake_minimum_required(VERSION 3.0)
|
||||
# set the project name
|
||||
project(arduino-audio-tools)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
add_library(arduino-audio-tools INTERFACE)
|
||||
|
||||
option(BUILD_TESTS "Build all tests automatically" OFF)
|
||||
#option(BUILD_TESTS "Build all tests automatically" OFF)
|
||||
option(ADD_STD_LIB "Add Standard Desktop Libraries" ON)
|
||||
|
||||
|
||||
# make include directory available to calling projects
|
||||
@ -18,8 +21,22 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/" # source directory
|
||||
PATTERN "*.h" # select header files
|
||||
)
|
||||
|
||||
if (BUILD_TESTS)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests)
|
||||
else()
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests EXCLUDE_FROM_ALL)
|
||||
# Add basic libraries necessary for desktop build
|
||||
if (ADD_STD_LIB)
|
||||
|
||||
FetchContent_Declare(portaudio GIT_REPOSITORY "https://github.com/PortAudio/portaudio.git" GIT_TAG v19.7.0 )
|
||||
FetchContent_GetProperties(portaudio)
|
||||
if(NOT portaudio_POPULATED)
|
||||
FetchContent_Populate(portaudio)
|
||||
add_subdirectory(${portaudio_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/portaudio)
|
||||
endif()
|
||||
|
||||
# Build with Linux Arduino Emulator
|
||||
FetchContent_Declare(arduino_emulator GIT_REPOSITORY "https://github.com/pschatzmann/Arduino-Emulator.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(arduino_emulator)
|
||||
if(NOT arduino_emulator_POPULATED)
|
||||
FetchContent_Populate(arduino_emulator)
|
||||
add_subdirectory(${arduino_emulator_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/emulator)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
@ -25,11 +25,8 @@ option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
|
||||
# endif()
|
||||
|
||||
# Build with arduino-audio-tools
|
||||
FetchContent_Declare(arduino_audio_tools GIT_REPOSITORY "https://github.com/pschatzmann/arduino-audio-tools.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(arduino_audio_tools)
|
||||
if(NOT arduino_audio_tools_POPULATED)
|
||||
FetchContent_Populate(arduino_audio_tools)
|
||||
add_subdirectory(${arduino_audio_tools_SOURCE_DIR})
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../.. ${CMAKE_CURRENT_BINARY_DIR}/arduino-audio-tools )
|
||||
endif()
|
||||
|
||||
# build sketch as executable
|
||||
|
@ -8,28 +8,8 @@ set (DCMAKE_CXX_FLAGS "-Werror")
|
||||
include(FetchContent)
|
||||
option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
|
||||
|
||||
# # Build with Portaudio
|
||||
# FetchContent_Declare(portaudio GIT_REPOSITORY "https://github.com/PortAudio/portaudio.git" GIT_TAG master )
|
||||
# FetchContent_GetProperties(portaudio)
|
||||
# if(NOT portaudio_POPULATED)
|
||||
# FetchContent_Populate(portaudio)
|
||||
# add_subdirectory(${portaudio_SOURCE_DIR})
|
||||
# endif()
|
||||
|
||||
# # Build with Linux Arduino Emulator
|
||||
# FetchContent_Declare(arduino_emulator GIT_REPOSITORY "https://github.com/pschatzmann/Arduino-Emulator.git" GIT_TAG main )
|
||||
# FetchContent_GetProperties(arduino_emulator)
|
||||
# if(NOT arduino_emulator_POPULATED)
|
||||
# FetchContent_Populate(arduino_emulator)
|
||||
# add_subdirectory(${arduino_emulator_SOURCE_DIR})
|
||||
# endif()
|
||||
|
||||
# Build with arduino-audio-tools
|
||||
FetchContent_Declare(arduino_audio_tools GIT_REPOSITORY "https://github.com/pschatzmann/arduino-audio-tools.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(arduino_audio_tools)
|
||||
if(NOT arduino_audio_tools_POPULATED)
|
||||
FetchContent_Populate(arduino_audio_tools)
|
||||
add_subdirectory(${arduino_audio_tools_SOURCE_DIR})
|
||||
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 libhelix
|
||||
|
@ -1,52 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
|
||||
# set the project name
|
||||
project(ogg)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (DCMAKE_CXX_FLAGS "-Werror")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
endif()
|
||||
|
||||
include(FetchContent)
|
||||
option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
|
||||
|
||||
|
||||
# Build with Linux Arduino Emulator
|
||||
FetchContent_Declare(arduino_emulator GIT_REPOSITORY "https://github.com/pschatzmann/Arduino-Emulator.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(arduino_emulator)
|
||||
if(NOT arduino_emulator_POPULATED)
|
||||
FetchContent_Populate(arduino_emulator)
|
||||
add_subdirectory(${arduino_emulator_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
# Build with arduino-audio-tools
|
||||
FetchContent_Declare(arduino_audio_tools GIT_REPOSITORY "https://github.com/pschatzmann/arduino-audio-tools.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(arduino_audio_tools)
|
||||
if(NOT arduino_audio_tools_POPULATED)
|
||||
FetchContent_Populate(arduino_audio_tools)
|
||||
add_subdirectory(${arduino_audio_tools_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
# Build with arduino-audio-tools
|
||||
FetchContent_Declare(arduino_libopus GIT_REPOSITORY "https://github.com/pschatzmann/arduino-libopus.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(arduino_libopus)
|
||||
if(NOT arduino_libopus_POPULATED)
|
||||
FetchContent_Populate(arduino_libopus)
|
||||
add_subdirectory(${arduino_libopus_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
# build sketch as executable
|
||||
add_executable (ogg ogg.cpp)
|
||||
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(arduino_emulator PUBLIC -DDEFINE_MAIN -DIS_DESKTOP)
|
||||
target_compile_definitions(ogg PUBLIC -DARDUINO -DEXIT_ON_STOP -DIS_DESKTOP)
|
||||
|
||||
# OS/X might need this setting for core audio
|
||||
#target_compile_definitions(portaudio PUBLIC -DPA_USE_COREAUDIO=1)
|
||||
|
||||
# specify libraries
|
||||
target_link_libraries(ogg arduino_emulator arduino-audio-tools arduino_libopus)
|
||||
|
@ -1,16 +0,0 @@
|
||||
# Playing Sound on your Desktop
|
||||
|
||||
We provide some generic output which will also work on Linux, Windows and OS/X
|
||||
The cmake is downloading all dependencies and builds an executable from the sketch.
|
||||
|
||||
We use the more comprehensive new EncodedAudioStream class.
|
||||
|
||||
You just need to provide an Arduino Sketch as cpp file. To build the example execute:
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
|
@ -95,7 +95,7 @@ struct OpusEncoderSettings : public OpusSettings {
|
||||
/// 0, 1
|
||||
int use_dtx = -1;
|
||||
/// 5, 10, 20, 40, 80, 120, 160, 200, 240
|
||||
int frame_sizes_ms_x2 = 10; /* x2 to avoid 2.5 ms */
|
||||
int frame_sizes_ms_x2 = -1; /* x2 to avoid 2.5 ms */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -257,7 +257,7 @@ class OggContainerEncoder : public AudioEncoder {
|
||||
/// Writes Ogg Packet
|
||||
virtual size_t write(const void *in_ptr, size_t in_size) override {
|
||||
if (!is_open || p_print == nullptr) return 0;
|
||||
LOGD("write: %u", in_size);
|
||||
LOGD("write: %d", (int) in_size);
|
||||
|
||||
op.packet = (uint8_t *)in_ptr;
|
||||
op.bytes = in_size;
|
||||
@ -294,10 +294,10 @@ class OggContainerEncoder : public AudioEncoder {
|
||||
AudioBaseInfo cfg;
|
||||
|
||||
virtual bool writePacket(ogg_packet &op, int flag = 0) {
|
||||
LOGD("writePacket: %u", op.bytes);
|
||||
LOGD("writePacket: %d", (int) op.bytes);
|
||||
long result = oggz_write_feed(p_oggz, &op, serialno, flag, NULL);
|
||||
if (result < 0) {
|
||||
LOGE("oggz_write_feed: %d", result);
|
||||
LOGE("oggz_write_feed: %d", (int) result);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -327,7 +327,7 @@ class OggContainerEncoder : public AudioEncoder {
|
||||
|
||||
// Final Stream Callback
|
||||
static size_t ogg_io_write(void *user_handle, void *buf, size_t n) {
|
||||
LOGD("ogg_io_write: %u", n);
|
||||
LOGD("ogg_io_write: %d", (int) n);
|
||||
OggContainerEncoder *self = (OggContainerEncoder *)user_handle;
|
||||
if (self == nullptr) {
|
||||
LOGE("self is null");
|
||||
|
@ -40,7 +40,6 @@ class PortAudioStream : public AudioStreamX {
|
||||
public:
|
||||
PortAudioStream() {
|
||||
LOGD(LOG_METHOD);
|
||||
this->buffer_size = buffer_size;
|
||||
}
|
||||
|
||||
~PortAudioStream(){
|
||||
|
@ -349,13 +349,13 @@ public:
|
||||
}
|
||||
|
||||
/// Intializes the processing
|
||||
virtual bool begin(){
|
||||
virtual bool begin() override {
|
||||
clear();
|
||||
temp_audio.resize(default_buffer_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void end() {
|
||||
virtual void end() override {
|
||||
clear();
|
||||
}
|
||||
|
||||
@ -648,7 +648,7 @@ class NullStream : public BufferedStream {
|
||||
}
|
||||
|
||||
/// Define object which need to be notified if the basinfo is changing
|
||||
void setNotifyAudioChange(AudioBaseInfoDependent &bi) {}
|
||||
void setNotifyAudioChange(AudioBaseInfoDependent &bi) override {}
|
||||
|
||||
void setAudioInfo(AudioBaseInfo info) override {}
|
||||
|
||||
@ -933,7 +933,7 @@ class VolumeStream : public AudioStreamX {
|
||||
return c;
|
||||
}
|
||||
|
||||
bool begin(AudioBaseInfo cfg){
|
||||
bool begin(AudioBaseInfo cfg) {
|
||||
VolumeStreamConfig cfg1;
|
||||
cfg1.channels = cfg.channels;
|
||||
cfg1.sample_rate = cfg.sample_rate;
|
||||
@ -943,7 +943,7 @@ class VolumeStream : public AudioStreamX {
|
||||
return begin(cfg1);
|
||||
}
|
||||
|
||||
void end() {
|
||||
void end() override {
|
||||
is_active = false;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ class ChannelFormatConverterStreamT : public AudioStreamX {
|
||||
buffer.resize(result_samples);
|
||||
result = converter.convert((uint8_t*)buffer.data(),(uint8_t*) in_data, size);
|
||||
if (result!=result_samples*sizeof(T)){
|
||||
LOGE("size %d -> result: %d - expeced: %d", size, result, result_samples*sizeof(T));
|
||||
LOGE("size %d -> result: %d - expeced: %d", (int) size, (int) result, (int) result_samples*sizeof(T));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -9,24 +9,13 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
endif()
|
||||
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
# Build with Portaudio
|
||||
FetchContent_Declare(portaudio GIT_REPOSITORY "https://github.com/PortAudio/portaudio.git" GIT_TAG v19.7.0 )
|
||||
FetchContent_GetProperties(portaudio)
|
||||
if(NOT portaudio_POPULATED)
|
||||
FetchContent_Populate(portaudio)
|
||||
add_subdirectory(${portaudio_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/portaudio)
|
||||
# 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 Linux Arduino Emulator
|
||||
FetchContent_Declare(arduino_emulator GIT_REPOSITORY "https://github.com/pschatzmann/Arduino-Emulator.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(arduino_emulator)
|
||||
if(NOT arduino_emulator_POPULATED)
|
||||
FetchContent_Populate(arduino_emulator)
|
||||
add_subdirectory(${arduino_emulator_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/emulator)
|
||||
endif()
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/resample ${CMAKE_CURRENT_BINARY_DIR}/resample)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/generator ${CMAKE_CURRENT_BINARY_DIR}/generator)
|
||||
|
@ -28,11 +28,13 @@ if(NOT arduino_emulator_POPULATED)
|
||||
add_subdirectory(${arduino_emulator_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/emulator)
|
||||
endif()
|
||||
|
||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mp3-helix ${CMAKE_CURRENT_BINARY_DIR}/mp3-helix)
|
||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/aac-helix ${CMAKE_CURRENT_BINARY_DIR}/aac-helix)
|
||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/aac-fdk ${CMAKE_CURRENT_BINARY_DIR}/aac-fdk)
|
||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/aac-fdk-encode ${CMAKE_CURRENT_BINARY_DIR}/aac-fdk-encode)
|
||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mp3-lame ${CMAKE_CURRENT_BINARY_DIR}/mp3-lame)
|
||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mp3-mad ${CMAKE_CURRENT_BINARY_DIR}/mp3-mad)
|
||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mp3-metadata ${CMAKE_CURRENT_BINARY_DIR}/mp3-metadata)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/aac-fdk ${CMAKE_CURRENT_BINARY_DIR}/aac-fdk)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/aac-fdk-encode ${CMAKE_CURRENT_BINARY_DIR}/aac-fdk-encode)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mp3-helix ${CMAKE_CURRENT_BINARY_DIR}/mp3-helix)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/aac-helix ${CMAKE_CURRENT_BINARY_DIR}/aac-helix)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mp3-lame ${CMAKE_CURRENT_BINARY_DIR}/mp3-lame)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mp3-mad ${CMAKE_CURRENT_BINARY_DIR}/mp3-mad)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mp3-metadata ${CMAKE_CURRENT_BINARY_DIR}/mp3-metadata)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/opus ${CMAKE_CURRENT_BINARY_DIR}/opus)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/opusogg ${CMAKE_CURRENT_BINARY_DIR}/opusogg)
|
||||
|
||||
|
@ -11,6 +11,11 @@ endif()
|
||||
|
||||
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)
|
||||
@ -20,7 +25,7 @@ if(NOT fdk_aac_POPULATED)
|
||||
endif()
|
||||
|
||||
# build sketch as executable
|
||||
add_executable (aac-fdk-encode aac-fdk-encode.cpp ../main.cpp)
|
||||
add_executable (aac-fdk-encode aac-fdk-encode.cpp ../../main.cpp)
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(aac-fdk-encode PUBLIC -DARDUINO -DEXIT_ON_STOP -DUSE_FDK -DIS_DESKTOP)
|
||||
|
||||
|
@ -10,6 +10,11 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
endif()
|
||||
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)
|
||||
@ -19,7 +24,7 @@ if(NOT fdk_aac_POPULATED)
|
||||
endif()
|
||||
|
||||
# build sketch as executable
|
||||
add_executable (aac-fdk aac-fdk.cpp ../main.cpp)
|
||||
add_executable (aac-fdk aac-fdk.cpp ../../main.cpp)
|
||||
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(aac-fdk PUBLIC -DARDUINO -DEXIT_ON_STOP -DUSE_FDK -DUSE_PORTAUDIO -DIS_DESKTOP)
|
||||
|
@ -10,6 +10,11 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
endif()
|
||||
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 libhelix
|
||||
FetchContent_Declare(helix GIT_REPOSITORY "https://github.com/pschatzmann/arduino-libhelix.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(helix)
|
||||
@ -19,7 +24,7 @@ if(NOT helix_POPULATED)
|
||||
endif()
|
||||
|
||||
# build sketch as executable
|
||||
add_executable (aac-helix aac-helix.cpp ../main.cpp)
|
||||
add_executable (aac-helix aac-helix.cpp ../../main.cpp)
|
||||
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(aac-helix PUBLIC -DARDUINO -DEXIT_ON_STOP -DUSE_HELIX -DUSE_PORTAUDIO -DIS_DESKTOP)
|
||||
|
@ -11,6 +11,11 @@ endif()
|
||||
|
||||
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 helix
|
||||
FetchContent_Declare(helix GIT_REPOSITORY "https://github.com/pschatzmann/arduino-libhelix.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(helix)
|
||||
@ -20,7 +25,7 @@ if(NOT helix_POPULATED)
|
||||
endif()
|
||||
|
||||
# build sketch as executable
|
||||
add_executable (mp3-helix mp3-helix.cpp ../main.cpp)
|
||||
add_executable (mp3-helix mp3-helix.cpp ../../main.cpp)
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(mp3-helix PUBLIC -DARDUINO -DEXIT_ON_STOP -DUSE_HELIX -DUSE_PORTAUDIO -DIS_DESKTOP)
|
||||
|
||||
|
@ -4,13 +4,18 @@ cmake_minimum_required(VERSION 3.20)
|
||||
project(mp3-lame)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (DCMAKE_CXX_FLAGS "-Werror")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
endif()
|
||||
#if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
# set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
#endif()
|
||||
|
||||
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 liblame
|
||||
FetchContent_Declare(arduino_liblame GIT_REPOSITORY "https://github.com/pschatzmann/arduino-liblame.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(arduino_liblame)
|
||||
@ -20,7 +25,7 @@ if(NOT arduino_liblame_POPULATED)
|
||||
endif()
|
||||
|
||||
# build sketch as executable
|
||||
add_executable (mp3-lame mp3-lame.cpp ../main.cpp)
|
||||
add_executable (mp3-lame mp3-lame.cpp ../../main.cpp)
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(mp3-lame PUBLIC -DARDUINO -DEXIT_ON_STOP -DUSE_LAME -DUSE_PORTAUDIO -DIS_DESKTOP)
|
||||
|
||||
|
@ -4,13 +4,19 @@ cmake_minimum_required(VERSION 3.20)
|
||||
project(mp3-mad)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (DCMAKE_CXX_FLAGS "-Werror")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
endif()
|
||||
#if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
# set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
#endif()
|
||||
|
||||
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 libmad
|
||||
FetchContent_Declare(arduino_libmad GIT_REPOSITORY "https://github.com/pschatzmann/arduino-libmad.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(arduino_libmad)
|
||||
@ -19,8 +25,8 @@ if(NOT arduino_libmad_POPULATED)
|
||||
add_subdirectory(${arduino_libmad_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/arduino_libmad)
|
||||
endif()
|
||||
|
||||
# build sketch as executable
|
||||
add_executable (mp3-mad mp3-mad.cpp ../main.cpp)
|
||||
# build sketch as executabl
|
||||
add_executable (mp3-mad mp3-mad.cpp ../../main.cpp)
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(mp3-mad PUBLIC -DARDUINO -DEXIT_ON_STOP -DUSE_MAD -DUSE_PORTAUDIO -DIS_DESKTOP )
|
||||
|
||||
|
@ -9,9 +9,13 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
endif()
|
||||
|
||||
# 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 sketch as executable
|
||||
add_executable (mp3-metadata mp3-metadata.cpp ../main.cpp)
|
||||
add_executable (mp3-metadata mp3-metadata.cpp ../../main.cpp)
|
||||
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(mp3-metadata PUBLIC -DEXIT_ON_STOP -DIS_DESKTOP)
|
||||
|
32
tests/codec/opus/CMakeLists.txt
Normal file
32
tests/codec/opus/CMakeLists.txt
Normal file
@ -0,0 +1,32 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
# set the project name
|
||||
project(opus)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (DCMAKE_CXX_FLAGS "-Werror")
|
||||
|
||||
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 libmad
|
||||
FetchContent_Declare(arduino_libopus GIT_REPOSITORY "https://github.com/pschatzmann/arduino-libopus.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(arduino_libopus)
|
||||
if(NOT arduino_libopus_POPULATED)
|
||||
FetchContent_Populate(arduino_libopus)
|
||||
add_subdirectory(${arduino_libopus_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/arduino_libopus)
|
||||
endif()
|
||||
|
||||
# build sketch as executable
|
||||
add_executable (opus opus.cpp ../../main.cpp)
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(opus PUBLIC -DARDUINO -DEXIT_ON_STOP -DUSE_PORTAUDIO -DIS_DESKTOP )
|
||||
|
||||
# specify libraries
|
||||
target_link_libraries(opus portaudio arduino_emulator arduino_libopus arduino-audio-tools )
|
||||
# ESP32: CONFIG_ARDUINO_LOOP_STACK_SIZE 8192 -> so we test it with this setting "-Wl,-z,stack-size=8192"
|
||||
# add_link_options("-z,stack-size=8192")
|
||||
|
58
tests/codec/opus/opus.cpp
Normal file
58
tests/codec/opus/opus.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @file test-codec-opus.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief generate sine wave -> encoder -> decoder -> audiokit (i2s)
|
||||
* @version 0.1
|
||||
* @date 2022-04-30
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include "AudioTools.h"
|
||||
#include "AudioCodecs/CodecOpus.h"
|
||||
|
||||
int sample_rate = 24000;
|
||||
int channels = 2; // The stream will have 2 channels
|
||||
int application = OPUS_APPLICATION_AUDIO; // Opus application
|
||||
|
||||
SineWaveGenerator<int16_t> sineWave( 32000); // subclass of SoundGenerator with max amplitude of 32000
|
||||
GeneratedSoundStream<int16_t> sound( sineWave); // Stream generated from sine wave
|
||||
CsvStream<int16_t> out(Serial, 2); // Output of sound on desktop
|
||||
OpusAudioEncoder enc;
|
||||
EncodedAudioStream decoder(&out, new OpusAudioDecoder()); // encode and write
|
||||
EncodedAudioStream encoder(&decoder, &enc); // encode and write
|
||||
StreamCopy copier(encoder, sound);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioLogger::instance().begin(Serial, AudioLogger::Debug);
|
||||
|
||||
// start I2S
|
||||
Serial.println("starting I2S...");
|
||||
auto cfgi = out.defaultConfig(TX_MODE);
|
||||
cfgi.sample_rate = sample_rate;
|
||||
cfgi.channels = channels;
|
||||
cfgi.bits_per_sample = 16;
|
||||
out.begin(cfgi);
|
||||
|
||||
// Setup sine wave
|
||||
auto cfgs = sineWave.defaultConfig();
|
||||
cfgs.sample_rate = sample_rate;
|
||||
cfgs.channels = channels;
|
||||
cfgs.bits_per_sample = 16;
|
||||
sineWave.begin(cfgs, N_B4);
|
||||
|
||||
// Opus decoder needs to know the audio info
|
||||
decoder.begin(cfgs);
|
||||
|
||||
// configure and start encoder
|
||||
enc.config().application = application;
|
||||
encoder.begin(cfgs);
|
||||
|
||||
Serial.println("Test started...");
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
32
tests/codec/opusogg/CMakeLists.txt
Normal file
32
tests/codec/opusogg/CMakeLists.txt
Normal file
@ -0,0 +1,32 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
# set the project name
|
||||
project(opusogg)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (DCMAKE_CXX_FLAGS "-Werror")
|
||||
|
||||
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 libmad
|
||||
FetchContent_Declare(arduino_libopus GIT_REPOSITORY "https://github.com/pschatzmann/arduino-libopus.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(arduino_libopus)
|
||||
if(NOT arduino_libopus_POPULATED)
|
||||
FetchContent_Populate(arduino_libopus)
|
||||
add_subdirectory(${arduino_libopus_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
# build sketch as executable
|
||||
add_executable (opusogg opusogg.cpp ../../main.cpp)
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(opusogg PUBLIC -DARDUINO -DEXIT_ON_STOP -DUSE_PORTAUDIO -DIS_DESKTOP )
|
||||
|
||||
# specify libraries
|
||||
target_link_libraries(opusogg portaudio arduino_emulator arduino_libopus arduino-audio-tools )
|
||||
# ESP32: CONFIG_ARDUINO_LOOP_STACK_SIZE 8192 -> so we test it with this setting "-Wl,-z,stack-size=8192"
|
||||
# add_link_options("-z,stack-size=8192")
|
||||
|
@ -1,5 +1,13 @@
|
||||
// Simple wrapper for Arduino sketch to compilable with cpp in cmake
|
||||
#include "Arduino.h"
|
||||
/**
|
||||
* @file test-codec-opusogg.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief generate sine wave -> encoder -> decoder -> audiokit (i2s)
|
||||
* @version 0.1
|
||||
* @date 2022-04-30
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include "AudioTools.h"
|
||||
#include "AudioCodecs/CodecOpusOgg.h"
|
||||
|
||||
@ -9,7 +17,7 @@ int application = OPUS_APPLICATION_AUDIO; // Opus application
|
||||
|
||||
SineWaveGenerator<int16_t> sineWave( 32000); // subclass of SoundGenerator with max amplitude of 32000
|
||||
GeneratedSoundStream<int16_t> sound( sineWave); // Stream generated from sine wave
|
||||
HexDumpStream out(Serial);
|
||||
CsvStream<int16_t> out(Serial, channels); // Output of sound on desktop
|
||||
OpusOggEncoder enc;
|
||||
EncodedAudioStream decoder(&out, new OpusOggDecoder()); // encode and write
|
||||
EncodedAudioStream encoder(&decoder, &enc); // encode and write
|
||||
@ -17,9 +25,15 @@ StreamCopy copier(encoder, sound);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioLogger::instance().begin(Serial, AudioLogger::Warning);
|
||||
AudioLogger::instance().begin(Serial, AudioLogger::Debug);
|
||||
|
||||
out.begin();
|
||||
// start I2S
|
||||
// Serial.println("starting I2S...");
|
||||
// auto cfgi = out.defaultConfig(TX_MODE);
|
||||
// cfgi.sample_rate = sample_rate;
|
||||
// cfgi.channels = channels;
|
||||
// cfgi.bits_per_sample = 16;
|
||||
// out.begin(cfgi);
|
||||
|
||||
// Setup sine wave
|
||||
auto cfgs = sineWave.defaultConfig();
|
@ -9,6 +9,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
endif()
|
||||
|
||||
# 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 sketch as executable
|
||||
add_executable (effects effects.cpp ../main.cpp)
|
||||
# set preprocessor defines
|
||||
|
@ -9,6 +9,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
endif()
|
||||
|
||||
# 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 sketch as executable
|
||||
add_executable (filter-wav filter-wav.cpp ../main.cpp )
|
||||
|
@ -9,6 +9,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
endif()
|
||||
|
||||
# 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 sketch as executable
|
||||
add_executable (filter filter.cpp ../main.cpp)
|
||||
|
@ -9,6 +9,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
endif()
|
||||
|
||||
# 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 sketch as executable
|
||||
add_executable (generator_test generator.cpp ../main.cpp)
|
||||
|
@ -9,6 +9,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
|
||||
endif()
|
||||
|
||||
# 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 sketch as executable
|
||||
add_executable (resample resample.cpp ../main.cpp)
|
||||
|
@ -11,6 +11,11 @@ endif()
|
||||
|
||||
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 sketch as executable
|
||||
add_executable (url-test url-test.cpp ../main.cpp)
|
||||
# set preprocessor defines
|
||||
|
Loading…
Reference in New Issue
Block a user