initial: added first widget

This commit is contained in:
2017-06-19 16:59:27 -04:00
parent 755ee11d51
commit 1842a6cfeb
6 changed files with 185 additions and 49 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
JuceLibraryCode/
Builds/
*bak

51
Source/LookAndFeel.h Normal file
View File

@@ -0,0 +1,51 @@
//
// LookAndFeel.h
// lampshade
//
// Created by Veit Heller on 19.06.17.
//
//
#pragma once
#include "../JuceLibraryCode/JuceHeader.h"
class LampshadeLookAndFeel : public LookAndFeel_V4 {
public:
void drawLinearSlider (Graphics& g,
int x,
int y,
int width,
int height,
float sliderPos,
float minSliderPos,
float maxSliderPos,
const Slider::SliderStyle s,
Slider& slider) override
{
g.setColour(fillColor);
g.fillRect((int)(x-minSliderPos), y, (int)(width+minSliderPos+maxSliderPos), height);
drawLinearSliderThumb(g, x, y, width, height, sliderPos, minSliderPos, maxSliderPos, s, slider);
}
void drawLinearSliderThumb(Graphics & g,
int x,
int y,
int width,
int height,
float sliderPos,
float minSliderPos,
float maxSliderPos,
const Slider::SliderStyle ,
Slider& slider) override {
g.setColour(sliderColor);
int nwidth = width+minSliderPos+maxSliderPos;
g.fillRect((int)(x-minSliderPos), y, (int)(nwidth*((sliderPos-minSliderPos)/width)), height);
}
Label* createSliderTextBox(Slider&) override { return nullptr; }
private:
Colour fillColor = Colours::yellow;
Colour sliderColor = Colours::red;
};

View File

@@ -12,13 +12,15 @@
#include "PluginEditor.h"
//==============================================================================
LampshadeAudioProcessorEditor::LampshadeAudioProcessorEditor (LampshadeAudioProcessor& p)
: AudioProcessorEditor (&p), processor (p)
: AudioProcessorEditor (&p), processor (p), nlines (3), lineThickness(4)
{
// Make sure that before the constructor has finished, you've set the
// editor's size to whatever you need it to be.
setSize (400, 300);
component.setTextBoxStyle(Slider::NoTextBox, true, 0, 0);
setSize(400, 300);
component.setLookAndFeel(gui);
addAndMakeVisible(component);
}
LampshadeAudioProcessorEditor::~LampshadeAudioProcessorEditor()
@@ -29,15 +31,15 @@ LampshadeAudioProcessorEditor::~LampshadeAudioProcessorEditor()
void LampshadeAudioProcessorEditor::paint (Graphics& g)
{
// (Our component is opaque, so we must completely fill the background with a solid colour)
g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
g.fillAll(Colours::white);
g.setColour (Colours::white);
g.setFont (15.0f);
g.drawFittedText ("Hello World!", getLocalBounds(), Justification::centred, 1);
for (int i = 1; i < nlines; i++) {
g.drawLine(0, getHeight()*((float)i / nlines), getWidth(), getHeight()*((float)i / nlines), lineThickness);
g.drawLine(getWidth()*((float) i /nlines), 0, getWidth()*((float) i /nlines), getHeight(), lineThickness);
}
}
void LampshadeAudioProcessorEditor::resized()
{
// This is generally where you'll want to lay out the positions of any
// subcomponents in your editor..
component.setBounds(getWidth()/nlines+lineThickness/2, getHeight()/nlines+lineThickness/2, getWidth()/nlines-lineThickness+1, getHeight()/nlines-lineThickness);
}

View File

@@ -12,6 +12,7 @@
#include "../JuceLibraryCode/JuceHeader.h"
#include "PluginProcessor.h"
#include "LookAndFeel.h"
//==============================================================================
@@ -31,6 +32,11 @@ private:
// This reference is provided as a quick way for your editor to
// access the processor object that created it.
LampshadeAudioProcessor& processor;
LampshadeLookAndFeel* gui = new LampshadeLookAndFeel();
int nlines;
int lineThickness;
Slider component;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LampshadeAudioProcessorEditor)
};

View File

@@ -1,18 +1,7 @@
/*
==============================================================================
This file was auto-generated!
It contains the basic framework code for a JUCE plugin processor.
==============================================================================
*/
#include "PluginProcessor.h"
#include "PluginEditor.h"
//==============================================================================
LampshadeAudioProcessor::LampshadeAudioProcessor()
#ifndef JucePlugin_PreferredChannelConfigurations
: AudioProcessor (BusesProperties()
@@ -31,7 +20,6 @@ LampshadeAudioProcessor::~LampshadeAudioProcessor()
{
}
//==============================================================================
const String LampshadeAudioProcessor::getName() const
{
return JucePlugin_Name;
@@ -48,11 +36,7 @@ bool LampshadeAudioProcessor::acceptsMidi() const
bool LampshadeAudioProcessor::producesMidi() const
{
#if JucePlugin_ProducesMidiOutput
return true;
#else
return false;
#endif
return false;
}
double LampshadeAudioProcessor::getTailLengthSeconds() const
@@ -62,8 +46,7 @@ double LampshadeAudioProcessor::getTailLengthSeconds() const
int LampshadeAudioProcessor::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.
return 1;
}
int LampshadeAudioProcessor::getCurrentProgram()
@@ -84,31 +67,22 @@ void LampshadeAudioProcessor::changeProgramName (int index, const String& newNam
{
}
//==============================================================================
void LampshadeAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
{
// Use this method as the place to do any pre-playback
// initialisation that you need..
}
void LampshadeAudioProcessor::releaseResources()
{
// When playback stops, you can use this as an opportunity to free up any
// spare memory, etc.
}
#ifndef JucePlugin_PreferredChannelConfigurations
bool LampshadeAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const
{
#if JucePlugin_IsMidiEffect
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.
if (layouts.getMainOutputChannelSet() != AudioChannelSet::mono()
&& layouts.getMainOutputChannelSet() != AudioChannelSet::stereo())
return false;
// This is the place where you check if the layout is supported.
// In this template code we only support mono or stereo.
if (layouts.getMainOutputChannelSet() != AudioChannelSet::mono()
&& layouts.getMainOutputChannelSet() != AudioChannelSet::stereo())
return false;
// This checks if the input layout matches the output layout
#if ! JucePlugin_IsSynth
@@ -117,7 +91,6 @@ bool LampshadeAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts
#endif
return true;
#endif
}
#endif
@@ -139,16 +112,15 @@ void LampshadeAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffe
// audio processing...
for (int channel = 0; channel < totalNumInputChannels; ++channel)
{
float* channelData = buffer.getWritePointer (channel);
//float* channelData = buffer.getWritePointer (channel);
// ..do something to the data...
}
}
//==============================================================================
bool LampshadeAudioProcessor::hasEditor() const
{
return true; // (change this to false if you choose to not supply an editor)
return true;
}
AudioProcessorEditor* LampshadeAudioProcessor::createEditor()
@@ -156,7 +128,6 @@ AudioProcessorEditor* LampshadeAudioProcessor::createEditor()
return new LampshadeAudioProcessorEditor (*this);
}
//==============================================================================
void LampshadeAudioProcessor::getStateInformation (MemoryBlock& destData)
{
// You should use this method to store your parameters in the memory block.

105
test.RPP Normal file
View File

@@ -0,0 +1,105 @@
<REAPER_PROJECT 0.1 "5.40/OSX64" 1497899251
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 0
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 1
SAMPLERATE 44100 0 0
<RENDER_CFG
>
LOCK 1
<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 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