Skip to content

Commit

Permalink
Initial porting done
Browse files Browse the repository at this point in the history
  • Loading branch information
dozius committed Feb 24, 2017
1 parent 9904b86 commit 580e5d5
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 155 deletions.
36 changes: 16 additions & 20 deletions AnechoicRoomSimulator/ASupaEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
#include "DelayExample.hpp"
#include <stdio.h>
#include "math.h"
#include "resource.h"

ASupaEditor::ASupaEditor(AudioEffect *effect):AEffGUIEditor (effect)
ASupaEditor::ASupaEditor(AudioEffect *effect) : AEffGUIEditor(effect)
{
sizeKnob = 0;
sizeDisplay = 0;
Expand All @@ -25,18 +24,19 @@ ASupaEditor::~ASupaEditor()
{
}

long ASupaEditor::open (void *ptr)
bool ASupaEditor::open(void *ptr)
{
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);
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, ptr, this);
frame = new CFrame(size, this);
frame->open(ptr);
frame->setBackground(hBackground);
setKnobMode(kLinearMode);

Expand Down Expand Up @@ -72,19 +72,20 @@ long ASupaEditor::open (void *ptr)
return true;
}

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

if(frame != 0)
delete frame;

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

void ASupaEditor::setParameter (long index, float value)
void ASupaEditor::setParameter(VstInt32 index, float value)
{
if (frame == 0)
return;
Expand All @@ -104,11 +105,9 @@ void ASupaEditor::setParameter (long index, float value)
case CDelayExample::kSize : if(sizeDisplay) sizeDisplay->setText(temp); break;
}
}

postUpdate();
}

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

Expand All @@ -125,9 +124,6 @@ void ASupaEditor::valueChanged (CDrawContext* context, CControl* control)
//update control...
effect->setParameterAutomated(tag, control->getValue ());
}

if(context != 0)
control->update(context);
}


Expand Down
22 changes: 6 additions & 16 deletions AnechoicRoomSimulator/ASupaEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,26 @@
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_ASUPAEDITOR_H__B92F8BC1_D048_11D3_9312_C56A22663A38__INCLUDED_)
#define AFX_ASUPAEDITOR_H__B92F8BC1_D048_11D3_9312_C56A22663A38__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "vstgui.h"
#include "plugin-bindings/aeffguieditor.h"

#include "TextDisplay.h"

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

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

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

protected:

CAnimKnob *sizeKnob;

CTextDisplay *sizeDisplay;

CSplashScreen *splash;
};

#endif // !defined(AFX_ASUPAEDITOR_H__B92F8BC1_D048_11D3_9312_C56A22663A38__INCLUDED_)
28 changes: 28 additions & 0 deletions AnechoicRoomSimulator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.5)

include(${CMAKE_CURRENT_SOURCE_DIR}/../common/common.cmake)

pre_build()

project(AnechoicRoomSimulator)

set(PROJECT_SOURCE
${CMAKE_CURRENT_SOURCE_DIR}/asciitable.cpp
${CMAKE_CURRENT_SOURCE_DIR}/asciitable.h
${CMAKE_CURRENT_SOURCE_DIR}/ASupaEditor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ASupaEditor.h
${CMAKE_CURRENT_SOURCE_DIR}/DelayExample.cpp
${CMAKE_CURRENT_SOURCE_DIR}/DelayExample.hpp
${CMAKE_CURRENT_SOURCE_DIR}/DelayExampleMain.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TextDisplay.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TextDisplay.h
)

set(PROJECT_IMAGES
${CMAKE_CURRENT_SOURCE_DIR}/images/back.png
${CMAKE_CURRENT_SOURCE_DIR}/images/knob.png
${CMAKE_CURRENT_SOURCE_DIR}/images/splash.png
${CMAKE_CURRENT_SOURCE_DIR}/images/type.png
)

build_vst_gui(AnechoicRoomSimulator "${PROJECT_SOURCE}" "${PROJECT_IMAGES}")
116 changes: 81 additions & 35 deletions AnechoicRoomSimulator/DelayExample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
#include "ASupaEditor.h"
#include "math.h"

void vstint2string(const VstInt32 number, char* str)
{
std::stringstream ss;
ss << number;
strcpy(str, ss.str().c_str());
}

//-----------------------------------------------------------------------------
CDelayExample::CDelayExample(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParams)
{
setNumInputs(kNumInputChannels); // stereo in
setNumOutputs(kNumOutputChannels); // stereo out
setUniqueID('AneC'); // TODO: Change for plugin identification
canMono(); // makes sense to feed both inputs with the same signal
canProcessReplacing(); // supports both accumulating and replacing output

//clear buffers!
Expand Down Expand Up @@ -37,7 +42,7 @@ CDelayExample::~CDelayExample()
///////////////////////////////////////////////////////////////////////////////////////////

//-----------------------------------------------------------------------------------------
void CDelayExample::setParameter(long index, float value)
void CDelayExample::setParameter(VstInt32 index, float value)
{
// save the parameter for the host...
savedParameters[index] = value;
Expand All @@ -57,7 +62,7 @@ void CDelayExample::setParameter(long index, float value)
}

//-----------------------------------------------------------------------------------------
float CDelayExample::getParameter(long index)
float CDelayExample::getParameter(VstInt32 index)
{
// you should only really change this in special occasions
// for example, when you use programs!!
Expand All @@ -68,7 +73,7 @@ float CDelayExample::getParameter(long index)
}

//-----------------------------------------------------------------------------------------
void CDelayExample::getParameterName(long index, char *label)
void CDelayExample::getParameterName(VstInt32 index, char *label)
{
// TODO: give the parameters names, make sure you don't use more than 24 characters!
switch(index)
Expand All @@ -79,19 +84,19 @@ void CDelayExample::getParameterName(long index, char *label)
}

//-----------------------------------------------------------------------------------------
void CDelayExample::getParameterDisplay(long index, char *text)
void CDelayExample::getParameterDisplay(VstInt32 index, char *text)
{
// TODO: give the parameters displays
// you could use float2string(), dB2string(), long2string() or roll your own
switch(index)
{
case kSize : long2string((long)(savedParameters[index]*10000.f), text); break;
case kSize : vstint2string((VstInt32)(savedParameters[index]*10000.f), text); break;
default : strcpy(text, ""); break;
}
}

//-----------------------------------------------------------------------------------------
void CDelayExample::getParameterLabel(long index, char *label)
void CDelayExample::getParameterLabel(VstInt32 index, char *label)
{
// TODO: give the parameters labels
switch(index)
Expand Down Expand Up @@ -121,7 +126,7 @@ void CDelayExample::getProgramName(char *name)
}

//-----------------------------------------------------------------------------------------
void CDelayExample::setProgram(long index)
void CDelayExample::setProgram(VstInt32 index)
{
// this template does not use programs yet
};
Expand All @@ -132,29 +137,72 @@ void CDelayExample::setProgram(long index)
// the actual processing
///////////////////////////////////////////////////////////////////////////////////////////

//-----------------------------------------------------------------------------------------
void CDelayExample::process(float **inputs, float **outputs, long sampleFrames)
{
// reminder : VST allows for sampleFrames to be different every block

// this will only work if you have two in's and two out's!!
float *in1 = inputs[0];
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];

// accumilate into output
// watch out: in and out might actualy be the SAME array!!!
for(long i=0;i<sampleFrames;i++)
{
out1[i] += in1[i];
out2[i] += in2[i];
}
}

//-----------------------------------------------------------------------------------------
void CDelayExample::processReplacing(float **inputs, float **outputs, long sampleFrames)
{
void CDelayExample::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
{
// .. . ....,,.... . ..
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN+
// .MMM, ...$MMMMMMMMDI.. . . ....IMMMMMMMMMMM=
// MMM . ..$M,. .. .+ODMMMM8~ . .:MNMMM7
// .MMN ..M?. 8MMD+.. .=DMM:. . ..: ..MMMN.
// MM:.. .N:...8M:. ... . .. ...... . . .. . MMM.
// MM+ . 7. .8D..NMM= .. .....:+?~. . .MMM .
// .MM$ .I. .M. .M ,. .D.. :N~.. IMM.
// MMM . M:.MO Z M. . M. MM.
// .MM. .$..M .. ... O .. . . MM.
// .MM.. . .MMMMMMMMMMMMM=. . . MMM.
// .MMM. :MMMMMMMMMMM ~MMMM. .. .NMMMMMMM. .MMM.
// 8MMMMMMMD~ .. D8.NMM.ZMMMMMMM .. ~MMM. OMMMMMM ,MMMM ... .~MMD..
// .MMMMZ....... .+M8. MMMMMMMMMMMMMMMMI. =MM= IMM.MMMMMMMMMMMMMM.. ... ..$8. NMM,
// IMM.N. ..NMMMMMM~.... .OM. 8MMMMMO 8MMMMM?.. I..=7..MM.
// NMM M.. ~MMM~ ,MMMMN .MMMM :~ .M= ........=M. ,.M,
// +MM + MMM . M .,MMMMMMMMMMM8. M= . ..MMMMMMMNM I M,M:
// MM ? .7MM. MM7 . ....,:,... MN ZMMMMMM? .. .7M., O MI
// .MM. I .MM. ,MMMMM .. ,...:? .. =MMM, . ..=DMMM .M:. . N.M8
// .MM ?. MM. IMMMM?.,MMMMI.. ....... M8MMMMM~. MMM$ ,M+ N. MIM$
// MM ...7MM:MMI$MM ..MMMMM... ..... ..MM.. ... . :MMMM. ?MMM. 8?. .NMM
// MMM ,..MM MMM ..MMMMMM~. ZMM..MMMMMM~ ,MMMM~ .M. MMMM. $N MMM
// .MMD.D...M MMMM~. MM..+MMMMMM7 .. NMM , . .8 . MMM ....DMMMMM, ,.. NMM.
// MMN..8M.. .~MMMMMD..MMD. ..MMMMMMM~. . MMMMM, .MMMMMMMMN ZMM
// 7MMM. .. . MM.MMMMMMMO. . ?MMMMMMMMMN= ..... .:MMMMMM= MMMM MM
// .MMM.. ,MM...+MMMMMM~. MM ..+MMMMMMMMMMMMMMMMMMMMM . MM NMMM. .=M,
// .OMM.. .MN. DMMMMMMMMMM+.MM MO. ...MM... MM7 .MM.MMMM. MM.
// ..MM. .MM...MM..:MMMMMMMMM~... MO. MM .MM. OMMMMMMM. MM.
// +MM MMMMN.. . 7MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM. .MM.
// MMM. ,MMM . MNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMD MM.
// .MM8 8MM8. .,MM .7MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM .MM.
// .MMN. IMMN . .MM MM.NMMMMMMMMMMMMMMMMMMMMMMM.MM. .DM.
// .~MM =MMN=.MM MM .MM?...IMM..:MM MM MMD. +M=
// MMM ,: ..MMMMM. .MM .MI. MM. MM. OMMMM. ..M8
// =MMO..?N.. MM. .NMMMMMI . . MM .DM.. .MM..MMDMMMMM, MM
// MMMM. .$M....N?.. .=MMMMMMMMMMMM8MMMMMM8MMMMMMMMMMM$ MM
// .=MMMM.. :M:. =M: . .. .. ,?ZDNMMMMMMMD$+..... . MM.
// ..,MMM7. .DM.. .OM: . ~8 .. MM.
// MMMMM .. IM.. DM~.... . =~ . MM.
// DMMMMM. ..=M?........,:?IZNMMMMNNDDNMM+.. . MZ MM.
// . ?MMMM,. ...~MM+ . .M.. NM
// ..=MMMM . . .... .:I8DMMMMMMMMMM.. MM
// ..+MMMM .MM7
// .,MMMMMMMN... ..MM..
// .. .IMMMMMMM? MMMM
// ...OMMMMMMM7 . =MMMMM$...
// .ZMMMMMMMMMMMMMMM?.
//
//
//
// MMM: MMM. MMMMM8.
// MMM: MMM. ,MMMMMMMM
// MMMDMMM+ MMM:MMM..MMMMMM MMM:MMMM. MMM. ?MMMMMO. MMM8MMM8 MMMM .,?N:.7MMM.
// MMMMNMMMZ MMMMMM IMMMINMMM..MMMMMMMMN MMM..MMMI ,MMM MMMMMMMMMMMMMM MMMM
// MMM .MMM MMMM MMM. MMMM.MMM: MMM MMM. MMMMMMMMM .MMM MMM: MMM .MMM
// MMM .IMMM.MMMM MMM: MMMO.MMM8..MMM. MMM. MMM. .. .MMM MMM MMM .....
// MMMMMMMM. MMMM .MMMMMMMM. MMMMMMMMM. MMM..+MMMMMMMM MMM MMM MMM .MMM.
// MMM.$M? ?==?. ..$MN~.. ===,:MN === .,NMM: === === === .===.
// MMM
// .III

// reminder : VST allows for sampleFrames to be different every block

// this will only work if you have two in's and two out's!!
Expand All @@ -172,38 +220,36 @@ void CDelayExample::processReplacing(float **inputs, float **outputs, long sampl
}
}



///////////////////////////////////////////////////////////////////////////////////////////
// some more advanced VST features you should really use!
///////////////////////////////////////////////////////////////////////////////////////////

//-----------------------------------------------------------------------------------------
bool CDelayExample::getEffectName (char* name)
bool CDelayExample::getEffectName(char* name)
{
// TODO: return the real name of your plugin
strcpy (name, "Anechoic Room Simulator");
return true;
}

//-----------------------------------------------------------------------------------------
bool CDelayExample::getVendorString (char* text)
bool CDelayExample::getVendorString(char* text)
{
// TODO: return the real name of your company
strcpy (text, "Bram @ Smartelectronix");
return true;
}

//-----------------------------------------------------------------------------------------
bool CDelayExample::getProductString (char* text)
bool CDelayExample::getProductString(char* text)
{
// TODO: return the real name of your product
strcpy (text, "Anechoic Room Simulator");
return true;
}

//-----------------------------------------------------------------------------------------
long CDelayExample::canDo(char* text)
VstInt32 CDelayExample::canDo(char* text)
{
// set the capabilities of your plugin
if (!strcmp (text, "receiveVstEvents")) return 0;
Expand Down Expand Up @@ -246,7 +292,7 @@ void CDelayExample::setSampleRate(float sampleRate)

}

void CDelayExample::setBlockSize (long blockSize)
void CDelayExample::setBlockSize(VstInt32 blockSize)
{
// allways call this
AudioEffect::setBlockSize(blockSize);
Expand Down
3 changes: 0 additions & 3 deletions AnechoicRoomSimulator/DelayExample.def

This file was deleted.

Loading

0 comments on commit 580e5d5

Please sign in to comment.