Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ option(NEO_BUILD_TESTS "Build unit tests" OFF)

project(neuron VERSION 0.1.0 LANGUAGES CXX)

file(GLOB_RECURSE LIST_DIRECTORIES INCLUDE_DIRS "src/*")
file(GLOB_RECURSE SRC_FILES "src/*.cpp")

add_library(neuron STATIC ${SRC_FILES})
Expand All @@ -25,33 +24,36 @@ else()
CXX_STANDARD_REQUIRED)
endif ()

target_include_directories(neuron
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src)

if (NEO_BUILD_TESTS)
function(add_neuron_test name src)
add_executable("${name}_test_exe" ${src})
target_include_directories("${name}_test_exe" PRIVATE ${INCLUDE_DIRS})
target_link_libraries("${name}_test_exe" neuron)
target_link_libraries("${name}_test_exe" gtest gtest_main)
target_link_libraries("${name}_test_exe" PRIVATE neuron gtest gtest_main)
add_test(NAME "${name}_test" COMMAND "${name}_test_exe")
endfunction()

add_subdirectory(vendor/googletest)

if (NEO_PLUGIN_SUPPORT)
add_neuron_test(parameter_atomic tests/abstractions/parameter_test_atomic.cpp)
add_neuron_test(parameter_atomic tests/core/parameter_test_atomic.cpp)
else ()
add_neuron_test(parameter tests/abstractions/parameter_test.cpp)
add_neuron_test(waveform tests/audio/waveform_test.cpp)
add_neuron_test(oscillator tests/generators/oscillator_test.cpp)
add_neuron_test(adsr tests/modulators/adsr_test.cpp)
add_neuron_test(saturator tests/processors/effects/saturator_test.cpp)
add_neuron_test(wavefolder tests/processors/effects/wavefolder_test.cpp)
add_neuron_test(filter tests/processors/filters/filter_test.cpp)
add_neuron_test(arithmetic tests/utilities/arithmetic_test.cpp)
add_neuron_test(midi tests/utilities/midi_test.cpp)
add_neuron_test(smoothed_value tests/utilities/smoothed_value_test.cpp)
add_neuron_test(parameter tests/core/parameter_test.cpp)
add_neuron_test(waveform tests/utils/waveform_test.cpp)
add_neuron_test(oscillator tests/dsp/generators/oscillator_test.cpp)
add_neuron_test(adsr tests/dsp/modulators/adsr_test.cpp)
add_neuron_test(saturator tests/dsp/processors/saturator_test.cpp)
add_neuron_test(wavefolder tests/dsp/processors/wavefolder_test.cpp)
add_neuron_test(filter tests/dsp/processors/filter_test.cpp)
add_neuron_test(arithmetic tests/utils/arithmetic_test.cpp)
add_neuron_test(midi tests/utils/midi_test.cpp)
add_neuron_test(smoothed_value tests/utils/smoothed_value_test.cpp)
endif ()

enable_testing()
endif ()

target_include_directories(neuron PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src PRIVATE ${INCLUDE_DIRS})
44 changes: 12 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,47 +1,33 @@
TARGET = libneuron

MODULE_DIR = src
INCLUDE_DIR = include
SRC_DIR = src

# Each Module Directory is listed below with it's modules.
# Header only modules are listed commented out
# below the others.

ABSTRACTIONS_MOD_DIR = abstractions
ABSTRACTIONS_MODULES = \

AUDIO_MOD_DIR = audio
AUDIO_MODULES = \

GENERATOR_MOD_DIR = generators
GENERATOR_MOD_DIR = dsp/generators
GENERATOR_MODULES = \
oscillator \

MODULATOR_MOD_DIR = modulators
MODULATOR_MOD_DIR = dsp/modulators
MODULATOR_MODULES = \
adsr \

PROCESSOR_EFFECTS_MOD_DIR = processors/effects
PROCESSOR_EFFECTS_MODULES = \
PROCESSOR_MOD_DIR = dsp/processors
PROCESSOR_MODULES = \
filter \
saturator \
wavefolder \

PROCESSOR_FILTERS_MOD_DIR = processors/filters
PROCESS_FILTERS_MODULES = \
filter \

UTILITY_MOD_DIR = utilities
UTILITY_MODULES = \
logger

######################################
# source
######################################

CPP_SOURCES += $(addsuffix .cpp, $(MODULE_DIR)/$(GENERATOR_MOD_DIR)/$(GENERATOR_MODULES))
CPP_SOURCES += $(addsuffix .cpp, $(MODULE_DIR)/$(MODULATOR_MOD_DIR)/$(MODULATOR_MODULES))
CPP_SOURCES += $(addsuffix .cpp, $(MODULE_DIR)/$(PROCESSOR_EFFECTS_MOD_DIR)/$(PROCESSOR_EFFECTS_MODULES))
CPP_SOURCES += $(addsuffix .cpp, $(MODULE_DIR)/$(PROCESSOR_FILTERS_MOD_DIR)/$(PROCESS_FILTERS_MODULES))
CPP_SOURCES += $(addsuffix .cpp, $(MODULE_DIR)/$(UTILITY_MOD_DIR)/$(UTILITY_MODULES))
CPP_SOURCES += $(addsuffix .cpp, $(SRC_DIR)/$(GENERATOR_MOD_DIR)/$(GENERATOR_MODULES))
CPP_SOURCES += $(addsuffix .cpp, $(SRC_DIR)/$(MODULATOR_MOD_DIR)/$(MODULATOR_MODULES))
CPP_SOURCES += $(addsuffix .cpp, $(SRC_DIR)/$(PROCESSOR_MOD_DIR)/$(PROCESSOR_MODULES))

######################################
# building variables
Expand Down Expand Up @@ -114,14 +100,8 @@ C_DEFS = \
-DSTM32H750xx

C_INCLUDES = \
-I$(MODULE_DIR) \
-I$(MODULE_DIR)/$(ABSTRACTIONS_MOD_DIR) \
-I$(MODULE_DIR)/$(AUDIO_MOD_DIR) \
-I$(MODULE_DIR)/$(GENERATOR_MOD_DIR) \
-I$(MODULE_DIR)/$(MODULATOR_MOD_DIR) \
-I$(MODULE_DIR)/$(PROCESSOR_EFFECTS_MOD_DIR) \
-I$(MODULE_DIR)/$(PROCESSOR_FILTERS_MOD_DIR) \
-I$(MODULE_DIR)/$(UTILITY_MOD_DIR) \
-I$(INCLUDE_DIR) \
-I$(SRC_DIR) \

# compile gcc flags
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "audio/sample.h"
#include "neuron/core/sample.h"

namespace neuron {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#pragma once

#include "abstractions/generator.h"
#include "abstractions/neuron.h"
#include "abstractions/parameter.h"
#include "audio/context.h"
#include "audio/waveform.h"
#include "utilities/arithmetic.h"
#include "neuron/core/base.h"
#include "neuron/core/context.h"
#include "neuron/core/parameter.h"
#include "neuron/dsp/generators/generator.h"
#include "neuron/utils/arithmetic.h"
#include "neuron/utils/waveform.h"

namespace neuron {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include "abstractions/modulator.h"
#include "abstractions/neuron.h"
#include "abstractions/parameter.h"
#include "audio/context.h"
#include "neuron/core/base.h"
#include "neuron/core/context.h"
#include "neuron/core/parameter.h"
#include "neuron/dsp/modulators/modulator.h"

namespace neuron {

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include "abstractions/neuron.h"
#include "abstractions/parameter.h"
#include "abstractions/processor.h"
#include "audio/context.h"
#include "audio/sample.h"
#include "neuron/core/base.h"
#include "neuron/core/context.h"
#include "neuron/core/parameter.h"
#include "neuron/core/sample.h"
#include "neuron/dsp/processors/processor.h"

namespace neuron {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "audio/sample.h"
#include "neuron/core/sample.h"

namespace neuron {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include "abstractions/neuron.h"
#include "abstractions/parameter.h"
#include "abstractions/processor.h"
#include "audio/sample.h"
#include "neuron/core/base.h"
#include "neuron/core/parameter.h"
#include "neuron/core/sample.h"
#include "neuron/dsp/processors/processor.h"

namespace neuron {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "abstractions/neuron.h"
#include "abstractions/parameter.h"
#include "abstractions/processor.h"
#include "neuron/core/base.h"
#include "neuron/core/parameter.h"
#include "neuron/dsp/processors/processor.h"

namespace neuron {

Expand Down
34 changes: 34 additions & 0 deletions include/neuron/neuron.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Neuron is a lightweight audio DSP library intended for use
* in any relevant application e.g. Electrosmith Daisy patches,
* JUCE plugins, VCV Rack modules.
*
* Author: Matthew Maxwell, 2024
*/
#pragma once

#ifndef NEURON_LIB_H
#define NEURON_LIB_H

// CORE
#include "neuron/core/base.h"
#include "neuron/core/context.h"
#include "neuron/core/parameter.h"
#include "neuron/core/sample.h"

// DSP (Generators)
#include "neuron/dsp/generators/generator.h"

// DSP (Modulators)
#include "neuron/dsp/modulators/modulator.h"

// DSP (Processors)
#include "neuron/dsp/processors/processor.h"

// UTILS
#include "neuron/utils/arithmetic.h"
#include "neuron/utils/midi.h"
#include "neuron/utils/smoothed_value.h"
#include "neuron/utils/waveform.h"

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace neuron {

template<typename T>
struct Epsilon {
static constexpr T value = T{1e-5};
static constexpr T value = T { 1e-5 };
};

template<>
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/midi.h → include/neuron/utils/midi.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "utilities/arithmetic.h"
#include "neuron/utils/arithmetic.h"

namespace neuron {

Expand Down
Loading
Loading