[IPLUG] updated Examples.rtf with new Xcode5 info
[wdl/wdl-ol.git] / IPlugExamples / IPlugMultiChannel / IPlugMultiChannel.cpp
blob6f4d3f1f4af336ec299197068df2928aa5ebd312
1 #include "IPlugMultiChannel.h"
2 #include "IPlug_include_in_plug_src.h"
3 #include "IControl.h"
4 #include "resource.h"
5 #include "IAutoGUI.h"
7 const int kNumPrograms = 1;
9 enum EParams
11 kGain = 0,
12 kNumParams
15 IPlugMultiChannel::IPlugMultiChannel(IPlugInstanceInfo instanceInfo)
16 : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGain(1.)
18 TRACE;
20 //arguments are: name, defaultVal, minVal, maxVal, step, label
21 GetParam(kGain)->InitDouble("Gain", 50., 0., 100.0, 0.01, "%");
22 GetParam(kGain)->SetShape(2.);
24 IGraphics* pGraphics = MakeGraphics(this, GUI_WIDTH, GUI_HEIGHT);
25 IText textProps(12, &COLOR_BLACK, "Verdana", IText::kStyleNormal, IText::kAlignNear, 0, IText::kQualityNonAntiAliased);
26 GenerateKnobGUI(pGraphics, this, &textProps, &COLOR_WHITE, &COLOR_BLACK, 60, 70);
27 AttachGraphics(pGraphics);
29 MakeDefaultPreset((char *) "-", kNumPrograms);
32 IPlugMultiChannel::~IPlugMultiChannel() {}
34 void IPlugMultiChannel::ProcessDoubleReplacing(double** inputs, double** outputs, int nFrames)
36 // Mutex is already locked for us.
38 // bool in1ic = IsInChannelConnected(0);
39 // bool in2ic = IsInChannelConnected(1);
40 // bool in3ic = IsInChannelConnected(2);
41 // bool in4ic = IsInChannelConnected(3);
42 //
43 // DBGMSG("%i %i %i %i, ------------------------- \n", in1ic, in2ic, in3ic, in4ic);
45 double* in1 = inputs[0];
46 double* in2 = inputs[1];
47 double* in3 = inputs[2];
48 double* in4 = inputs[3];
50 double* out1 = outputs[0];
51 double* out2 = outputs[1];
52 double* out3 = outputs[2];
53 double* out4 = outputs[3];
55 for (int s=0; s<nFrames; s++)
57 out1[s] = in1[s] * mGain;
58 out2[s] = in2[s] * mGain;
59 out3[s] = in3[s] * mGain;
60 out4[s] = in4[s] * mGain;
64 void IPlugMultiChannel::Reset()
66 TRACE;
67 IMutexLock lock(this);
70 void IPlugMultiChannel::OnParamChange(int paramIdx)
72 IMutexLock lock(this);
74 switch (paramIdx)
76 case kGain:
77 mGain = GetParam(kGain)->Value() / 100.;;
78 break;
80 default:
81 break;