Reorganized file structure to allow building Arduino project

This commit is contained in:
Dejvino
2026-02-28 21:49:17 +01:00
parent ef69701878
commit aaeaa9986e
10 changed files with 391 additions and 224 deletions
+18
View File
@@ -0,0 +1,18 @@
# Compiler and flags
CXX = g++
CXXFLAGS = -std=c++17 -Wall -Wextra -I. $(shell sdl2-config --cflags)
LDFLAGS = -ldl -lm -lpthread $(shell sdl2-config --libs)
# Source files
SRCS = main.cpp ../synth_engine.cpp
# Output binary
TARGET = noicesynth_linux
all: $(TARGET)
$(TARGET): $(SRCS)
$(CXX) $(CXXFLAGS) -o $(TARGET) $(SRCS) $(LDFLAGS)
clean:
rm -f $(TARGET)
+43
View File
@@ -0,0 +1,43 @@
# NoiceSynth Linux Emulator
This folder contains a Linux-based prototype for the NoiceSynth engine. It allows you to develop and visualize the DSP code on a desktop computer before deploying it to the RP2040 hardware.
## Architecture
* **Engine (`synth_engine.cpp`):** The exact same C++ code used on the microcontroller. It uses fixed-point math (or integer-based phase accumulation) to generate audio.
* **Host (`main.cpp`):** A Linux wrapper that uses:
* **Miniaudio:** For cross-platform audio output.
* **SDL2:** For real-time oscilloscope visualization.
## Quick Start (Distrobox)
If you don't want to install dependencies manually, use the included script. It creates a lightweight container, installs the tools, and compiles the project.
1. Ensure you have `distrobox` and a container engine (Docker or Podman) installed.
2. Run the build script:
```bash
./compile_with_distrobox.sh
```
3. Run the synthesizer:
```bash
./noicesynth_linux
```
## Manual Build
If you prefer to build directly on your host machine:
1. **Install Dependencies:**
* **Debian/Ubuntu:** `sudo apt install build-essential libsdl2-dev wget`
* **Fedora:** `sudo dnf install gcc-c++ SDL2-devel wget`
* **Arch:** `sudo pacman -S base-devel sdl2 wget`
2. **Download Miniaudio:**
```bash
wget https://raw.githubusercontent.com/mackron/miniaudio/master/miniaudio.h
```
3. **Compile:**
```bash
make
```
+44
View File
@@ -0,0 +1,44 @@
#!/bin/bash
set -e
# Configuration
CONTAINER_NAME="noicesynth-builder"
IMAGE="archlinux:latest"
# 1. Check for Distrobox
if ! command -v distrobox &> /dev/null; then
echo "Error: distrobox is not installed on your system."
exit 1
fi
# 2. Create Container (if it doesn't exist)
# We use Arch Linux for easy access to latest toolchains and SDL2
if ! distrobox list | grep -q "$CONTAINER_NAME"; then
echo "Creating container '$CONTAINER_NAME'..."
distrobox create --image "$IMAGE" --name "$CONTAINER_NAME" --yes
fi
# 3. Execute Build Inside Container
PROJECT_DIR=$(pwd)
echo "Entering container to build..."
distrobox enter "$CONTAINER_NAME" --additional-flags "--workdir $PROJECT_DIR" -- sh -c '
set -e # Ensure script exits on error inside the container too
# A. Install Dependencies (only if missing)
# We check for sdl2-config and wget to see if dev tools are present
if ! command -v sdl2-config &> /dev/null || ! command -v wget &> /dev/null; then
echo "Installing compiler and libraries..."
sudo pacman -Syu --noconfirm base-devel sdl2 wget
fi
# B. Download miniaudio.h (if missing)
if [ ! -f miniaudio.h ]; then
echo "Downloading miniaudio.h..."
wget https://raw.githubusercontent.com/mackron/miniaudio/master/miniaudio.h
fi
# C. Compile
echo "Compiling Project..."
make
'
echo "Build Success! Run ./noicesynth_linux to start the synth."
+1308
View File
File diff suppressed because it is too large Load Diff