This commit is contained in:
2026-02-12 21:00:02 -08:00
parent 77f8236347
commit 8bdbf227ca
1141 changed files with 1010880 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.20)
# set the project name
project(min-generator)
set (CMAKE_CXX_STANDARD 11)
set (DCMAKE_CXX_FLAGS "-Werror")
include(FetchContent)
# Deactivate Emulator and Portaudio
set(ADD_ARDUINO_EMULATOR OFF CACHE BOOL "Add Arduino Emulator Library")
set(ADD_PORTAUDIO OFF CACHE BOOL "Add Portaudio Library")
# 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
set_source_files_properties(min-generator.ino PROPERTIES LANGUAGE CXX)
add_executable (min-generator min-generator.ino)
# set preprocessor defines
target_compile_definitions(min-generator PUBLIC -DIS_MIN_DESKTOP)
# specify libraries
target_link_libraries(min-generator arduino-audio-tools)

View File

@@ -0,0 +1,21 @@
# Minimum Desktop Runtime
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.
This example is not using the Arduino-Emulator!
You just need to provide an Arduino Sketch as cpp file. In our example we use an example setup that can be compiled both in Arduin and with cmake:
- the sketch is provided as ino file
- you must not include Arduino.h since this is not available
To build the example execute
```
mkdir build
cd build
cmake ..
make
```

View File

@@ -0,0 +1,26 @@
#include "AudioTools.h"
AudioInfo info(44100, 1, 16);
SineWaveGenerator<int16_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
GeneratedSoundStream<int16_t> in(sineWave); // Stream generated from sine wave
CsvOutput<int16_t> out; // Or use StdOuput
StreamCopy copier(out, in); // copy in to out
// Arduino Setup
void setup(void) {
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
// open output
auto config = out.defaultConfig();
config.copyFrom(info);
out.begin(config);
// Setup sine wave
sineWave.begin(info, N_B4);
}
// Arduino loop
void loop() {
copier.copy();
}