init
innit
This commit is contained in:
23
Source/CrushSliderLook.cpp
Normal file
23
Source/CrushSliderLook.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
CrushSliderLook.cpp
|
||||
Created: 16 Jan 2026 9:40:57pm
|
||||
Author: esca
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include "CrushSliderLook.h"
|
||||
#include "BinaryData.h"
|
||||
void CrushSliderLook::setImages(){
|
||||
bg = juce::ImageCache::getFromMemory(BinaryData::crushslidebg_png, BinaryData::crushslidebg_pngSize);
|
||||
fg = juce::ImageCache::getFromMemory(BinaryData::crushslidefg_png, BinaryData::crushslidefg_pngSize);
|
||||
}
|
||||
|
||||
void CrushSliderLook::drawLinearSlider(juce::Graphics &g, int x, int y, int width, int height, float sliderPos, float minSliderPos, float maxSliderPos, juce::Slider::SliderStyle sliderStyle, juce::Slider &slider ){
|
||||
g.drawImage(bg, 0, 0, 205, 43, 0, 0, 205, 43, false); //draw background
|
||||
float fraction = (sliderPos-minSliderPos)/(width);
|
||||
int fgWidth = (int)(205*fraction);
|
||||
g.drawImage(fg, 0, 0, fgWidth, 43, 0, 0, fgWidth, 43, false);
|
||||
}
|
||||
22
Source/CrushSliderLook.h
Normal file
22
Source/CrushSliderLook.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
CrushSliderLook.h
|
||||
Created: 16 Jan 2026 9:40:57pm
|
||||
Author: esca
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "juce_gui_basics/juce_gui_basics.h"
|
||||
#include <JuceHeader.h>
|
||||
|
||||
class CrushSliderLook : public juce::LookAndFeel_V4{
|
||||
public:
|
||||
void drawLinearSlider(juce::Graphics &g, int x, int y, int width, int height, float sliderPos, float minSliderPos, float maxSliderPos, juce::Slider::SliderStyle sliderStyle, juce::Slider &slider ) override;
|
||||
void setImages();
|
||||
private:
|
||||
juce::Image bg;
|
||||
juce::Image fg;
|
||||
};
|
||||
51
Source/CrushView.cpp
Normal file
51
Source/CrushView.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
CrushView.cpp
|
||||
Created: 16 Jan 2026 5:05:38pm
|
||||
Author: esca
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include <JuceHeader.h>
|
||||
#include "CrushView.h"
|
||||
|
||||
//==============================================================================
|
||||
CrushView::CrushView()
|
||||
{
|
||||
// In your constructor, you should add any child components, and
|
||||
// initialise any special settings that your component needs.
|
||||
|
||||
}
|
||||
|
||||
CrushView::~CrushView()
|
||||
{
|
||||
}
|
||||
|
||||
void CrushView::paint (juce::Graphics& g)
|
||||
{
|
||||
/* This demo code just fills the component's background and
|
||||
draws some placeholder text to get you started.
|
||||
|
||||
You should replace everything in this method with your own
|
||||
drawing code..
|
||||
*/
|
||||
|
||||
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId)); // clear the background
|
||||
|
||||
g.setColour (juce::Colours::grey);
|
||||
g.drawRect (getLocalBounds(), 1); // draw an outline around the component
|
||||
|
||||
g.setColour (juce::Colours::white);
|
||||
g.setFont (14.0f);
|
||||
g.drawText ("CrushView", getLocalBounds(),
|
||||
juce::Justification::centred, true); // draw some placeholder text
|
||||
}
|
||||
|
||||
void CrushView::resized()
|
||||
{
|
||||
// This method is where you should set the bounds of any child
|
||||
// components that your component contains..
|
||||
|
||||
}
|
||||
29
Source/CrushView.h
Normal file
29
Source/CrushView.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
CrushView.h
|
||||
Created: 16 Jan 2026 5:05:38pm
|
||||
Author: esca
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <JuceHeader.h>
|
||||
|
||||
//==============================================================================
|
||||
/*
|
||||
*/
|
||||
class CrushView : public juce::Component
|
||||
{
|
||||
public:
|
||||
CrushView();
|
||||
~CrushView() override;
|
||||
|
||||
void paint (juce::Graphics&) override;
|
||||
void resized() override;
|
||||
|
||||
private:
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CrushView)
|
||||
};
|
||||
34
Source/DialLook.cpp
Normal file
34
Source/DialLook.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
Dial.cpp
|
||||
Created: 16 Jan 2026 7:16:39pm
|
||||
Author: esca
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include "DialLook.h"
|
||||
#include "BinaryData.h"
|
||||
#include "juce_graphics/juce_graphics.h"
|
||||
void DialLook::drawRotarySlider(juce::Graphics& g, int x, int y, int width, int height, float sliderPos, const float rotaryStartAngle, const float rotaryEndAngle, juce::Slider&){
|
||||
|
||||
auto radius = (float) juce::jmin (width / 2, height / 2) - 4.0f;
|
||||
auto centreX = (float) x + (float) width * 0.5f;
|
||||
auto centreY = (float) y + (float) height * 0.5f;
|
||||
auto rx = centreX - radius;
|
||||
auto ry = centreY - radius;
|
||||
auto rw = radius * 2.0f;
|
||||
auto angle = rotaryStartAngle + sliderPos * (rotaryEndAngle - rotaryStartAngle);
|
||||
|
||||
//background
|
||||
g.drawImage(bgImg, x, y, width, height, 0, 0, 55, 56);
|
||||
|
||||
//rotator
|
||||
g.drawImageTransformed(rotator, juce::AffineTransform::translation(-3, -2).rotated(angle+3.141f).translated(centreX, centreY), false);
|
||||
}
|
||||
|
||||
void DialLook::setImage(){
|
||||
bgImg = juce::ImageCache::getFromMemory(BinaryData::dialbg_png, BinaryData::dialbg_pngSize);
|
||||
rotator = juce::ImageCache::getFromMemory(BinaryData::rotator_png, BinaryData::rotator_pngSize);
|
||||
}
|
||||
22
Source/DialLook.h
Normal file
22
Source/DialLook.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
Dial.h
|
||||
Created: 16 Jan 2026 7:16:39pm
|
||||
Author: esca
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "juce_gui_basics/juce_gui_basics.h"
|
||||
#include <JuceHeader.h>
|
||||
|
||||
class DialLook : public juce::LookAndFeel_V4{
|
||||
public:
|
||||
void drawRotarySlider(juce::Graphics& g, int x, int y, int width, int height, float sliderPos, const float rotaryStartAngle, const float rotaryEndAngle, juce::Slider&) override;
|
||||
void setImage();
|
||||
private:
|
||||
juce::Image bgImg;
|
||||
juce::Image rotator;
|
||||
};
|
||||
27
Source/FilterButtonLook.cpp
Normal file
27
Source/FilterButtonLook.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
FilterButtonLook.cpp
|
||||
Created: 16 Jan 2026 8:58:45pm
|
||||
Author: esca
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include "FilterButtonLook.h"
|
||||
#include "BinaryData.h"
|
||||
#include "juce_graphics/juce_graphics.h"
|
||||
|
||||
void FilterButtonLook::setImages(){
|
||||
lp = juce::ImageCache::getFromMemory(BinaryData::lpon_png, BinaryData::lpon_pngSize);
|
||||
hp = juce::ImageCache::getFromMemory(BinaryData::hpon_png, BinaryData::hpon_pngSize);
|
||||
}
|
||||
|
||||
void FilterButtonLook::drawButtonBackground(juce::Graphics& g, juce::Button& button, const juce::Colour& backgroundColour, bool, bool isButtonDown){
|
||||
int w = 94;
|
||||
int h = 29;
|
||||
if(button.getToggleState()){
|
||||
g.drawImage(hp, 0, 0, w, h, 0, 0, w, h, false);
|
||||
}
|
||||
else g.drawImage(lp, 0, 0, w, h, 0, 0, w, h, false);
|
||||
}
|
||||
22
Source/FilterButtonLook.h
Normal file
22
Source/FilterButtonLook.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
FilterButtonLook.h
|
||||
Created: 16 Jan 2026 8:58:45pm
|
||||
Author: esca
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "juce_gui_basics/juce_gui_basics.h"
|
||||
#include <JuceHeader.h>
|
||||
|
||||
class FilterButtonLook : public juce::LookAndFeel_V4{
|
||||
public:
|
||||
void setImages();
|
||||
void drawButtonBackground (juce::Graphics& g, juce::Button& button, const juce::Colour& backgroundColour, bool, bool isButtonDown) override;
|
||||
private:
|
||||
juce::Image lp;
|
||||
juce::Image hp;
|
||||
};
|
||||
51
Source/FilterView.cpp
Normal file
51
Source/FilterView.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
FilterView.cpp
|
||||
Created: 16 Jan 2026 5:06:31pm
|
||||
Author: esca
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include <JuceHeader.h>
|
||||
#include "FilterView.h"
|
||||
|
||||
//==============================================================================
|
||||
FilterView::FilterView()
|
||||
{
|
||||
// In your constructor, you should add any child components, and
|
||||
// initialise any special settings that your component needs.
|
||||
|
||||
}
|
||||
|
||||
FilterView::~FilterView()
|
||||
{
|
||||
}
|
||||
|
||||
void FilterView::paint (juce::Graphics& g)
|
||||
{
|
||||
/* This demo code just fills the component's background and
|
||||
draws some placeholder text to get you started.
|
||||
|
||||
You should replace everything in this method with your own
|
||||
drawing code..
|
||||
*/
|
||||
|
||||
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId)); // clear the background
|
||||
|
||||
g.setColour (juce::Colours::grey);
|
||||
g.drawRect (getLocalBounds(), 1); // draw an outline around the component
|
||||
|
||||
g.setColour (juce::Colours::white);
|
||||
g.setFont (14.0f);
|
||||
g.drawText ("FilterView", getLocalBounds(),
|
||||
juce::Justification::centred, true); // draw some placeholder text
|
||||
}
|
||||
|
||||
void FilterView::resized()
|
||||
{
|
||||
// This method is where you should set the bounds of any child
|
||||
// components that your component contains..
|
||||
|
||||
}
|
||||
29
Source/FilterView.h
Normal file
29
Source/FilterView.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
FilterView.h
|
||||
Created: 16 Jan 2026 5:06:31pm
|
||||
Author: esca
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <JuceHeader.h>
|
||||
|
||||
//==============================================================================
|
||||
/*
|
||||
*/
|
||||
class FilterView : public juce::Component
|
||||
{
|
||||
public:
|
||||
FilterView();
|
||||
~FilterView() override;
|
||||
|
||||
void paint (juce::Graphics&) override;
|
||||
void resized() override;
|
||||
|
||||
private:
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FilterView)
|
||||
};
|
||||
43
Source/OpenGLUtils.cpp
Normal file
43
Source/OpenGLUtils.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
OpenGLUtils.cpp
|
||||
Created: 17 Jan 2026 11:41:12am
|
||||
Author: esca
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include "OpenGLUtils.h"
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include <math.h>
|
||||
|
||||
void svCol(Vertex &v, float newColour[4]){
|
||||
memcpy(&v.colour, &newColour, 4*sizeof(float));
|
||||
}
|
||||
|
||||
void setColour(std::vector<Vertex> &verticeList, float newColour[4]){
|
||||
for(Vertex v : verticeList){
|
||||
svCol(v, newColour);
|
||||
}
|
||||
}
|
||||
|
||||
void vTransform(std::vector<Vertex> &verticeList, int transform[2]){
|
||||
for(Vertex &v : verticeList){
|
||||
v.position[0] = transform[0];
|
||||
v.position[1] = transform[1];
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<Vertex> generateSineWave(int numVertices, float angle, float startingColour[4]){
|
||||
//generates one cycle of a sine wave with vertices numVertices and starting at angle angle
|
||||
|
||||
std::vector<Vertex> ret(numVertices, Vertex{});
|
||||
for (int i = 0; i<numVertices; i++){
|
||||
ret[i].position[0] = (float)i*1/numVertices;
|
||||
ret[i].position[1] = sin(angle+i*(2*M_PI/numVertices));
|
||||
svCol(ret[i], startingColour);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
42
Source/OpenGLUtils.h
Normal file
42
Source/OpenGLUtils.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
OpenGLUtils.h
|
||||
Created: 17 Jan 2026 11:41:12am
|
||||
Author: esca
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <vector>
|
||||
//random shit for convenience
|
||||
|
||||
#define VERTEXSHADER R"(#version 330 core
|
||||
in vec2 position;
|
||||
in vec4 colour;
|
||||
out vec4 fragcolour;
|
||||
void main(){
|
||||
gl_Position = vec4(position, 1, 1);
|
||||
fragcolour = colour;
|
||||
}
|
||||
)"
|
||||
|
||||
#define FRAGSHADER R"(#version 330 core
|
||||
in vec4 fragcolour;
|
||||
void main(){
|
||||
gl_FragColour = fragcolour;
|
||||
}
|
||||
)";
|
||||
|
||||
struct Vertex{
|
||||
float position[2];
|
||||
float colour[4];
|
||||
};
|
||||
void svCol(Vertex &v, float newColour[4]);
|
||||
|
||||
void setColour(std::vector<Vertex> &verticeList, float newColour[4]);
|
||||
|
||||
void vTransform(std::vector<Vertex> &verticeList, int transform[2]);
|
||||
|
||||
std::vector<Vertex> generateSineWave(int numVertices, float angle, float startingColour[4]);
|
||||
36
Source/PluginEditor.cpp
Normal file
36
Source/PluginEditor.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file contains the basic framework code for a JUCE plugin editor.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include "PluginProcessor.h"
|
||||
#include "PluginEditor.h"
|
||||
|
||||
//==============================================================================
|
||||
CrushFXAudioProcessorEditor::CrushFXAudioProcessorEditor (CrushFXAudioProcessor& p)
|
||||
: AudioProcessorEditor (&p), audioProcessor (p)
|
||||
{
|
||||
// Make sure that before the constructor has finished, you've set the
|
||||
// editor's size to whatever you need it to be.
|
||||
bg = juce::ImageCache::getFromMemory(BinaryData::BG_png, BinaryData::BG_pngSize);
|
||||
setSize (696, 400);
|
||||
}
|
||||
|
||||
CrushFXAudioProcessorEditor::~CrushFXAudioProcessorEditor()
|
||||
{
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void CrushFXAudioProcessorEditor::paint (juce::Graphics& g)
|
||||
{
|
||||
g.drawImage(bg, getLocalBounds().toFloat());
|
||||
}
|
||||
|
||||
void CrushFXAudioProcessorEditor::resized()
|
||||
{
|
||||
// This is generally where you'll want to lay out the positions of any
|
||||
// subcomponents in your editor..
|
||||
}
|
||||
33
Source/PluginEditor.h
Normal file
33
Source/PluginEditor.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file contains the basic framework code for a JUCE plugin editor.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <JuceHeader.h>
|
||||
#include "PluginProcessor.h"
|
||||
//==============================================================================
|
||||
/**
|
||||
*/
|
||||
class CrushFXAudioProcessorEditor : public juce::AudioProcessorEditor
|
||||
{
|
||||
public:
|
||||
CrushFXAudioProcessorEditor (CrushFXAudioProcessor&);
|
||||
~CrushFXAudioProcessorEditor() override;
|
||||
|
||||
//==============================================================================
|
||||
void paint (juce::Graphics&) override;
|
||||
void resized() override;
|
||||
|
||||
private:
|
||||
juce::Image bg;
|
||||
// This reference is provided as a quick way for your editor to
|
||||
// access the processor object that created it.
|
||||
CrushFXAudioProcessor& audioProcessor;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CrushFXAudioProcessorEditor)
|
||||
};
|
||||
191
Source/PluginProcessor.cpp
Normal file
191
Source/PluginProcessor.cpp
Normal file
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file contains the basic framework code for a JUCE plugin processor.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include "PluginProcessor.h"
|
||||
#include "PluginEditor.h"
|
||||
|
||||
//==============================================================================
|
||||
CrushFXAudioProcessor::CrushFXAudioProcessor()
|
||||
#ifndef JucePlugin_PreferredChannelConfigurations
|
||||
: AudioProcessor (BusesProperties()
|
||||
#if ! JucePlugin_IsMidiEffect
|
||||
#if ! JucePlugin_IsSynth
|
||||
.withInput ("Input", juce::AudioChannelSet::stereo(), true)
|
||||
#endif
|
||||
.withOutput ("Output", juce::AudioChannelSet::stereo(), true)
|
||||
#endif
|
||||
)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
CrushFXAudioProcessor::~CrushFXAudioProcessor()
|
||||
{
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
const juce::String CrushFXAudioProcessor::getName() const
|
||||
{
|
||||
return JucePlugin_Name;
|
||||
}
|
||||
|
||||
bool CrushFXAudioProcessor::acceptsMidi() const
|
||||
{
|
||||
#if JucePlugin_WantsMidiInput
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CrushFXAudioProcessor::producesMidi() const
|
||||
{
|
||||
#if JucePlugin_ProducesMidiOutput
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CrushFXAudioProcessor::isMidiEffect() const
|
||||
{
|
||||
#if JucePlugin_IsMidiEffect
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
double CrushFXAudioProcessor::getTailLengthSeconds() const
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
int CrushFXAudioProcessor::getNumPrograms()
|
||||
{
|
||||
return 1; // NB: some hosts don't cope very well if you tell them there are 0 programs,
|
||||
// so this should be at least 1, even if you're not really implementing programs.
|
||||
}
|
||||
|
||||
int CrushFXAudioProcessor::getCurrentProgram()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CrushFXAudioProcessor::setCurrentProgram (int index)
|
||||
{
|
||||
}
|
||||
|
||||
const juce::String CrushFXAudioProcessor::getProgramName (int index)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
void CrushFXAudioProcessor::changeProgramName (int index, const juce::String& newName)
|
||||
{
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void CrushFXAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
|
||||
{
|
||||
// Use this method as the place to do any pre-playback
|
||||
// initialisation that you need..
|
||||
}
|
||||
|
||||
void CrushFXAudioProcessor::releaseResources()
|
||||
{
|
||||
// When playback stops, you can use this as an opportunity to free up any
|
||||
// spare memory, etc.
|
||||
}
|
||||
|
||||
#ifndef JucePlugin_PreferredChannelConfigurations
|
||||
bool CrushFXAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const
|
||||
{
|
||||
#if JucePlugin_IsMidiEffect
|
||||
juce::ignoreUnused (layouts);
|
||||
return true;
|
||||
#else
|
||||
// This is the place where you check if the layout is supported.
|
||||
// In this template code we only support mono or stereo.
|
||||
// Some plugin hosts, such as certain GarageBand versions, will only
|
||||
// load plugins that support stereo bus layouts.
|
||||
if (layouts.getMainOutputChannelSet() != juce::AudioChannelSet::mono()
|
||||
&& layouts.getMainOutputChannelSet() != juce::AudioChannelSet::stereo())
|
||||
return false;
|
||||
|
||||
// This checks if the input layout matches the output layout
|
||||
#if ! JucePlugin_IsSynth
|
||||
if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet())
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void CrushFXAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)
|
||||
{
|
||||
juce::ScopedNoDenormals noDenormals;
|
||||
auto totalNumInputChannels = getTotalNumInputChannels();
|
||||
auto totalNumOutputChannels = getTotalNumOutputChannels();
|
||||
|
||||
// In case we have more outputs than inputs, this code clears any output
|
||||
// channels that didn't contain input data, (because these aren't
|
||||
// guaranteed to be empty - they may contain garbage).
|
||||
// This is here to avoid people getting screaming feedback
|
||||
// when they first compile a plugin, but obviously you don't need to keep
|
||||
// this code if your algorithm always overwrites all the output channels.
|
||||
for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
|
||||
buffer.clear (i, 0, buffer.getNumSamples());
|
||||
|
||||
// This is the place where you'd normally do the guts of your plugin's
|
||||
// audio processing...
|
||||
// Make sure to reset the state if your inner loop is processing
|
||||
// the samples and the outer loop is handling the channels.
|
||||
// Alternatively, you can process the samples with the channels
|
||||
// interleaved by keeping the same state.
|
||||
for (int channel = 0; channel < totalNumInputChannels; ++channel)
|
||||
{
|
||||
auto* channelData = buffer.getWritePointer (channel);
|
||||
|
||||
// ..do something to the data...
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
bool CrushFXAudioProcessor::hasEditor() const
|
||||
{
|
||||
return true; // (change this to false if you choose to not supply an editor)
|
||||
}
|
||||
|
||||
juce::AudioProcessorEditor* CrushFXAudioProcessor::createEditor()
|
||||
{
|
||||
return new CrushFXAudioProcessorEditor (*this);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void CrushFXAudioProcessor::getStateInformation (juce::MemoryBlock& destData)
|
||||
{
|
||||
// You should use this method to store your parameters in the memory block.
|
||||
// You could do that either as raw data, or use the XML or ValueTree classes
|
||||
// as intermediaries to make it easy to save and load complex data.
|
||||
}
|
||||
|
||||
void CrushFXAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
|
||||
{
|
||||
// You should use this method to restore your parameters from this memory block,
|
||||
// whose contents will have been created by the getStateInformation() call.
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// This creates new instances of the plugin..
|
||||
juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter()
|
||||
{
|
||||
return new CrushFXAudioProcessor();
|
||||
}
|
||||
59
Source/PluginProcessor.h
Normal file
59
Source/PluginProcessor.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file contains the basic framework code for a JUCE plugin processor.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <JuceHeader.h>
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
*/
|
||||
class CrushFXAudioProcessor : public juce::AudioProcessor
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
CrushFXAudioProcessor();
|
||||
~CrushFXAudioProcessor() override;
|
||||
|
||||
//==============================================================================
|
||||
void prepareToPlay (double sampleRate, int samplesPerBlock) override;
|
||||
void releaseResources() override;
|
||||
|
||||
#ifndef JucePlugin_PreferredChannelConfigurations
|
||||
bool isBusesLayoutSupported (const BusesLayout& layouts) const override;
|
||||
#endif
|
||||
|
||||
void processBlock (juce::AudioBuffer<float>&, juce::MidiBuffer&) override;
|
||||
|
||||
//==============================================================================
|
||||
juce::AudioProcessorEditor* createEditor() override;
|
||||
bool hasEditor() const override;
|
||||
|
||||
//==============================================================================
|
||||
const juce::String getName() const override;
|
||||
|
||||
bool acceptsMidi() const override;
|
||||
bool producesMidi() const override;
|
||||
bool isMidiEffect() const override;
|
||||
double getTailLengthSeconds() const override;
|
||||
|
||||
//==============================================================================
|
||||
int getNumPrograms() override;
|
||||
int getCurrentProgram() override;
|
||||
void setCurrentProgram (int index) override;
|
||||
const juce::String getProgramName (int index) override;
|
||||
void changeProgramName (int index, const juce::String& newName) override;
|
||||
|
||||
//==============================================================================
|
||||
void getStateInformation (juce::MemoryBlock& destData) override;
|
||||
void setStateInformation (const void* data, int sizeInBytes) override;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CrushFXAudioProcessor)
|
||||
};
|
||||
Reference in New Issue
Block a user