From bcb9559d59cfdfc4c02f1d2014daf6f3e7c1d5b8 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Mon, 9 Jun 2025 19:56:25 +0200 Subject: [PATCH] move constants.h and the oscillator into libfm from libfmdsp --- CMakeLists.txt | 7 ++++--- dsp/fm_modulator.h | 2 +- {dsp => lib}/constants.h | 0 {dsp => lib}/oscillator.c | 0 {dsp => lib}/oscillator.h | 0 src/chimer95.c | 3 +-- src/dcf95.c | 3 +-- src/fm95.c | 2 +- 8 files changed, 8 insertions(+), 9 deletions(-) rename {dsp => lib}/constants.h (100%) rename {dsp => lib}/oscillator.c (100%) rename {dsp => lib}/oscillator.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99ef69a..647cdfb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,11 +14,11 @@ file(GLOB SRC_FILES "src/*.c") file(GLOB DSP_FILES "dsp/*.c") -# file(GLOB LIB_FILES "lib/*.c") +file(GLOB LIB_FILES "lib/*.c") file(GLOB IO_FILES "io/*.c") -# add_library(libfm OBJECT ${LIB_FILES}) +add_library(libfm OBJECT ${LIB_FILES}) add_library(libfmdsp OBJECT ${DSP_FILES}) @@ -26,11 +26,12 @@ add_library(libfmio OBJECT ${IO_FILES}) # Define DEBUG macro for Debug builds on libraries if(CMAKE_BUILD_TYPE STREQUAL "Debug") + target_compile_definitions(libfm PRIVATE DEBUG=1) target_compile_definitions(libfmdsp PRIVATE DEBUG=1) target_compile_definitions(libfmio PRIVATE DEBUG=1) endif() -set(FM_LIBS libfmio libfmdsp pulse pulse-simple m liquid) +set(FM_LIBS libfm libfmio libfmdsp pulse pulse-simple m liquid) foreach(SRC_FILE ${SRC_FILES}) get_filename_component(EXEC_NAME ${SRC_FILE} NAME_WE) diff --git a/dsp/fm_modulator.h b/dsp/fm_modulator.h index 03b4c7c..9dc314b 100644 --- a/dsp/fm_modulator.h +++ b/dsp/fm_modulator.h @@ -1,6 +1,6 @@ #pragma once -#include "oscillator.h" +#include "../lib/oscillator.h" typedef struct { diff --git a/dsp/constants.h b/lib/constants.h similarity index 100% rename from dsp/constants.h rename to lib/constants.h diff --git a/dsp/oscillator.c b/lib/oscillator.c similarity index 100% rename from dsp/oscillator.c rename to lib/oscillator.c diff --git a/dsp/oscillator.h b/lib/oscillator.h similarity index 100% rename from dsp/oscillator.h rename to lib/oscillator.h diff --git a/src/chimer95.c b/src/chimer95.c index debbe36..7c06334 100644 --- a/src/chimer95.c +++ b/src/chimer95.c @@ -8,8 +8,7 @@ #define buffer_tlength_fragsize 1024 #define buffer_prebuf 0 -#include "../dsp/constants.h" -#include "../dsp/oscillator.h" +#include "../lib/oscillator.h" #include "../lib/optimization.h" #define DEFAULT_FREQ 1000.0f diff --git a/src/dcf95.c b/src/dcf95.c index dbc57a1..11239f3 100644 --- a/src/dcf95.c +++ b/src/dcf95.c @@ -11,8 +11,7 @@ // #define DEBUG -#include "../dsp/constants.h" -#include "../dsp/oscillator.h" +#include "../lib/oscillator.h" #define DEFAULT_FREQ 77500.0f #define DEFAULT_SAMPLE_RATE 192000 diff --git a/src/fm95.c b/src/fm95.c index 25f31d7..da59ec1 100644 --- a/src/fm95.c +++ b/src/fm95.c @@ -20,7 +20,7 @@ #define DEFAULT_MPX_DEVIATION 75000.0f // for BS412 #define DEFAULT_DEVIATION 75000.0f // another way to set the volume -#include "../dsp/oscillator.h" +#include "../lib/oscillator.h" #include "../dsp/filters.h" #include "../dsp/fm_modulator.h" #include "../lib/optimization.h"