Gjorde en enkel körbar EXE för Windows av allt detta

This commit is contained in:
crille committed 2026-11-21 18:23:26 +01:00
1 parent 3f3fdeddf3
commit ee80ef7d89
15 files changed
+180 -498

No files matched your search

+7 -8
View File
@@ -25,15 +25,14 @@ Desktop.ini
*.component *.component
*.aaxplugin *.aaxplugin
# Keep release builds in Git # Keep Windows release builds in Git
!Release/ !Release/
!Release/*.vst3/ !Release/Windows/
!Release/*.vst3/** !Release/Windows/**
!Release/Windows/**/*.exe
!Release/Windows/**/*.vst3/
!Release/Windows/**/*.vst3/**
# Temporary files # Temporary files
*.tmp *.tmp
*.log *.log
# Allow packaged release plugins
!Release/
!Release/**
+77 -30
View File
@@ -3,29 +3,26 @@ project(CrilleBassStrip VERSION 1.0.0 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum macOS version")
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
JUCE JUCE
GIT_REPOSITORY https://github.com/juce-framework/JUCE.git GIT_REPOSITORY https://github.com/juce-framework/JUCE.git
GIT_TAG 8.0.6 GIT_TAG 8.0.6
GIT_SHALLOW TRUE GIT_SHALLOW TRUE
) )
FetchContent_MakeAvailable(JUCE) FetchContent_MakeAvailable(JUCE)
if(APPLE) set(VST3_INSTALL_DIR "C:/Program Files/Common Files/VST3")
set(VST3_INSTALL_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/VST3") set(RELEASE_DIR "${CMAKE_SOURCE_DIR}/Release")
elseif(WIN32) set(ASIO_SDK_DIR "C:/SDK/asio" CACHE PATH "Path to the Steinberg ASIO SDK")
set(VST3_INSTALL_DIR "C:/Program Files/Common Files/VST3")
endif()
juce_add_plugin(CrilleBassStrip juce_add_plugin(CrilleBassStrip
COMPANY_NAME "Crille Audio" COMPANY_NAME "Crille Audio"
BUNDLE_ID "org.crilleaudio.crillebassstrip" BUNDLE_ID "org.crilleaudio.crillebassstrip"
PLUGIN_MANUFACTURER_CODE Cril PLUGIN_MANUFACTURER_CODE Cril
PLUGIN_CODE CbSt PLUGIN_CODE CbSt
FORMATS VST3 Standalone FORMATS VST3
PRODUCT_NAME "Crille Bass Strip" PRODUCT_NAME "Crille Bass Strip"
COPY_PLUGIN_AFTER_BUILD TRUE COPY_PLUGIN_AFTER_BUILD TRUE
VST3_COPY_DIR "${VST3_INSTALL_DIR}" VST3_COPY_DIR "${VST3_INSTALL_DIR}"
@@ -34,34 +31,84 @@ juce_add_plugin(CrilleBassStrip
juce_generate_juce_header(CrilleBassStrip) juce_generate_juce_header(CrilleBassStrip)
target_sources(CrilleBassStrip PRIVATE target_sources(CrilleBassStrip PRIVATE
Source/PluginProcessor.cpp Source/PluginProcessor.cpp
Source/PluginProcessor.h Source/PluginProcessor.h
Source/PluginEditor.cpp Source/PluginEditor.cpp
Source/PluginEditor.h Source/PluginEditor.h
) )
target_compile_definitions(CrilleBassStrip PUBLIC target_compile_definitions(CrilleBassStrip PUBLIC
JUCE_WEB_BROWSER=0 JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0 JUCE_USE_CURL=0
JUCE_VST3_CAN_REPLACE_VST2=0 JUCE_VST3_CAN_REPLACE_VST2=0
JUCE_ASIO=1
)
target_include_directories(CrilleBassStrip PRIVATE
"${ASIO_SDK_DIR}/common"
"${ASIO_SDK_DIR}/host"
"${ASIO_SDK_DIR}/host/pc"
) )
target_link_libraries(CrilleBassStrip PRIVATE target_link_libraries(CrilleBassStrip PRIVATE
juce::juce_audio_utils juce::juce_audio_utils
juce::juce_dsp juce::juce_dsp
PUBLIC juce::juce_recommended_config_flags PUBLIC
juce::juce_recommended_lto_flags juce::juce_recommended_config_flags
juce::juce_recommended_warning_flags juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags
) )
# Copy the finished VST3 to Release/ after build
set(RELEASE_DIR "${CMAKE_SOURCE_DIR}/Release")
add_custom_command(TARGET CrilleBassStrip_VST3 POST_BUILD add_custom_command(TARGET CrilleBassStrip_VST3 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${RELEASE_DIR}" COMMAND ${CMAKE_COMMAND} -E make_directory "${RELEASE_DIR}/Windows/VST3"
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
"$<TARGET_FILE_DIR:CrilleBassStrip_VST3>/../.." "$<TARGET_FILE_DIR:CrilleBassStrip_VST3>/../.."
"${RELEASE_DIR}/Crille Bass Strip.vst3" "${RELEASE_DIR}/Windows/VST3/Crille Bass Strip.vst3"
COMMENT "Copying Windows VST3 to Release"
)
COMMENT "Copying Crille Bass Strip.vst3 to Release" juce_add_gui_app(CrilleBassStripApp
) PRODUCT_NAME "Crille Bass Strip"
COMPANY_NAME "Crille Audio"
BUNDLE_ID "org.crilleaudio.crillebassstrip"
)
juce_generate_juce_header(CrilleBassStripApp)
target_sources(CrilleBassStripApp PRIVATE
Source/StandaloneMain.cpp
Source/StandaloneMain.h
Source/PluginProcessor.cpp
Source/PluginProcessor.h
Source/PluginEditor.cpp
Source/PluginEditor.h
)
target_compile_definitions(CrilleBassStripApp PRIVATE
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
JUCE_ASIO=1
)
target_include_directories(CrilleBassStripApp PRIVATE
"${ASIO_SDK_DIR}/common"
"${ASIO_SDK_DIR}/host"
"${ASIO_SDK_DIR}/host/pc"
)
target_link_libraries(CrilleBassStripApp PRIVATE
juce::juce_audio_utils
juce::juce_dsp
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags
)
add_custom_command(TARGET CrilleBassStripApp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${RELEASE_DIR}/Windows/Standalone"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:CrilleBassStripApp>"
"${RELEASE_DIR}/Windows/Standalone/Crille Bass Strip.exe"
COMMENT "Copying Windows standalone app to Release"
)
@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist>
<dict>
<key>CFBundleExecutable</key>
<string>Crille Bass Strip</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.crilleaudio.crillebassstrip</string>
<key>CFBundleName</key>
<string>Crille Bass Strip</string>
<key>CFBundleDisplayName</key>
<string>Crille Bass Strip</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
@@ -1 +0,0 @@
BNDL????
@@ -1,58 +0,0 @@
{
"Name": "Crille Bass Strip",
"Version": "1.0.0",
"Factory Info": {
"Vendor": "Crille Audio",
"URL": "",
"E-Mail": "",
"Flags": {
"Unicode": true,
"Classes Discardable": false,
"Component Non Discardable": false,
},
},
"Classes": [
{
"CID": "ABCDEF019182FAEB4372696C43625374",
"Category": "Audio Module Class",
"Name": "Crille Bass Strip",
"Vendor": "Crille Audio",
"Version": "1.0.0",
"SDKVersion": "VST 3.7.12",
"Sub Categories": [
"Fx",
],
"Class Flags": 0,
"Cardinality": 2147483647,
"Snapshots": [
],
},
{
"CID": "ABCDEF011234ABCD4372696C43625374",
"Category": "Component Controller Class",
"Name": "Crille Bass Strip",
"Vendor": "Crille Audio",
"Version": "1.0.0",
"SDKVersion": "VST 3.7.12",
"Sub Categories": [
"Fx",
],
"Class Flags": 0,
"Cardinality": 2147483647,
"Snapshots": [
],
},
{
"CID": "ABCDEF01C0DEF00D4372696C43625374",
"Category": "Plugin Compatibility Class",
"Name": "Crille Bass Strip",
"Vendor": "Crille Audio",
"Version": "1.0.0",
"SDKVersion": "VST 3.7.12",
"Class Flags": 0,
"Cardinality": 2147483647,
"Snapshots": [
],
},
],
}
@@ -1,128 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Resources/moduleinfo.json</key>
<data>
bFD29tJv6hrtbKMokE84EB4dwr0=
</data>
</dict>
<key>files2</key>
<dict>
<key>Resources/moduleinfo.json</key>
<dict>
<key>hash2</key>
<data>
D09kULg/Fy2wnoSoXvTzay4l3BGUVem8xqCtDmO41uk=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist>
<dict>
<key>CFBundleExecutable</key>
<string>Crille Bass Strip</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.crilleaudio.crillebassstrip</string>
<key>CFBundleName</key>
<string>Crille Bass Strip</string>
<key>CFBundleDisplayName</key>
<string>Crille Bass Strip</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
@@ -1 +0,0 @@
BNDL????
@@ -1,58 +0,0 @@
{
"Name": "Crille Bass Strip",
"Version": "1.0.0",
"Factory Info": {
"Vendor": "Crille Audio",
"URL": "",
"E-Mail": "",
"Flags": {
"Unicode": true,
"Classes Discardable": false,
"Component Non Discardable": false,
},
},
"Classes": [
{
"CID": "ABCDEF019182FAEB4372696C43625374",
"Category": "Audio Module Class",
"Name": "Crille Bass Strip",
"Vendor": "Crille Audio",
"Version": "1.0.0",
"SDKVersion": "VST 3.7.12",
"Sub Categories": [
"Fx",
],
"Class Flags": 0,
"Cardinality": 2147483647,
"Snapshots": [
],
},
{
"CID": "ABCDEF011234ABCD4372696C43625374",
"Category": "Component Controller Class",
"Name": "Crille Bass Strip",
"Vendor": "Crille Audio",
"Version": "1.0.0",
"SDKVersion": "VST 3.7.12",
"Sub Categories": [
"Fx",
],
"Class Flags": 0,
"Cardinality": 2147483647,
"Snapshots": [
],
},
{
"CID": "ABCDEF01C0DEF00D4372696C43625374",
"Category": "Plugin Compatibility Class",
"Name": "Crille Bass Strip",
"Vendor": "Crille Audio",
"Version": "1.0.0",
"SDKVersion": "VST 3.7.12",
"Class Flags": 0,
"Cardinality": 2147483647,
"Snapshots": [
],
},
],
}
@@ -1,128 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Resources/moduleinfo.json</key>
<data>
bFD29tJv6hrtbKMokE84EB4dwr0=
</data>
</dict>
<key>files2</key>
<dict>
<key>Resources/moduleinfo.json</key>
<dict>
<key>hash2</key>
<data>
D09kULg/Fy2wnoSoXvTzay4l3BGUVem8xqCtDmO41uk=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
+95 -27
View File
@@ -10,8 +10,9 @@ constexpr float meterFloorDb = -80.0f;
} }
CrilleBassStripAudioProcessor::CrilleBassStripAudioProcessor() CrilleBassStripAudioProcessor::CrilleBassStripAudioProcessor()
: AudioProcessor(BusesProperties().withInput("Input", juce::AudioChannelSet::stereo(), true) : AudioProcessor(BusesProperties()
.withOutput("Output", juce::AudioChannelSet::stereo(), true)), .withInput("Input", juce::AudioChannelSet::mono(), true)
.withOutput("Output", juce::AudioChannelSet::stereo(), true)),
apvts(*this, nullptr, "PARAMETERS", createParameterLayout()) apvts(*this, nullptr, "PARAMETERS", createParameterLayout())
{ {
} }
@@ -58,11 +59,13 @@ void CrilleBassStripAudioProcessor::prepareToPlay(double sr, int block)
updateFilters(); updateFilters();
} }
bool CrilleBassStripAudioProcessor::isBusesLayoutSupported(const BusesLayout& l) const bool CrilleBassStripAudioProcessor::isBusesLayoutSupported(const BusesLayout& layouts) const
{ {
const auto out = l.getMainOutputChannelSet(); const auto input = layouts.getMainInputChannelSet();
return (out == juce::AudioChannelSet::mono() || out == juce::AudioChannelSet::stereo()) const auto output = layouts.getMainOutputChannelSet();
&& out == l.getMainInputChannelSet();
return input == juce::AudioChannelSet::mono()
&& output == juce::AudioChannelSet::stereo();
} }
float CrilleBassStripAudioProcessor::getBufferPeak(const juce::AudioBuffer<float>& buffer) noexcept float CrilleBassStripAudioProcessor::getBufferPeak(const juce::AudioBuffer<float>& buffer) noexcept
@@ -88,69 +91,134 @@ void CrilleBassStripAudioProcessor::updateFilters()
void CrilleBassStripAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::MidiBuffer&) void CrilleBassStripAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::MidiBuffer&)
{ {
juce::ScopedNoDenormals noDenormals; juce::ScopedNoDenormals noDenormals;
// Clear output channels that do not contain input data.
for (int c = getTotalNumInputChannels(); c < getTotalNumOutputChannels(); ++c) for (int c = getTotalNumInputChannels(); c < getTotalNumOutputChannels(); ++c)
buffer.clear(c, 0, buffer.getNumSamples()); buffer.clear(c, 0, buffer.getNumSamples());
const float gateInputPeak = getBufferPeak(buffer); // Copy mono bass input to both stereo output channels.
gateInputLevelDb.store(juce::Decibels::gainToDecibels(gateInputPeak, meterFloorDb), std::memory_order_relaxed); if (buffer.getNumChannels() >= 2)
buffer.copyFrom(1, 0, buffer, 0, 0, buffer.getNumSamples());
const float threshold = dbToGain(apvts.getRawParameterValue("gateThreshold")->load()); // Measure input level before the noise gate.
const float releaseMs = apvts.getRawParameterValue("gateRelease")->load(); const float gateInputPeak = getBufferPeak(buffer);
const float releaseCoeff = std::exp(-1.f / (0.001f * releaseMs * static_cast<float>(currentSampleRate))); gateInputLevelDb.store(
const float gateGain = dbToGain(apvts.getRawParameterValue("gateGain")->load()); juce::Decibels::gainToDecibels(gateInputPeak, meterFloorDb),
std::memory_order_relaxed);
// Noise gate
const float threshold =
dbToGain(apvts.getRawParameterValue("gateThreshold")->load());
const float releaseMs =
apvts.getRawParameterValue("gateRelease")->load();
const float releaseCoeff =
std::exp(-1.f / (0.001f * releaseMs *
static_cast<float>(currentSampleRate)));
const float gateGain =
dbToGain(apvts.getRawParameterValue("gateGain")->load());
for (int c = 0; c < buffer.getNumChannels(); ++c) for (int c = 0; c < buffer.getNumChannels(); ++c)
{ {
auto* x = buffer.getWritePointer(c); auto* x = buffer.getWritePointer(c);
auto& env = gateEnvelope[static_cast<size_t>(c)]; auto& env = gateEnvelope[static_cast<size_t>(c)];
for (int i = 0; i < buffer.getNumSamples(); ++i) for (int i = 0; i < buffer.getNumSamples(); ++i)
{ {
const float target = std::abs(x[i]) >= threshold ? 1.f : 0.f; const float target =
env = target > env ? target : releaseCoeff * env; std::abs(x[i]) >= threshold ? 1.f : 0.f;
env = target > env
? target
: releaseCoeff * env;
x[i] *= env * gateGain; x[i] *= env * gateGain;
} }
} }
// Measure compressor input level.
const float compressorInputPeak = getBufferPeak(buffer); const float compressorInputPeak = getBufferPeak(buffer);
compressorInputLevelDb.store(juce::Decibels::gainToDecibels(compressorInputPeak, meterFloorDb), std::memory_order_relaxed);
compressor.setThreshold(apvts.getRawParameterValue("compThreshold")->load()); compressorInputLevelDb.store(
compressor.setRatio(apvts.getRawParameterValue("compRatio")->load()); juce::Decibels::gainToDecibels(
compressorInputPeak,
meterFloorDb),
std::memory_order_relaxed);
// Compressor
compressor.setThreshold(
apvts.getRawParameterValue("compThreshold")->load());
compressor.setRatio(
apvts.getRawParameterValue("compRatio")->load());
compressor.setAttack(15.f); compressor.setAttack(15.f);
compressor.setRelease(100.f); compressor.setRelease(100.f);
juce::dsp::AudioBlock<float> block(buffer); juce::dsp::AudioBlock<float> block(buffer);
juce::dsp::ProcessContextReplacing<float> context(block); juce::dsp::ProcessContextReplacing<float> context(block);
compressor.process(context); compressor.process(context);
// Calculate compressor gain reduction.
const float compressorOutputPeak = getBufferPeak(buffer); const float compressorOutputPeak = getBufferPeak(buffer);
const float gainReduction = compressorInputPeak > 0.0f
? juce::jmax(0.0f, juce::Decibels::gainToDecibels(compressorInputPeak / juce::jmax(compressorOutputPeak, 1.0e-9f)))
: 0.0f;
compressorGainReductionDb.store(juce::jlimit(0.0f, 24.0f, gainReduction), std::memory_order_relaxed);
buffer.applyGain(dbToGain(apvts.getRawParameterValue("compGain")->load())); const float gainReduction =
compressorInputPeak > 0.0f
? juce::jmax(
0.0f,
juce::Decibels::gainToDecibels(
compressorInputPeak /
juce::jmax(compressorOutputPeak, 1.0e-9f)))
: 0.0f;
compressorGainReductionDb.store(
juce::jlimit(0.0f, 24.0f, gainReduction),
std::memory_order_relaxed);
// Compressor makeup gain.
buffer.applyGain(
dbToGain(
apvts.getRawParameterValue("compGain")->load()));
// Distortion
const float drive =
dbToGain(apvts.getRawParameterValue("drive")->load());
const float mix =
apvts.getRawParameterValue("mix")->load() * 0.01f;
const float dg =
dbToGain(apvts.getRawParameterValue("distGain")->load());
const float drive = dbToGain(apvts.getRawParameterValue("drive")->load());
const float mix = apvts.getRawParameterValue("mix")->load() * 0.01f;
const float dg = dbToGain(apvts.getRawParameterValue("distGain")->load());
for (int c = 0; c < buffer.getNumChannels(); ++c) for (int c = 0; c < buffer.getNumChannels(); ++c)
{ {
auto* x = buffer.getWritePointer(c); auto* x = buffer.getWritePointer(c);
for (int i = 0; i < buffer.getNumSamples(); ++i) for (int i = 0; i < buffer.getNumSamples(); ++i)
{ {
const float dry = x[i]; const float dry = x[i];
const float wet = std::tanh(dry * drive); const float wet = std::tanh(dry * drive);
x[i] = ((1.f - mix) * dry + mix * wet) * dg;
x[i] =
((1.f - mix) * dry + mix * wet) * dg;
} }
} }
// EQ
updateFilters(); updateFilters();
lowShelf.process(context); lowShelf.process(context);
lowMid.process(context); lowMid.process(context);
mid.process(context); mid.process(context);
highShelf.process(context); highShelf.process(context);
buffer.applyGain(dbToGain(apvts.getRawParameterValue("output")->load()));
// Final output gain.
buffer.applyGain(
dbToGain(
apvts.getRawParameterValue("output")->load()));
} }
void CrilleBassStripAudioProcessor::getStateInformation(juce::MemoryBlock& dest) void CrilleBassStripAudioProcessor::getStateInformation(juce::MemoryBlock& dest)
+1 -1
View File
@@ -15,7 +15,7 @@ public:
juce::AudioProcessorEditor* createEditor() override; juce::AudioProcessorEditor* createEditor() override;
bool hasEditor() const override { return true; } bool hasEditor() const override { return true; }
const juce::String getName() const override { return JucePlugin_Name; } const juce::String getName() const override { return "Crille Bass Strip"; }
bool acceptsMidi() const override { return false; } bool acceptsMidi() const override { return false; }
bool producesMidi() const override { return false; } bool producesMidi() const override { return false; }
bool isMidiEffect() const override { return false; } bool isMidiEffect() const override { return false; }