-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIPlugGen.cpp
More file actions
49 lines (37 loc) · 1.02 KB
/
IPlugGen.cpp
File metadata and controls
49 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "IPlugGen.h"
#include "IPlug_include_in_plug_src.h"
#include "IControl.h"
#include "resource.h"
const int kNumPrograms = 1;
IPlugGen::IPlugGen(IPlugInstanceInfo instanceInfo)
: IPLUG_CTOR(num_params(), kNumPrograms, instanceInfo)
{
TRACE;
gen = (CommonState *)create(44100., DEFAULT_BLOCK_SIZE);
for (int i = 0; i< num_params(); i++) {
ParamInfo* p = gen->params+i;
GetParam(i)->InitDouble(p->name, p->defaultvalue, p->outputmin, p->outputmax, 0.00001 /*step*/, p->units);
}
MakeDefaultPreset((char *) "-", kNumPrograms);
}
IPlugGen::~IPlugGen()
{
destroy(gen);
}
void IPlugGen::ProcessDoubleReplacing(double** inputs, double** outputs, int nFrames)
{
// Mutex is already locked for us.
perform(gen, inputs, num_inputs(), outputs, num_outputs(), nFrames);
}
void IPlugGen::Reset()
{
TRACE;
IMutexLock lock(this);
gen->sr = GetSampleRate();
reset(gen);
}
void IPlugGen::OnParamChange(int paramIdx)
{
IMutexLock lock(this);
setparameter(gen, paramIdx, GetParam(paramIdx)->Value(), 0);
}