This commit is contained in:
trentgill
2017-06-27 21:28:18 -04:00
12 changed files with 66 additions and 261 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ JuceLibraryCode/
Builds/ Builds/
*bak *bak
*jucer *jucer
*RPP

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# pete
A VST plugin with JUCE. It makes noise. Stay tuned.

View File

@@ -1,16 +0,0 @@
#pragma once
class LampshadeLine {
public:
LampshadeLine(bool orientation, float x, float y, float len) : orientation(orientation), x(x), y(y), len(len) {}
LampshadeLine(bool orientation, float x, float y) : orientation(orientation), x(x), y(y), len(1.) {}
LampshadeLine(bool orientation, float xy) : orientation(orientation), x(xy), y(xy), len(1.) {}
bool orientation;
float x;
float y;
float len;
const static bool Horizontal = 0;
const static bool Vertical = 1;
};

View File

@@ -2,7 +2,7 @@
#include "../JuceLibraryCode/JuceHeader.h" #include "../JuceLibraryCode/JuceHeader.h"
class LampshadeLookAndFeel : public LookAndFeel_V4 { class PeteLookAndFeel : public LookAndFeel_V4 {
public: public:
void drawLinearSlider (Graphics& g, void drawLinearSlider (Graphics& g,
int x, int x,

16
Source/PeteLine.h Normal file
View File

@@ -0,0 +1,16 @@
#pragma once
class PeteLine {
public:
PeteLine(bool orientation, float x, float y, float len) : orientation(orientation), x(x), y(y), len(len) {}
PeteLine(bool orientation, float x, float y) : orientation(orientation), x(x), y(y), len(1.) {}
PeteLine(bool orientation, float xy) : orientation(orientation), x(xy), y(xy), len(1.) {}
bool orientation;
float x;
float y;
float len;
const static bool Horizontal = 0;
const static bool Vertical = 1;
};

View File

@@ -1,19 +1,18 @@
#include "PluginProcessor.h" #include "PluginProcessor.h"
#include "PluginEditor.h" #include "PluginEditor.h"
PeteAudioProcessorEditor::PeteAudioProcessorEditor(PeteAudioProcessor& p)
LampshadeAudioProcessorEditor::LampshadeAudioProcessorEditor(LampshadeAudioProcessor& p)
: AudioProcessorEditor (&p), processor (p), lineThickness(4) : AudioProcessorEditor (&p), processor (p), lineThickness(4)
{ {
hlines = { hlines = {
LampshadeLine(LampshadeLine::Horizontal, 1./3.), PeteLine(PeteLine::Horizontal, 1./3.),
LampshadeLine(LampshadeLine::Horizontal, 2./3.) PeteLine(PeteLine::Horizontal, 2./3.)
}; };
vlines = { vlines = {
LampshadeLine(LampshadeLine::Vertical, 1./3.), PeteLine(PeteLine::Vertical, 1./3.),
LampshadeLine(LampshadeLine::Vertical, 1./3.+0.01, 1./3.+0.01, 1./3.), PeteLine(PeteLine::Vertical, 1./3.+0.01, 1./3.+0.01, 1./3.),
LampshadeLine(LampshadeLine::Vertical, 2./3.+0.05, 2./3.+0.05, 2./3.), PeteLine(PeteLine::Vertical, 2./3.+0.05, 2./3.+0.05, 2./3.),
LampshadeLine(LampshadeLine::Vertical, 2./3.) PeteLine(PeteLine::Vertical, 2./3.)
}; };
slider.setTextBoxStyle(Slider::NoTextBox, true, 0, 0); slider.setTextBoxStyle(Slider::NoTextBox, true, 0, 0);
setSize(600, 600); setSize(600, 600);
@@ -23,11 +22,11 @@ LampshadeAudioProcessorEditor::LampshadeAudioProcessorEditor(LampshadeAudioProce
setResizeLimits(300, 300, 1200, 1200); setResizeLimits(300, 300, 1200, 1200);
} }
LampshadeAudioProcessorEditor::~LampshadeAudioProcessorEditor() PeteAudioProcessorEditor::~PeteAudioProcessorEditor()
{ {
} }
void LampshadeAudioProcessorEditor::paint(Graphics& g) void PeteAudioProcessorEditor::paint(Graphics& g)
{ {
g.fillAll(Colours::white); g.fillAll(Colours::white);
@@ -40,7 +39,7 @@ void LampshadeAudioProcessorEditor::paint(Graphics& g)
} }
void LampshadeAudioProcessorEditor::resized() void PeteAudioProcessorEditor::resized()
{ {
// hardcoded because they should stay in the same rectangle // hardcoded because they should stay in the same rectangle
float w = getWidth() * vlines[0].x; float w = getWidth() * vlines[0].x;

View File

@@ -5,26 +5,26 @@
#include "../JuceLibraryCode/JuceHeader.h" #include "../JuceLibraryCode/JuceHeader.h"
#include "PluginProcessor.h" #include "PluginProcessor.h"
#include "LookAndFeel.h" #include "LookAndFeel.h"
#include "LampshadeLine.h" #include "PeteLine.h"
class LampshadeAudioProcessorEditor : public AudioProcessorEditor class PeteAudioProcessorEditor : public AudioProcessorEditor
{ {
public: public:
LampshadeAudioProcessorEditor (LampshadeAudioProcessor&); PeteAudioProcessorEditor (PeteAudioProcessor&);
~LampshadeAudioProcessorEditor(); ~PeteAudioProcessorEditor();
void paint (Graphics&) override; void paint (Graphics&) override;
void resized() override; void resized() override;
private: private:
LampshadeAudioProcessor& processor; PeteAudioProcessor& processor;
LampshadeLookAndFeel* gui = new LampshadeLookAndFeel(); PeteLookAndFeel* gui = new PeteLookAndFeel();
std::vector<LampshadeLine> hlines; std::vector<PeteLine> hlines;
std::vector<LampshadeLine> vlines; std::vector<PeteLine> vlines;
int lineThickness; int lineThickness;
Slider slider; Slider slider;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LampshadeAudioProcessorEditor) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PeteAudioProcessorEditor)
}; };

View File

@@ -1,8 +1,7 @@
#include "PluginProcessor.h" #include "PluginProcessor.h"
#include "PluginEditor.h" #include "PluginEditor.h"
#include <math.h> #include <math.h>
PeteAudioProcessor::PeteAudioProcessor()
LampshadeAudioProcessor::LampshadeAudioProcessor()
#ifndef JucePlugin_PreferredChannelConfigurations #ifndef JucePlugin_PreferredChannelConfigurations
: AudioProcessor (BusesProperties() : AudioProcessor (BusesProperties()
#if ! JucePlugin_IsMidiEffect #if ! JucePlugin_IsMidiEffect
@@ -15,17 +14,14 @@ LampshadeAudioProcessor::LampshadeAudioProcessor()
#endif #endif
{ {
} }
PeteAudioProcessor::~PeteAudioProcessor()
LampshadeAudioProcessor::~LampshadeAudioProcessor()
{ {
} }
const String PeteAudioProcessor::getName() const
const String LampshadeAudioProcessor::getName() const
{ {
return JucePlugin_Name; return JucePlugin_Name;
} }
bool PeteAudioProcessor::acceptsMidi() const
bool LampshadeAudioProcessor::acceptsMidi() const
{ {
#if JucePlugin_WantsMidiInput #if JucePlugin_WantsMidiInput
return true; return true;
@@ -33,73 +29,59 @@ bool LampshadeAudioProcessor::acceptsMidi() const
return false; return false;
#endif #endif
} }
bool PeteAudioProcessor::producesMidi() const
bool LampshadeAudioProcessor::producesMidi() const
{ {
return false; return false;
} }
double PeteAudioProcessor::getTailLengthSeconds() const
double LampshadeAudioProcessor::getTailLengthSeconds() const
{ {
return 0.0; return 0.0;
} }
int PeteAudioProcessor::getNumPrograms()
int LampshadeAudioProcessor::getNumPrograms()
{ {
return 1; return 1;
} }
int PeteAudioProcessor::getCurrentProgram()
int LampshadeAudioProcessor::getCurrentProgram()
{ {
return 0; return 0;
} }
void PeteAudioProcessor::setCurrentProgram (int index)
void LampshadeAudioProcessor::setCurrentProgram (int index)
{ {
} }
const String PeteAudioProcessor::getProgramName (int index)
const String LampshadeAudioProcessor::getProgramName (int index)
{ {
return {}; return {};
} }
void PeteAudioProcessor::changeProgramName (int index, const String& newName)
void LampshadeAudioProcessor::changeProgramName (int index, const String& newName)
{ {
} }
void PeteAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
void LampshadeAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
{ {
myYin = Yin(sampleRate, samplesPerBlock); myYin = Yin(sampleRate, samplesPerBlock);
aFilter = (filter_svf_t*)malloc(sizeof(filter_svf_t)); aFilter = (filter_svf_t*)malloc(sizeof(filter_svf_t));
svf_init(aFilter, 2, sampleRate); svf_init(aFilter, 2, sampleRate);
} }
void PeteAudioProcessor::releaseResources()
void LampshadeAudioProcessor::releaseResources()
{ {
} }
#ifndef JucePlugin_PreferredChannelConfigurations #ifndef JucePlugin_PreferredChannelConfigurations
bool LampshadeAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const bool PeteAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const
{ {
if (layouts.getMainOutputChannelSet() != AudioChannelSet::mono() if (layouts.getMainOutputChannelSet() != AudioChannelSet::mono()
&& layouts.getMainOutputChannelSet() != AudioChannelSet::stereo()) && layouts.getMainOutputChannelSet() != AudioChannelSet::stereo())
return false; return false;
#if ! JucePlugin_IsSynth #if ! JucePlugin_IsSynth
if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet()) if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet())
return false; return false;
#endif #endif
return true; return true;
} }
#endif #endif
void PeteAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
void LampshadeAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
{ {
static float incrementer; static float incrementer;
const int totalNumInputChannels = getTotalNumInputChannels(); const int totalNumInputChannels = getTotalNumInputChannels();
const int totalNumOutputChannels = getTotalNumOutputChannels(); const int totalNumOutputChannels = getTotalNumOutputChannels();
// In case we have more outputs than inputs, this code clears any output // In case we have more outputs than inputs, this code clears any output
// channels that didn't contain input data, (because these aren't // channels that didn't contain input data, (because these aren't
// guaranteed to be empty - they may contain garbage). // guaranteed to be empty - they may contain garbage).
@@ -108,7 +90,6 @@ void LampshadeAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffe
// this code if your algorithm always overwrites all the output channels. // this code if your algorithm always overwrites all the output channels.
for (int i = totalNumInputChannels; i < totalNumOutputChannels; ++i) for (int i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
buffer.clear(i, 0, buffer.getNumSamples()); buffer.clear(i, 0, buffer.getNumSamples());
float pitch = myYin.getPitch(buffer.getWritePointer (0)); // returns Pitch in Hertz float pitch = myYin.getPitch(buffer.getWritePointer (0)); // returns Pitch in Hertz
static float myPitch; static float myPitch;
if(pitch > 0) { myPitch = pitch; } if(pitch > 0) { myPitch = pitch; }
@@ -125,26 +106,21 @@ void LampshadeAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffe
} }
printf("%f\n",channel1Data[0]); printf("%f\n",channel1Data[0]);
} }
bool PeteAudioProcessor::hasEditor() const
bool LampshadeAudioProcessor::hasEditor() const
{ {
return true; return true;
} }
AudioProcessorEditor* PeteAudioProcessor::createEditor()
AudioProcessorEditor* LampshadeAudioProcessor::createEditor()
{ {
return new LampshadeAudioProcessorEditor(*this); return new PeteAudioProcessorEditor(*this);
} }
void PeteAudioProcessor::getStateInformation (MemoryBlock& destData)
void LampshadeAudioProcessor::getStateInformation (MemoryBlock& destData)
{ {
} }
void PeteAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
void LampshadeAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{ {
} }
AudioProcessor* JUCE_CALLTYPE createPluginFilter() AudioProcessor* JUCE_CALLTYPE createPluginFilter()
{ {
return new LampshadeAudioProcessor(); return new PeteAudioProcessor();
} }

View File

@@ -7,11 +7,11 @@ extern "C" {
}; };
class LampshadeAudioProcessor : public AudioProcessor class PeteAudioProcessor : public AudioProcessor
{ {
public: public:
LampshadeAudioProcessor(); PeteAudioProcessor();
~LampshadeAudioProcessor(); ~PeteAudioProcessor();
void prepareToPlay (double sampleRate, int samplesPerBlock) override; void prepareToPlay (double sampleRate, int samplesPerBlock) override;
void releaseResources() override; void releaseResources() override;
@@ -41,7 +41,7 @@ public:
void setStateInformation (const void* data, int sizeInBytes) override; void setStateInformation (const void* data, int sizeInBytes) override;
private: private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LampshadeAudioProcessor) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PeteAudioProcessor)
Yin myYin; Yin myYin;
filter_svf_t* aFilter; filter_svf_t* aFilter;
}; };

174
test.RPP
View File

@@ -1,174 +0,0 @@
<REAPER_PROJECT 0.1 "5.40/OSX64" 1498537701
RIPPLE 0
GROUPOVERRIDE 0 0 0
AUTOXFADE 1
ENVATTACH 1
MIXERUIFLAGS 11 48
PEAKGAIN 1
FEEDBACK 0
PANLAW 1
PROJOFFS 0 0
MAXPROJLEN 0 600
GRID 3199 8 1 8 1 0 0 0
TIMEMODE 1 5 -1 30 0
VIDEO_CONFIG 0 0 256
PANMODE 3
CURSOR 2.5
ZOOM 100 0 0
VZOOMEX 6
USE_REC_CFG 0
RECMODE 1
SMPTESYNC 0 30 100 40 1000 300 0 0 1 0 0
LOOP 0
LOOPGRAN 0 4
RECORD_PATH "" ""
<RECORD_CFG
>
<APPLYFX_CFG
>
RENDER_FILE ""
RENDER_PATTERN ""
RENDER_FMT 0 2 0
RENDER_1X 0
RENDER_RANGE 1 0 0 18 1000
RENDER_RESAMPLE 3 0 1
RENDER_ADDTOPROJ 0
RENDER_STEMS 0
RENDER_DITHER 0
TIMELOCKMODE 1
TEMPOENVLOCKMODE 1
ITEMMIX 0
DEFPITCHMODE 589824
TAKELANE 0
SAMPLERATE 44100 0 0
<RENDER_CFG
>
LOCK 16385
<METRONOME 6 2
VOL 0.25 0.125
FREQ 800 1600 1
BEATLEN 4
SAMPLES "" ""
PATTERN 2863311530 2863311529
>
GLOBAL_AUTO -1
TEMPO 120 4 4
PLAYRATE 1 0 0.25 4
SELECTION 0 0
SELECTION2 0 0
MASTERAUTOMODE 0
MASTERTRACKHEIGHT 0
MASTERPEAKCOL 16576
MASTERMUTESOLO 0
MASTERTRACKVIEW 0 0.6667 0.5 0.5 0 0 0
MASTERHWOUT 0 0 1 0 0 0 0 -1
MASTER_NCH 2 2
MASTER_VOLUME 1 0 -1 -1 1
MASTER_FX 0
MASTER_SEL 0
<MASTERFXLIST
WNDRECT 34 68 839 677
SHOW 0
LASTSEL 0
DOCKED 0
>
<MASTERPLAYSPEEDENV
ACT 0
VIS 0 1 1
LANEHEIGHT 0 0
ARM 0
DEFSHAPE 0 -1 -1
>
<TEMPOENVEX
ACT 0
VIS 1 0 1
LANEHEIGHT 0 0
ARM 0
DEFSHAPE 1 -1 -1
>
<PROJBAY
>
<TRACK {0285AA2F-2341-854C-BBEE-985C6E7A9ADD}
NAME "0001 3-Audio"
PEAKCOL 16576
BEAT -1
AUTOMODE 0
VOLPAN 1 0 -1 -1 1
MUTESOLO 0 0 0
IPHASE 0
ISBUS 0 0
BUSCOMP 0 0
SHOWINMIX 1 0.6667 0.5 1 0.5 0 0 0
FREEMODE 0
SEL 1
REC 0 0 0 0 0 0 0
VU 2
TRACKHEIGHT 0 0
INQ 0 0 0 0.5 100 0 0 100
NCHAN 2
FX 1
TRACKID {0285AA2F-2341-854C-BBEE-985C6E7A9ADD}
PERF 0
MIDIOUT -1
MAINSEND 1 0
<FXCHAIN
WNDRECT 125 169 839 676
SHOW 0
LASTSEL 0
DOCKED 0
BYPASS 0 0 0
<VST "VST: lampshade (yourcompany)" lampshade.vst 0 "" 1382378611
c2xlUu5e7f4CAAAAAQAAAAAAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAAAAAAACAAAAAAAAAAAABAA
776t3g3wrd4=
AAAQAAAA
>
FLOATPOS 0 0 0 0
FXID {B7DD42FB-8D0E-C24C-924A-407EC4334EB7}
WAK 0
>
<ITEM
POSITION 0
SNAPOFFS 0
LENGTH 2.368
LOOP 1
ALLTAKES 0
FADEIN 1 0.01 0 1 0 0
FADEOUT 1 0.01 0 1 0 0
MUTE 0
SEL 0
IGUID {40DBFCD1-92BE-4748-9291-13EFE644D598}
IID 1
NAME "0001 3-Audio.wav"
VOLPAN 1 0 1 -1
SOFFS 0
PLAYRATE 1 1 0 -1 0 0.0025
CHANMODE 0
GUID {76289E0D-F3CA-8942-B926-B9E354D05BC9}
<SOURCE WAVE
FILE "test Project/Samples/Recorded/0001 3-Audio.wav"
>
>
<ITEM
POSITION 2.5
SNAPOFFS 0
LENGTH 2.85605442176871
LOOP 1
ALLTAKES 0
FADEIN 1 0.01 0 1 0 0
FADEOUT 1 0.01 0 1 0 0
MUTE 0
SEL 0
IGUID {40AE50E4-88C5-B04D-BC5B-0252C25CB29D}
IID 2
NAME "0002 3-Audio-1.wav"
VOLPAN 1 0 1 -1
SOFFS 0
PLAYRATE 1 1 0 -1 0 0.0025
CHANMODE 0
GUID {5224CF49-4571-E246-A76E-9A2EA5058049}
<SOURCE WAVE
FILE "test Project/Samples/Recorded/0002 3-Audio-1.wav"
>
>
>
>

2
wrLib

Submodule wrLib updated: a4e5fa1c58...76147e53b1