diff --git a/.gitignore b/.gitignore
index f932f6d..4a91166 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,4 +39,5 @@ Releases/*
**/.DS_Store
!VC_redist.x64.exe
outputLeft.bin
-outputRight.bin
\ No newline at end of file
+outputRight.bin
+include/config.h
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..b9d640c
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.10)
+
+project(CloudSeedCore VERSION 1.0)
+
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD_REQUIRED True)
+
+add_subdirectory(DSP)
+
+add_executable(CloudSeedDemo
+ PluginProcessor.cpp
+)
+
+set(CLOUDSEED_MAX_BUFFER_SIZE 1024 CACHE STRING "Maximum allocated and supported buffer size for CloudSeedCore")
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/config.h
+)
+
+include_directories(PRIVATE CLoudSeedCore
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+)
+
+target_compile_definitions(CloudSeedDemo PUBLIC
+ MAX_STR_SIZE=32
+)
+
+if(WIN32)
+ target_compile_definitions(CloudSeedCore PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN)
+endif()
+
+target_link_libraries(CloudSeedDemo PRIVATE CloudSeedCore)
diff --git a/CloudSeedCore.sln b/CloudSeedCore.sln
deleted file mode 100644
index ce2fa61..0000000
--- a/CloudSeedCore.sln
+++ /dev/null
@@ -1,31 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.7.34221.43
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CloudSeedCore", "CloudSeedCore.vcxproj", "{7EC3FD43-1E45-4046-BEDF-33861EF49015}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {7EC3FD43-1E45-4046-BEDF-33861EF49015}.Debug|x64.ActiveCfg = Debug|x64
- {7EC3FD43-1E45-4046-BEDF-33861EF49015}.Debug|x64.Build.0 = Debug|x64
- {7EC3FD43-1E45-4046-BEDF-33861EF49015}.Debug|x86.ActiveCfg = Debug|Win32
- {7EC3FD43-1E45-4046-BEDF-33861EF49015}.Debug|x86.Build.0 = Debug|Win32
- {7EC3FD43-1E45-4046-BEDF-33861EF49015}.Release|x64.ActiveCfg = Release|x64
- {7EC3FD43-1E45-4046-BEDF-33861EF49015}.Release|x64.Build.0 = Release|x64
- {7EC3FD43-1E45-4046-BEDF-33861EF49015}.Release|x86.ActiveCfg = Release|Win32
- {7EC3FD43-1E45-4046-BEDF-33861EF49015}.Release|x86.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {984BFEEF-D2E4-4A1A-968E-CD3044280064}
- EndGlobalSection
-EndGlobal
diff --git a/CloudSeedCore.vcxproj b/CloudSeedCore.vcxproj
deleted file mode 100644
index 94a5f5b..0000000
--- a/CloudSeedCore.vcxproj
+++ /dev/null
@@ -1,155 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 17.0
- Win32Proj
- {7ec3fd43-1e45-4046-bedf-33861ef49015}
- CloudSeedCore
- 10.0
-
-
-
- Application
- true
- v143
- Unicode
-
-
- Application
- false
- v143
- true
- Unicode
-
-
- Application
- true
- v143
- Unicode
-
-
- Application
- false
- v143
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Level3
- true
- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- true
-
-
- Console
- true
-
-
-
-
- Level3
- true
- true
- true
- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
- true
-
-
- Console
- true
- true
- true
-
-
-
-
- Level3
- true
- _DEBUG;_CONSOLE;BUFFER_SIZE=1024;MAX_STR_SIZE=32;%(PreprocessorDefinitions)
- true
-
-
- Console
- true
-
-
-
-
- Level3
- true
- true
- true
- NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
- true
-
-
- Console
- true
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/CloudSeedCore.vcxproj.filters b/CloudSeedCore.vcxproj.filters
deleted file mode 100644
index 0f6ec53..0000000
--- a/CloudSeedCore.vcxproj.filters
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
- {d1a62df7-fbd4-4696-b69e-0dfb810054a1}
-
-
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files\DSP
-
-
- Source Files\DSP
-
-
-
-
- Source Files
-
-
- Source Files\DSP
-
-
- Source Files\DSP
-
-
- Source Files\DSP
-
-
- Source Files\DSP
-
-
- Source Files\DSP
-
-
- Source Files\DSP
-
-
- Source Files\DSP
-
-
- Source Files\DSP
-
-
- Source Files\DSP
-
-
- Source Files\DSP
-
-
- Source Files\DSP
-
-
- Source Files\DSP
-
-
- Source Files\DSP
-
-
- Source Files
-
-
-
\ No newline at end of file
diff --git a/DSP/AllpassDiffuser.h b/DSP/AllpassDiffuser.h
index 7702b3e..343b5c2 100644
--- a/DSP/AllpassDiffuser.h
+++ b/DSP/AllpassDiffuser.h
@@ -23,6 +23,7 @@ THE SOFTWARE.
#pragma once
#include
+#include "config.h"
#include "ModulatedAllpass.h"
#include "RandomBuffer.h"
@@ -113,7 +114,7 @@ namespace Cloudseed
void SetModAmount(float amount)
{
for (int i = 0; i < MaxStageCount; i++)
- filters[i].ModAmount = amount * (0.85 + 0.3 * seedValues[MaxStageCount + i]);
+ filters[i].ModAmount = static_cast(amount * (0.85 + 0.3 * seedValues[MaxStageCount + i]));
}
void SetModRate(float rate)
@@ -121,12 +122,12 @@ namespace Cloudseed
modRate = rate;
for (int i = 0; i < MaxStageCount; i++)
- filters[i].ModRate = rate * (0.85 + 0.3 * seedValues[MaxStageCount * 2 + i]) / samplerate;
+ filters[i].ModRate = static_cast(rate * (0.85 + 0.3 * seedValues[MaxStageCount * 2 + i]) / samplerate);
}
void Process(float* input, float* output, int bufSize)
{
- float tempBuffer[BUFFER_SIZE];
+ float tempBuffer[MAX_BUFFER_SIZE];
filters[0].Process(input, tempBuffer, bufSize);
diff --git a/DSP/CMakeLists.txt b/DSP/CMakeLists.txt
new file mode 100644
index 0000000..0b71e1d
--- /dev/null
+++ b/DSP/CMakeLists.txt
@@ -0,0 +1,19 @@
+add_library(CloudSeedCore STATIC
+ AllpassDiffuser.h
+ Biquad.cpp
+ Biquad.h
+ DelayLine.h
+ Hp1.h
+ LcgRandom.h
+ Lp1.h
+ ModulatedAllpass.h
+ ModulatedDelay.h
+ MultitapDelay.h
+ RandomBuffer.cpp
+ RandomBuffer.h
+ ReverbChannel.h
+ ReverbController.h
+ Utils.h
+ ../Parameters.cpp
+ ../Parameters.h
+)
diff --git a/DSP/DelayLine.h b/DSP/DelayLine.h
index e6b3ba5..dd8da4f 100644
--- a/DSP/DelayLine.h
+++ b/DSP/DelayLine.h
@@ -44,7 +44,7 @@ namespace Cloudseed
void Reset()
{
- for (int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++)
buffer[i] = 0.0f;
idxRead = 0;
idxWrite = 0;
@@ -56,7 +56,7 @@ namespace Cloudseed
return count;
}
- int PushZeros(float* data, int bufSize)
+ int PushZeros(float* /*data*/, int bufSize)
{
int countBefore = count;
for (int i = 0; i < bufSize; i++)
@@ -79,7 +79,7 @@ namespace Cloudseed
buffer[idxWrite] = data[i];
idxWrite = (idxWrite + 1) % N;
count++;
- if (count >= N)
+ if (count >= (int)N)
break; // overflow
}
@@ -116,7 +116,7 @@ namespace Cloudseed
Biquad lowShelf;
Biquad highShelf;
Lp1 lowPass;
- CircularBuffer<2*BUFFER_SIZE> feedbackBuffer;
+ CircularBuffer<2*MAX_BUFFER_SIZE> feedbackBuffer;
float feedback;
public:
@@ -241,7 +241,7 @@ namespace Cloudseed
void Process(float* input, float* output, int bufSize)
{
- float tempBuffer[BUFFER_SIZE];
+ float tempBuffer[MAX_BUFFER_SIZE];
feedbackBuffer.Pop(tempBuffer, bufSize);
for (int i = 0; i < bufSize; i++)
diff --git a/DSP/Hp1.h b/DSP/Hp1.h
index 3fe8544..027168e 100644
--- a/DSP/Hp1.h
+++ b/DSP/Hp1.h
@@ -22,7 +22,6 @@ THE SOFTWARE.
#pragma once
-#define _USE_MATH_DEFINES
#include
namespace Cloudseed
@@ -80,7 +79,7 @@ namespace Cloudseed
if (cutoffHz >= fs * 0.5f)
cutoffHz = fs * 0.499f;
- auto x = 2.0f * M_PI * cutoffHz / fs;
+ auto x = static_cast(2.0f * M_PI * cutoffHz / fs);
auto nn = (2.0f - cosf(x));
auto alpha = nn - sqrtf(nn * nn - 1);
diff --git a/DSP/Lp1.h b/DSP/Lp1.h
index 61b4199..27c40c5 100644
--- a/DSP/Lp1.h
+++ b/DSP/Lp1.h
@@ -22,7 +22,6 @@ THE SOFTWARE.
#pragma once
-#define _USE_MATH_DEFINES
#include
namespace Cloudseed
@@ -77,7 +76,7 @@ namespace Cloudseed
if (cutoffHz >= fs * 0.5f)
cutoffHz = fs * 0.499f;
- auto x = 2.0f * M_PI * cutoffHz / fs;
+ auto x = static_cast(2.0f * M_PI * cutoffHz / fs);
auto nn = (2.0f - cosf(x));
auto alpha = nn - sqrtf(nn * nn - 1);
diff --git a/DSP/ModulatedAllpass.h b/DSP/ModulatedAllpass.h
index a661fa7..9a78388 100644
--- a/DSP/ModulatedAllpass.h
+++ b/DSP/ModulatedAllpass.h
@@ -60,7 +60,7 @@ namespace Cloudseed
index = DelayBufferSize - 1;
samplesProcessed = 0;
- modPhase = 0.01 + 0.98 * std::rand() / (float)RAND_MAX;
+ modPhase = static_cast(0.01 + 0.98 * std::rand() / (float)RAND_MAX);
delayA = 0;
delayB = 0;
gainA = 0;
@@ -162,9 +162,9 @@ namespace Cloudseed
{
modPhase += ModRate * ModulationUpdateRate;
if (modPhase > 1)
- modPhase = std::fmod(modPhase, 1.0);
+ modPhase = std::fmod(modPhase, 1.0f);
- auto mod = std::sinf(modPhase * 2 * M_PI);
+ auto mod = sinf(static_cast(modPhase * 2 * M_PI));
if (ModAmount >= SampleDelay) // don't modulate to negative value
ModAmount = SampleDelay - 1;
diff --git a/DSP/ModulatedDelay.h b/DSP/ModulatedDelay.h
index 9e26984..2ab2799 100644
--- a/DSP/ModulatedDelay.h
+++ b/DSP/ModulatedDelay.h
@@ -58,7 +58,7 @@ namespace Cloudseed
readIndexB = 0;
samplesProcessed = 0;
- modPhase = 0.01 + 0.98 * (std::rand() / (float)RAND_MAX);
+ modPhase = static_cast(0.01 + 0.98 * (std::rand() / (float)RAND_MAX));
gainA = 0;
gainB = 0;
@@ -103,9 +103,9 @@ namespace Cloudseed
{
modPhase += ModRate * ModulationUpdateRate;
if (modPhase > 1)
- modPhase = std::fmod(modPhase, 1.0);
+ modPhase = std::fmod(modPhase, 1.0f);
- auto mod = std::sinf(modPhase * 2 * M_PI);
+ auto mod = sinf(static_cast(modPhase * 2 * M_PI));
auto totalDelay = SampleDelay + ModAmount * mod;
auto delayA = (int)totalDelay;
diff --git a/DSP/MultitapDelay.h b/DSP/MultitapDelay.h
index 982bc6b..8e4a7fc 100644
--- a/DSP/MultitapDelay.h
+++ b/DSP/MultitapDelay.h
@@ -99,7 +99,7 @@ namespace Cloudseed
void Process(float* input, float* output, int bufSize)
{
float lengthScaler = lengthSamples / (float)count;
- float totalGain = 3.0 / std::sqrtf(1 + count);
+ float totalGain = 3.0f / sqrtf(1 + count);
totalGain *= (1 + decay * 2);
for (int i = 0; i < bufSize; i++)
@@ -110,7 +110,7 @@ namespace Cloudseed
for (int j = 0; j < count; j++)
{
float offset = tapPosition[j] * lengthScaler;
- float decayEffective = std::expf(-offset / lengthSamples * 3.3) * decay + (1-decay);
+ float decayEffective = expf(-offset / lengthSamples * 3.3f) * decay + (1-decay);
int readIdx = writeIdx - (int)offset;
if (readIdx < 0) readIdx += DelayBufferSize;
diff --git a/DSP/ReverbChannel.h b/DSP/ReverbChannel.h
index 570d78b..bd944ee 100644
--- a/DSP/ReverbChannel.h
+++ b/DSP/ReverbChannel.h
@@ -22,6 +22,9 @@ THE SOFTWARE.
#pragma once
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wshadow"
+
#include