Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bdejong committed Jun 3, 2017
2 parents b818788 + 973b99e commit 0592d5a
Show file tree
Hide file tree
Showing 62 changed files with 1,203 additions and 1,365 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
.vs/
*.sln
*.vcxproj*
CMakeSettings.json

# VST specific
*.vst
Expand Down Expand Up @@ -62,9 +63,6 @@ Win32/
install_manifest.txt
out.wav
Testing/

# Build Tree
/buildx86
/buildx64
CMakeBuild

Steinberg
218 changes: 102 additions & 116 deletions AnechoicRoomSimulator/ASupaEditor.cpp
Original file line number Diff line number Diff line change
@@ -1,135 +1,121 @@
// ASupaEditor.cpp: implementation of the ASupaEditor class.
//
//////////////////////////////////////////////////////////////////////

#include "ASupaEditor.h"
#include "DelayExample.hpp"
#include "ASupaEditor.hpp"
#include "AnechoicRoomSim.hpp"
#include <stdio.h>
#include "math.h"
#include "resource.h"
#include <math.h>

ASupaEditor::ASupaEditor(AudioEffect *effect):AEffGUIEditor (effect)
ASupaEditor::ASupaEditor(AudioEffect* effect) : AEffGUIEditor(effect)
{
sizeKnob = 0;
sizeDisplay = 0;
frame = 0;

// init the size of the plugin
rect.left = 0;
rect.top = 0;
rect.right = 302;
rect.bottom = 192;
sizeKnob = nullptr;
sizeDisplay = nullptr;
frame = nullptr;

// init the size of the plugin
rect.left = 0;
rect.top = 0;
rect.right = 302;
rect.bottom = 192;
}

ASupaEditor::~ASupaEditor()
bool ASupaEditor::open(void* ptr)
{
AEffGUIEditor::open(ptr);

CBitmap* hBackground = new CBitmap("back.png");
CBitmap* distknob = new CBitmap("knob.png");
CBitmap* greyText = new CBitmap("type.png");
CBitmap* splashBitmap = new CBitmap("splash.png");

//init frame
CRect size(0, 0, hBackground->getWidth(), hBackground->getHeight());
frame = new CFrame(size, this);
frame->open(ptr);
frame->setBackground(hBackground);
setKnobMode(kLinearMode);

CColor grey = { 118,118,118 };
CColor white = { 255,255,255 };
CColor red = { 255,0,0 };

long displayWidth = 30;
long displayHeight = 6;

char temp[256];
(static_cast<AnechoicRoomSim*>(effect))->getDisplay(AnechoicRoomSim::kSize, temp);
sizeDisplay = new CTextDisplay(CRect(39, 159, 103, 159 + displayHeight), greyText, grey);
sizeDisplay->setText(temp);
frame->addView(sizeDisplay);

// distortion
sizeKnob = new CAnimKnob(CRect(117, 63, 117 + distknob->getWidth(), 63 + distknob->getHeight() / 111), this, AnechoicRoomSim::kSize, 111, 68, distknob, CPoint(0, 0));
sizeKnob->setDefaultValue(0.5f);
sizeKnob->setValue(effect->getParameter(AnechoicRoomSim::kSize));
frame->addView(sizeKnob);

splash = new CSplashScreen(CRect(220, 23, 275, 74), this, 1000, splashBitmap, size, CPoint(0, 0));
frame->addView(splash);

// forget bitmaps
hBackground->forget();
distknob->forget();
greyText->forget();
splashBitmap->forget();

return true;
}

long ASupaEditor::open (void *ptr)
void ASupaEditor::close()
{
AEffGUIEditor::open(ptr);

CBitmap *hBackground = new CBitmap(IDB_BACK);
CBitmap *distknob = new CBitmap(IDB_KNOB);
CBitmap *greyText = new CBitmap(IDB_TYPE);
CBitmap *splashBitmap = new CBitmap(IDB_SPLASH);

//init frame
CRect size(0, 0, hBackground->getWidth (), hBackground->getHeight ());
frame = new CFrame(size, ptr, this);
frame->setBackground(hBackground);
setKnobMode(kLinearMode);

CColor grey = {118,118,118};
CColor white = {255,255,255};
CColor red = {255,0,0};

long displayWidth = 30;
long displayHeight = 6;

char temp[256];
((CDelayExample *)effect)->getDisplay(CDelayExample::kSize,temp);
sizeDisplay = new CTextDisplay(CRect(39,159,103,159+displayHeight),greyText,grey);
sizeDisplay->setText(temp);
frame->addView(sizeDisplay);

// distortion
sizeKnob = new CAnimKnob(CRect(117, 63, 117 + distknob->getWidth(), 63 + distknob->getHeight()/111), this, CDelayExample::kSize, 111, 68, distknob, CPoint(0,0));
sizeKnob->setDefaultValue(0.5f);
sizeKnob->setValue(effect->getParameter(CDelayExample::kSize));
frame->addView(sizeKnob);


splash = new CSplashScreen(CRect(220,23,275,74), this, 1000, splashBitmap, size, CPoint(0,0));
frame->addView(splash);

// forget bitmaps
hBackground->forget();
distknob->forget();
greyText->forget();
splashBitmap->forget();

return true;
}

void ASupaEditor::close ()
{
sizeKnob = 0;
sizeDisplay = 0;
splash = 0;

if(frame != 0)
delete frame;

frame = 0;
sizeKnob = nullptr;
sizeDisplay = nullptr;
splash = nullptr;

if (!frame)
{
CFrame* oldFrame = frame;
frame = nullptr;
oldFrame->forget();
}
}

void ASupaEditor::setParameter (long index, float value)
void ASupaEditor::setParameter(VstInt32 index, float value)
{
if (frame == 0)
return;

if(index >= 0 && index < CDelayExample::kNumParams)
{
switch(index)
{
case CDelayExample::kSize : if(sizeKnob) sizeKnob->setValue(value); break;
}

char temp[256];
((CDelayExample *)effect)->getDisplay(index,temp);
switch(index)
{
case CDelayExample::kSize : if(sizeDisplay) sizeDisplay->setText(temp); break;
}
}

postUpdate();
if (!frame)
{
return;
}

if (index >= 0 && index < AnechoicRoomSim::kNumParams)
{
switch (index)
{
case AnechoicRoomSim::kSize: if (sizeKnob) sizeKnob->setValue(value); break;
}

char temp[256];
(static_cast<AnechoicRoomSim*>(effect))->getDisplay(index, temp);

switch (index)
{
case AnechoicRoomSim::kSize: if (sizeDisplay) sizeDisplay->setText(temp); break;
}
}
}

void ASupaEditor::valueChanged (CDrawContext* context, CControl* control)
void ASupaEditor::valueChanged(CControl* control)
{
long tag = control->getTag();

if(tag >= 0 && tag < CDelayExample::kNumParams)
{
char temp[256];
((CDelayExample *)effect)->getDisplay(tag,temp);
long tag = control->getTag();

switch(tag)
{
case CDelayExample::kSize : if(sizeDisplay) sizeDisplay->setText(temp); break;
}
if (tag >= 0 && tag < AnechoicRoomSim::kNumParams)
{
char temp[256];
(static_cast<AnechoicRoomSim*>(effect))->getDisplay(tag, temp);

//update control...
effect->setParameterAutomated(tag, control->getValue ());
}
switch (tag)
{
case AnechoicRoomSim::kSize: if (sizeDisplay) sizeDisplay->setText(temp); break;
}

if(context != 0)
control->update(context);
//update control...
effect->setParameterAutomated(tag, control->getValue());
}
}




37 changes: 0 additions & 37 deletions AnechoicRoomSimulator/ASupaEditor.h

This file was deleted.

23 changes: 23 additions & 0 deletions AnechoicRoomSimulator/ASupaEditor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

#include "plugin-bindings/aeffguieditor.h"

#include "TextDisplay.hpp"

class ASupaEditor :public AEffGUIEditor, public IControlListener
{
public:
ASupaEditor(AudioEffect* effect);
virtual ~ASupaEditor() = default;

virtual bool open(void* ptr) override;
virtual void close() override;

virtual void setParameter(VstInt32 index, float value) override;
virtual void valueChanged(CControl* control) override;

protected:
CAnimKnob* sizeKnob;
CTextDisplay* sizeDisplay;
CSplashScreen* splash;
};
Loading

0 comments on commit 0592d5a

Please sign in to comment.