forked from bdejong/smartelectronix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/bdejong/smartelectronix
- Loading branch information
Showing
62 changed files
with
1,203 additions
and
1,365 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} | ||
|
||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; |
Oops, something went wrong.