Startpunkten
This commit is contained in:
commit
e67d0afcdd
8 files changed
+371
No files matched your search
+30
@@ -0,0 +1,30 @@
|
||||
# CMake / build
|
||||
build/
|
||||
cmake-build-*/
|
||||
|
||||
# JetBrains Rider / CLion
|
||||
.idea/
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# Windows
|
||||
Thumbs.db
|
||||
Desktop.ini
|
||||
|
||||
# Compiled binaries
|
||||
*.dll
|
||||
*.exe
|
||||
*.pdb
|
||||
*.ilk
|
||||
*.lib
|
||||
*.obj
|
||||
|
||||
# Audio plugins
|
||||
*.vst3
|
||||
*.component
|
||||
*.aaxplugin
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
*.log
|
||||
@@ -0,0 +1,38 @@
|
||||
# Crille Bass Strip – macOS, Rider och REAPER
|
||||
|
||||
## Krav
|
||||
- macOS 11 eller senare
|
||||
- Xcode Command Line Tools
|
||||
- CMake
|
||||
- Git
|
||||
- Ninja: `brew install ninja`
|
||||
- JetBrains Rider med C++-stöd
|
||||
|
||||
## Bygg i Rider
|
||||
1. Packa upp projektet.
|
||||
2. Öppna mappen `CrilleBassStrip` i Rider, inte en enskild fil.
|
||||
3. Välj CMake-profilen `mac-release`.
|
||||
4. Låt CMake-konfigurationen bli klar. Första gången hämtas JUCE 8.0.6.
|
||||
5. Välj målet `CrilleBassStrip_VST3` och bygg i Release.
|
||||
|
||||
Pluginen kopieras automatiskt till:
|
||||
`~/Library/Audio/Plug-Ins/VST3/Crille Bass Strip.vst3`
|
||||
|
||||
I REAPER: Preferences > Plug-ins > VST > Re-scan.
|
||||
|
||||
## Bygg direkt i Terminal
|
||||
```bash
|
||||
brew install ninja
|
||||
cd CrilleBassStrip
|
||||
cmake --preset mac-release
|
||||
cmake --build --preset mac-release
|
||||
```
|
||||
|
||||
För en Universal Binary för både Apple Silicon och Intel:
|
||||
```bash
|
||||
cmake --preset mac-universal-release
|
||||
cmake --build --preset mac-universal-release
|
||||
```
|
||||
|
||||
## Signalväg
|
||||
Noise Gate -> Compressor -> Distortion -> EQ -> Output
|
||||
@@ -0,0 +1,48 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
project(CrilleBassStrip VERSION 1.0.0 LANGUAGES C CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum macOS version")
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
JUCE
|
||||
GIT_REPOSITORY https://github.com/juce-framework/JUCE.git
|
||||
GIT_TAG 8.0.6
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable(JUCE)
|
||||
|
||||
juce_add_plugin(CrilleBassStrip
|
||||
COMPANY_NAME "Crille Audio"
|
||||
BUNDLE_ID "org.crilleaudio.crillebassstrip"
|
||||
PLUGIN_MANUFACTURER_CODE Cril
|
||||
PLUGIN_CODE CbSt
|
||||
FORMATS VST3 Standalone
|
||||
PRODUCT_NAME "Crille Bass Strip"
|
||||
COPY_PLUGIN_AFTER_BUILD TRUE
|
||||
VST3_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/VST3"
|
||||
)
|
||||
juce_generate_juce_header(CrilleBassStrip)
|
||||
|
||||
target_sources(CrilleBassStrip PRIVATE
|
||||
Source/PluginProcessor.cpp
|
||||
Source/PluginProcessor.h
|
||||
Source/PluginEditor.cpp
|
||||
Source/PluginEditor.h
|
||||
)
|
||||
|
||||
target_compile_definitions(CrilleBassStrip PUBLIC
|
||||
JUCE_WEB_BROWSER=0
|
||||
JUCE_USE_CURL=0
|
||||
JUCE_VST3_CAN_REPLACE_VST2=0
|
||||
)
|
||||
|
||||
target_link_libraries(CrilleBassStrip PRIVATE
|
||||
juce::juce_audio_utils
|
||||
juce::juce_dsp
|
||||
PUBLIC juce::juce_recommended_config_flags
|
||||
juce::juce_recommended_lto_flags
|
||||
juce::juce_recommended_warning_flags
|
||||
)
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"version": 6,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "mac-release",
|
||||
"displayName": "macOS Release (native architecture)",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/mac-release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_OSX_DEPLOYMENT_TARGET": "11.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mac-universal-release",
|
||||
"displayName": "macOS Universal Release (Apple Silicon + Intel)",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/mac-universal-release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_OSX_ARCHITECTURES": "arm64;x86_64",
|
||||
"CMAKE_OSX_DEPLOYMENT_TARGET": "11.0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{ "name": "mac-release", "configurePreset": "mac-release", "targets": ["CrilleBassStrip_VST3"] },
|
||||
{ "name": "mac-universal-release", "configurePreset": "mac-universal-release", "targets": ["CrilleBassStrip_VST3"] }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
#include "PluginEditor.h"
|
||||
|
||||
CrilleBassStripAudioProcessorEditor::CrilleBassStripAudioProcessorEditor(CrilleBassStripAudioProcessor& p)
|
||||
: AudioProcessorEditor(&p), processor(p)
|
||||
{
|
||||
addKnob("gateThreshold", "THRESHOLD"); addKnob("gateRelease", "RELEASE"); addKnob("gateGain", "GAIN");
|
||||
addKnob("compThreshold", "THRESHOLD"); addKnob("compRatio", "RATIO"); addKnob("compGain", "GAIN");
|
||||
addKnob("drive", "DRIVE"); addKnob("mix", "MIX"); addKnob("distGain", "GAIN");
|
||||
addKnob("bass", "BASS"); addKnob("lowMid", "LOW MID"); addKnob("middle", "MIDDLE"); addKnob("treble", "TREBLE"); addKnob("output", "OUTPUT");
|
||||
setSize(980, 430);
|
||||
}
|
||||
|
||||
void CrilleBassStripAudioProcessorEditor::addKnob(const juce::String& id, const juce::String& caption)
|
||||
{
|
||||
auto k = std::make_unique<Knob>();
|
||||
k->slider.setSliderStyle(juce::Slider::RotaryHorizontalVerticalDrag);
|
||||
k->slider.setTextBoxStyle(juce::Slider::TextBoxBelow, false, 72, 20);
|
||||
k->slider.setColour(juce::Slider::rotarySliderFillColourId, juce::Colour(0xffe5a536));
|
||||
k->slider.setColour(juce::Slider::rotarySliderOutlineColourId, juce::Colour(0xff30343a));
|
||||
k->slider.setColour(juce::Slider::thumbColourId, juce::Colour(0xffffd275));
|
||||
k->label.setText(caption, juce::dontSendNotification); k->label.setJustificationType(juce::Justification::centred);
|
||||
k->label.setColour(juce::Label::textColourId, juce::Colour(0xffd9dde3)); k->label.setFont(juce::Font(12.f, juce::Font::bold));
|
||||
addAndMakeVisible(k->slider); addAndMakeVisible(k->label);
|
||||
attachments.push_back(std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(processor.apvts, id, k->slider));
|
||||
knobs.push_back(std::move(k));
|
||||
}
|
||||
|
||||
void CrilleBassStripAudioProcessorEditor::paint(juce::Graphics& g)
|
||||
{
|
||||
g.fillAll(juce::Colour(0xff111317));
|
||||
g.setColour(juce::Colour(0xffe5a536)); g.setFont(juce::Font(28.f, juce::Font::bold));
|
||||
g.drawText("CRILLE BASS STRIP", 25, 15, getWidth()-50, 40, juce::Justification::centredLeft);
|
||||
g.setColour(juce::Colour(0xff777f89)); g.setFont(13.f);
|
||||
g.drawText("GATE > COMPRESSOR > DISTORTION > EQ", 28, 50, getWidth()-56, 22, juce::Justification::centredLeft);
|
||||
const juce::StringArray names{"NOISE GATE", "COMPRESSOR", "DISTORTION", "EQUALIZER"};
|
||||
const int widths[]{205,205,205,315}; int x=15;
|
||||
for (int i=0;i<4;++i) { auto r=juce::Rectangle<int>(x,85,widths[i],325); g.setColour(juce::Colour(0xff1b1f24)); g.fillRoundedRectangle(r.toFloat(),10.f); g.setColour(i==2?juce::Colour(0xffb85c45):juce::Colour(0xff3c424a)); g.drawRoundedRectangle(r.toFloat(),10.f,2.f); g.setColour(juce::Colour(0xfff0f1f2)); g.setFont(15.f); g.drawText(names[i],r.removeFromTop(38),juce::Justification::centred); x+=widths[i]+10; }
|
||||
}
|
||||
|
||||
void CrilleBassStripAudioProcessorEditor::resized()
|
||||
{
|
||||
const int starts[]{20,235,450,665}; const int counts[]{3,3,3,5}; int index=0;
|
||||
for (int section=0;section<4;++section) {
|
||||
int cols = section==3 ? 3 : 2; int cellW = section==3 ? 100 : 95;
|
||||
for(int n=0;n<counts[section];++n,++index) {
|
||||
int row=n/cols, col=n%cols; int x=starts[section]+8+col*cellW, y=130+row*135;
|
||||
knobs[index]->slider.setBounds(x,y,88,102); knobs[index]->label.setBounds(x,y+102,88,22);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <JuceHeader.h>
|
||||
#include "PluginProcessor.h"
|
||||
|
||||
class CrilleBassStripAudioProcessorEditor final : public juce::AudioProcessorEditor
|
||||
{
|
||||
public:
|
||||
explicit CrilleBassStripAudioProcessorEditor(CrilleBassStripAudioProcessor&);
|
||||
~CrilleBassStripAudioProcessorEditor() override = default;
|
||||
void paint(juce::Graphics&) override;
|
||||
void resized() override;
|
||||
private:
|
||||
struct Knob { juce::Slider slider; juce::Label label; };
|
||||
CrilleBassStripAudioProcessor& processor;
|
||||
std::vector<std::unique_ptr<Knob>> knobs;
|
||||
std::vector<std::unique_ptr<juce::AudioProcessorValueTreeState::SliderAttachment>> attachments;
|
||||
void addKnob(const juce::String& parameter, const juce::String& caption);
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CrilleBassStripAudioProcessorEditor)
|
||||
};
|
||||
@@ -0,0 +1,115 @@
|
||||
#include "PluginProcessor.h"
|
||||
#include "PluginEditor.h"
|
||||
#include <cmath>
|
||||
|
||||
namespace {
|
||||
constexpr auto pid = [](const char* s) { return juce::ParameterID{s, 1}; };
|
||||
float dbToGain(float db) { return juce::Decibels::decibelsToGain(db); }
|
||||
}
|
||||
|
||||
CrilleBassStripAudioProcessor::CrilleBassStripAudioProcessor()
|
||||
: AudioProcessor(BusesProperties().withInput("Input", juce::AudioChannelSet::stereo(), true)
|
||||
.withOutput("Output", juce::AudioChannelSet::stereo(), true)),
|
||||
apvts(*this, nullptr, "PARAMETERS", createParameterLayout()) {}
|
||||
|
||||
juce::AudioProcessorValueTreeState::ParameterLayout CrilleBassStripAudioProcessor::createParameterLayout()
|
||||
{
|
||||
using P = juce::AudioParameterFloat;
|
||||
juce::AudioProcessorValueTreeState::ParameterLayout p;
|
||||
p.add(std::make_unique<P>(pid("gateThreshold"), "Gate Threshold", juce::NormalisableRange<float>(-80.f, -10.f, 0.1f), -45.f, "dB"));
|
||||
p.add(std::make_unique<P>(pid("gateRelease"), "Gate Release", juce::NormalisableRange<float>(20.f, 500.f, 1.f, 0.5f), 150.f, "ms"));
|
||||
p.add(std::make_unique<P>(pid("gateGain"), "Gate Gain", juce::NormalisableRange<float>(-24.f, 12.f, 0.1f), 0.f, "dB"));
|
||||
p.add(std::make_unique<P>(pid("compThreshold"), "Comp Threshold", juce::NormalisableRange<float>(-60.f, 0.f, 0.1f), -18.f, "dB"));
|
||||
p.add(std::make_unique<P>(pid("compRatio"), "Comp Ratio", juce::NormalisableRange<float>(1.f, 20.f, 0.1f, 0.5f), 4.f, ":1"));
|
||||
p.add(std::make_unique<P>(pid("compGain"), "Comp Gain", juce::NormalisableRange<float>(-12.f, 18.f, 0.1f), 3.f, "dB"));
|
||||
p.add(std::make_unique<P>(pid("drive"), "Drive", juce::NormalisableRange<float>(0.f, 24.f, 0.1f), 5.f, "dB"));
|
||||
p.add(std::make_unique<P>(pid("mix"), "Distortion Mix", juce::NormalisableRange<float>(0.f, 100.f, 1.f), 25.f, "%"));
|
||||
p.add(std::make_unique<P>(pid("distGain"), "Distortion Gain", juce::NormalisableRange<float>(-18.f, 12.f, 0.1f), 0.f, "dB"));
|
||||
p.add(std::make_unique<P>(pid("bass"), "Bass", juce::NormalisableRange<float>(-12.f, 12.f, 0.1f), 2.f, "dB"));
|
||||
p.add(std::make_unique<P>(pid("lowMid"), "Low Mid", juce::NormalisableRange<float>(-12.f, 12.f, 0.1f), -2.f, "dB"));
|
||||
p.add(std::make_unique<P>(pid("middle"), "Middle", juce::NormalisableRange<float>(-12.f, 12.f, 0.1f), 0.f, "dB"));
|
||||
p.add(std::make_unique<P>(pid("treble"), "Treble", juce::NormalisableRange<float>(-12.f, 12.f, 0.1f), 1.f, "dB"));
|
||||
p.add(std::make_unique<P>(pid("output"), "Output", juce::NormalisableRange<float>(-24.f, 12.f, 0.1f), -1.f, "dB"));
|
||||
return p;
|
||||
}
|
||||
|
||||
void CrilleBassStripAudioProcessor::prepareToPlay(double sr, int block)
|
||||
{
|
||||
currentSampleRate = sr;
|
||||
juce::dsp::ProcessSpec spec{sr, static_cast<juce::uint32>(block), static_cast<juce::uint32>(getTotalNumOutputChannels())};
|
||||
compressor.prepare(spec); lowShelf.prepare(spec); lowMid.prepare(spec); mid.prepare(spec); highShelf.prepare(spec);
|
||||
compressor.reset(); lowShelf.reset(); lowMid.reset(); mid.reset(); highShelf.reset();
|
||||
gateEnvelope.assign(static_cast<size_t>(getTotalNumOutputChannels()), 0.f);
|
||||
updateFilters();
|
||||
}
|
||||
|
||||
bool CrilleBassStripAudioProcessor::isBusesLayoutSupported(const BusesLayout& l) const
|
||||
{
|
||||
const auto out = l.getMainOutputChannelSet();
|
||||
return (out == juce::AudioChannelSet::mono() || out == juce::AudioChannelSet::stereo()) && out == l.getMainInputChannelSet();
|
||||
}
|
||||
|
||||
void CrilleBassStripAudioProcessor::updateFilters()
|
||||
{
|
||||
const auto bass = apvts.getRawParameterValue("bass")->load();
|
||||
const auto lm = apvts.getRawParameterValue("lowMid")->load();
|
||||
const auto m = apvts.getRawParameterValue("middle")->load();
|
||||
const auto tr = apvts.getRawParameterValue("treble")->load();
|
||||
*lowShelf.state = *juce::dsp::IIR::Coefficients<float>::makeLowShelf(currentSampleRate, 80.0, 0.707, dbToGain(bass));
|
||||
*lowMid.state = *juce::dsp::IIR::Coefficients<float>::makePeakFilter(currentSampleRate, 300.0, 0.8, dbToGain(lm));
|
||||
*mid.state = *juce::dsp::IIR::Coefficients<float>::makePeakFilter(currentSampleRate, 900.0, 0.8, dbToGain(m));
|
||||
*highShelf.state = *juce::dsp::IIR::Coefficients<float>::makeHighShelf(currentSampleRate, 3500.0, 0.707, dbToGain(tr));
|
||||
}
|
||||
|
||||
void CrilleBassStripAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::MidiBuffer&)
|
||||
{
|
||||
juce::ScopedNoDenormals noDenormals;
|
||||
for (int c = getTotalNumInputChannels(); c < getTotalNumOutputChannels(); ++c) buffer.clear(c, 0, buffer.getNumSamples());
|
||||
|
||||
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) {
|
||||
auto* x = buffer.getWritePointer(c); auto& env = gateEnvelope[static_cast<size_t>(c)];
|
||||
for (int i = 0; i < buffer.getNumSamples(); ++i) {
|
||||
const float target = std::abs(x[i]) >= threshold ? 1.f : 0.f;
|
||||
env = target > env ? target : releaseCoeff * env;
|
||||
x[i] *= env * gateGain;
|
||||
}
|
||||
}
|
||||
|
||||
compressor.setThreshold(apvts.getRawParameterValue("compThreshold")->load());
|
||||
compressor.setRatio(apvts.getRawParameterValue("compRatio")->load());
|
||||
compressor.setAttack(15.f); compressor.setRelease(100.f);
|
||||
juce::dsp::AudioBlock<float> block(buffer);
|
||||
juce::dsp::ProcessContextReplacing<float> context(block);
|
||||
compressor.process(context);
|
||||
buffer.applyGain(dbToGain(apvts.getRawParameterValue("compGain")->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) {
|
||||
auto* x = buffer.getWritePointer(c);
|
||||
for (int i = 0; i < buffer.getNumSamples(); ++i) {
|
||||
const float dry = x[i]; const float wet = std::tanh(dry * drive);
|
||||
x[i] = ((1.f - mix) * dry + mix * wet) * dg;
|
||||
}
|
||||
}
|
||||
|
||||
updateFilters();
|
||||
lowShelf.process(context); lowMid.process(context); mid.process(context); highShelf.process(context);
|
||||
buffer.applyGain(dbToGain(apvts.getRawParameterValue("output")->load()));
|
||||
}
|
||||
|
||||
void CrilleBassStripAudioProcessor::getStateInformation(juce::MemoryBlock& dest)
|
||||
{
|
||||
if (auto xml = apvts.copyState().createXml()) copyXmlToBinary(*xml, dest);
|
||||
}
|
||||
void CrilleBassStripAudioProcessor::setStateInformation(const void* data, int size)
|
||||
{
|
||||
if (auto xml = getXmlFromBinary(data, size); xml != nullptr && xml->hasTagName(apvts.state.getType())) apvts.replaceState(juce::ValueTree::fromXml(*xml));
|
||||
}
|
||||
juce::AudioProcessorEditor* CrilleBassStripAudioProcessor::createEditor() { return new CrilleBassStripAudioProcessorEditor(*this); }
|
||||
juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter() { return new CrilleBassStripAudioProcessor(); }
|
||||
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
#include <JuceHeader.h>
|
||||
|
||||
class CrilleBassStripAudioProcessor final : public juce::AudioProcessor
|
||||
{
|
||||
public:
|
||||
CrilleBassStripAudioProcessor();
|
||||
~CrilleBassStripAudioProcessor() override = default;
|
||||
|
||||
void prepareToPlay(double sampleRate, int samplesPerBlock) override;
|
||||
void releaseResources() override {}
|
||||
bool isBusesLayoutSupported(const BusesLayout& layouts) const override;
|
||||
void processBlock(juce::AudioBuffer<float>&, juce::MidiBuffer&) override;
|
||||
|
||||
juce::AudioProcessorEditor* createEditor() override;
|
||||
bool hasEditor() const override { return true; }
|
||||
const juce::String getName() const override { return JucePlugin_Name; }
|
||||
bool acceptsMidi() const override { return false; }
|
||||
bool producesMidi() const override { return false; }
|
||||
bool isMidiEffect() const override { return false; }
|
||||
double getTailLengthSeconds() const override { return 0.0; }
|
||||
int getNumPrograms() override { return 1; }
|
||||
int getCurrentProgram() override { return 0; }
|
||||
void setCurrentProgram(int) override {}
|
||||
const juce::String getProgramName(int) override { return {}; }
|
||||
void changeProgramName(int, const juce::String&) override {}
|
||||
void getStateInformation(juce::MemoryBlock&) override;
|
||||
void setStateInformation(const void*, int) override;
|
||||
|
||||
juce::AudioProcessorValueTreeState apvts;
|
||||
static juce::AudioProcessorValueTreeState::ParameterLayout createParameterLayout();
|
||||
|
||||
private:
|
||||
using Filter = juce::dsp::IIR::Filter<float>;
|
||||
juce::dsp::Compressor<float> compressor;
|
||||
juce::dsp::ProcessorDuplicator<Filter, juce::dsp::IIR::Coefficients<float>> lowShelf, lowMid, mid, highShelf;
|
||||
double currentSampleRate = 44100.0;
|
||||
std::vector<float> gateEnvelope;
|
||||
void updateFilters();
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CrilleBassStripAudioProcessor)
|
||||
};
|
||||
Reference in new issue
Block a user