pylorca
08-18-2010, 08:34 PM
Hi,
I'm starting with wdl and iplug... thanks for this lib, it is amazing.
Two questions:
I'm getting bad sound (like drops, and crackles) when I use more than one instance of my plugin on reaper, but it sounds good when I use a single instance.
The reaper "performance meter" says 0.35% cpu when the music is playing, but when the music stops it says 2.4% cpu (This value remains until you press play again)
any comments would be appreciated, Thanks!
#include "PyEQ.h"
#include "../IPlug_include_in_plug_src.h"
#include "../IControl.h"
#include "resource.h"
#include "PulEQ.h"
#include <math.h>
const int kNumPrograms = 1;
PulEQ pul_l = PulEQ(44100, 0, 0, 1, 0, 1, 0, 0, 1);
PulEQ pul_r = PulEQ(44100, 0, 0, 1, 0, 1, 0, 0, 1);
enum EParams {
kLowFreq,
kLowBoost,
kLowAtten,
kMidGain,
kMidFreq,
kMidWidth,
kHiGain,
kNumParams,
};
enum ELowFreq {
k20 = 0,
k30,
k60,
k100,
kNumLowFreq
};
enum ELayout
{
kW = 627,
kH = 233,
kLowFreq_X = 82,
kLowFreq_Y = 140,
kLowBoost_X = 28,
kLowBoost_Y = 28,
kLowAtten_X = 126,
kLowAtten_Y = 28,
kMidGain_X = 256,
kMidGain_Y = 28,
kMidFreq_X = 262,
kMidFreq_Y = 138,
kHiGain_X = 390,
kHiGain_Y = 10,
};
void PyEQ::OnParamChange(int paramIdx)
{
double lowBoost = GetParam(kLowBoost)->Value();
double lowAtten = GetParam(kLowAtten)->Value();
int lowFreq = (int)GetParam(kLowFreq)->Value();
double midGain = GetParam(kMidGain)->Value();
double midFreq = GetParam(kMidFreq)->Value();
double hiGain = GetParam(kHiGain)->Value();
pul_l.setLowShelv(lowBoost, -lowAtten, lowFreq);
pul_r.setLowShelv(lowBoost, -lowAtten, lowFreq);
pul_l.setMid(midGain, midFreq, 1);
pul_r.setMid(midGain, midFreq, 1);
pul_l.setHiShelv(hiGain, 2);
pul_r.setHiShelv(hiGain, 2);
}
PyEQ::PyEQ(IPlugInstanceInfo instanceInfo)
: IPLUG_CTOR(kNumParams, 6, instanceInfo), prevL(0.0), prevR(0.0)
{
TRACE;
// Define parameter ranges, display units, labels.
GetParam(kLowBoost)->InitDouble("boost low", 0.0, 0.0, 16.0, 0.1, "dB");
GetParam(kLowAtten)->InitDouble("Atten low", 0.0, 0.0, 22.0, 1.3*0.15, "dB");
GetParam(kMidGain)->InitDouble("Mid Gain", 0.0, -12.0, 12.0, 0.1, "dB");
GetParam(kMidFreq)->InitDouble("Mid Freq", 2110, 150, 4000, 10, "dB");
GetParam(kHiGain)->InitDouble("Hi Gain", 0.0, -10.0, 10.0, 0.01, "dB");
GetParam(kLowFreq)->InitEnum("Low Freq", 1, kNumLowFreq); // Params can be enums.
MakePreset("preset 1", -5.0, 5.0, 17, 1);
MakePreset("preset 2", -15.0, 25.0, 37,1);
MakeDefaultPreset("-", 4);
// Instantiate a graphics engine.
IGraphics* pGraphics = MakeGraphics(this, kW, kH); // MakeGraphics(this, kW, kH);
pGraphics->AttachBackground(BG_ID, BG_FN);
// Attach a rotating knob associated with the Pan parameter.
IBitmap bitmap = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, 71);
pGraphics->AttachControl(new IKnobMultiControl(this, kLowBoost_X, kLowBoost_Y, kLowBoost, &bitmap));
pGraphics->AttachControl(new IKnobMultiControl(this, kLowAtten_X, kLowAtten_Y, kLowAtten, &bitmap));
pGraphics->AttachControl(new IKnobMultiControl(this, kHiGain_X, kHiGain_Y , kHiGain, &bitmap));
pGraphics->AttachControl(new IKnobMultiControl(this, kMidGain_X, kMidGain_Y , kMidGain, &bitmap));
bitmap = pGraphics->LoadIBitmap(KNOB_MID_FREQ_ID, KNOB_MID_FREQ_FN, 35);
pGraphics->AttachControl(new IKnobMultiControl(this, kMidFreq_X, kMidFreq_Y , kMidFreq, &bitmap));
bitmap = pGraphics->LoadIBitmap(KNOB_SELECTOR_X4_ID, KNOB_SELECTOR_X4_FN, kNumLowFreq);
pGraphics->AttachControl(new IKnobMultiControl(this, kLowFreq_X, kLowFreq_Y , kLowFreq, &bitmap));
// Attach the graphics engine to the plugin.
AttachGraphics(pGraphics);
// No cleanup necessary, the graphics engine manages all of its resources and cleans up when closed.
}
void PyEQ::ProcessDoubleReplacing(double** inputs, double** outputs, int nFrames)
{
// Mutex is already locked for us.
double* in1 = inputs[0];
double* in2 = inputs[1];
double* out1 = outputs[0];
double* out2 = outputs[1];
for (int s = 0; s < nFrames; ++s, ++in1, ++in2, ++out1, ++out2) {
pul_l.process(in1);
pul_r.process(in2);
*out1 = *in1;
*out2 = *in2;
}
}
I'm starting with wdl and iplug... thanks for this lib, it is amazing.
Two questions:
I'm getting bad sound (like drops, and crackles) when I use more than one instance of my plugin on reaper, but it sounds good when I use a single instance.
The reaper "performance meter" says 0.35% cpu when the music is playing, but when the music stops it says 2.4% cpu (This value remains until you press play again)
any comments would be appreciated, Thanks!
#include "PyEQ.h"
#include "../IPlug_include_in_plug_src.h"
#include "../IControl.h"
#include "resource.h"
#include "PulEQ.h"
#include <math.h>
const int kNumPrograms = 1;
PulEQ pul_l = PulEQ(44100, 0, 0, 1, 0, 1, 0, 0, 1);
PulEQ pul_r = PulEQ(44100, 0, 0, 1, 0, 1, 0, 0, 1);
enum EParams {
kLowFreq,
kLowBoost,
kLowAtten,
kMidGain,
kMidFreq,
kMidWidth,
kHiGain,
kNumParams,
};
enum ELowFreq {
k20 = 0,
k30,
k60,
k100,
kNumLowFreq
};
enum ELayout
{
kW = 627,
kH = 233,
kLowFreq_X = 82,
kLowFreq_Y = 140,
kLowBoost_X = 28,
kLowBoost_Y = 28,
kLowAtten_X = 126,
kLowAtten_Y = 28,
kMidGain_X = 256,
kMidGain_Y = 28,
kMidFreq_X = 262,
kMidFreq_Y = 138,
kHiGain_X = 390,
kHiGain_Y = 10,
};
void PyEQ::OnParamChange(int paramIdx)
{
double lowBoost = GetParam(kLowBoost)->Value();
double lowAtten = GetParam(kLowAtten)->Value();
int lowFreq = (int)GetParam(kLowFreq)->Value();
double midGain = GetParam(kMidGain)->Value();
double midFreq = GetParam(kMidFreq)->Value();
double hiGain = GetParam(kHiGain)->Value();
pul_l.setLowShelv(lowBoost, -lowAtten, lowFreq);
pul_r.setLowShelv(lowBoost, -lowAtten, lowFreq);
pul_l.setMid(midGain, midFreq, 1);
pul_r.setMid(midGain, midFreq, 1);
pul_l.setHiShelv(hiGain, 2);
pul_r.setHiShelv(hiGain, 2);
}
PyEQ::PyEQ(IPlugInstanceInfo instanceInfo)
: IPLUG_CTOR(kNumParams, 6, instanceInfo), prevL(0.0), prevR(0.0)
{
TRACE;
// Define parameter ranges, display units, labels.
GetParam(kLowBoost)->InitDouble("boost low", 0.0, 0.0, 16.0, 0.1, "dB");
GetParam(kLowAtten)->InitDouble("Atten low", 0.0, 0.0, 22.0, 1.3*0.15, "dB");
GetParam(kMidGain)->InitDouble("Mid Gain", 0.0, -12.0, 12.0, 0.1, "dB");
GetParam(kMidFreq)->InitDouble("Mid Freq", 2110, 150, 4000, 10, "dB");
GetParam(kHiGain)->InitDouble("Hi Gain", 0.0, -10.0, 10.0, 0.01, "dB");
GetParam(kLowFreq)->InitEnum("Low Freq", 1, kNumLowFreq); // Params can be enums.
MakePreset("preset 1", -5.0, 5.0, 17, 1);
MakePreset("preset 2", -15.0, 25.0, 37,1);
MakeDefaultPreset("-", 4);
// Instantiate a graphics engine.
IGraphics* pGraphics = MakeGraphics(this, kW, kH); // MakeGraphics(this, kW, kH);
pGraphics->AttachBackground(BG_ID, BG_FN);
// Attach a rotating knob associated with the Pan parameter.
IBitmap bitmap = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, 71);
pGraphics->AttachControl(new IKnobMultiControl(this, kLowBoost_X, kLowBoost_Y, kLowBoost, &bitmap));
pGraphics->AttachControl(new IKnobMultiControl(this, kLowAtten_X, kLowAtten_Y, kLowAtten, &bitmap));
pGraphics->AttachControl(new IKnobMultiControl(this, kHiGain_X, kHiGain_Y , kHiGain, &bitmap));
pGraphics->AttachControl(new IKnobMultiControl(this, kMidGain_X, kMidGain_Y , kMidGain, &bitmap));
bitmap = pGraphics->LoadIBitmap(KNOB_MID_FREQ_ID, KNOB_MID_FREQ_FN, 35);
pGraphics->AttachControl(new IKnobMultiControl(this, kMidFreq_X, kMidFreq_Y , kMidFreq, &bitmap));
bitmap = pGraphics->LoadIBitmap(KNOB_SELECTOR_X4_ID, KNOB_SELECTOR_X4_FN, kNumLowFreq);
pGraphics->AttachControl(new IKnobMultiControl(this, kLowFreq_X, kLowFreq_Y , kLowFreq, &bitmap));
// Attach the graphics engine to the plugin.
AttachGraphics(pGraphics);
// No cleanup necessary, the graphics engine manages all of its resources and cleans up when closed.
}
void PyEQ::ProcessDoubleReplacing(double** inputs, double** outputs, int nFrames)
{
// Mutex is already locked for us.
double* in1 = inputs[0];
double* in2 = inputs[1];
double* out1 = outputs[0];
double* out2 = outputs[1];
for (int s = 0; s < nFrames; ++s, ++in1, ++in2, ++out1, ++out2) {
pul_l.process(in1);
pul_r.process(in2);
*out1 = *in1;
*out2 = *in2;
}
}