IPlugEffect::IPlugEffect(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumPublicParams, kNumPrivateParams, kNumPrograms, instanceInfo) { TRACE; //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kGain)->InitDouble("Gain", 50., 0., 100.0, 0.01, "%"); GetParam(kGain)->SetShape(2.); IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); pGraphics->AttachPanelBackground(&COLOR_GRAY); IBitmap* knob = pGraphics->LoadPointerToBitmap(KNOB_ID, KNOB_FN, kKnobFrames); pGraphics->AttachControl(new IKnobMultiControl(this, kGainX, kGainY, kGain, knob)); IColor textColor = IColor(255, 0, 0, 0); IText textProps4(24, &textColor, "Arial", IText::kStyleNormal, IText::kAlignCenter, 0, IText::kQualityDefault); pGraphics->AttachControl(new ITextControl(this, DRAW_RECT(80, 44, 220, 84), &textProps4, "Hello IPlug!")); AttachGraphics(pGraphics); //MakePreset("preset 1", ... ); MakeDefaultPreset((char *) "-", kNumPrograms); }
ParameterTypes::ParameterTypes(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGain(1.) { // add a floating point, continuous parameter, // name, default, min, max, step, unit label GetParam(kGain)->InitDouble("Gain", 50., 0., 100.0, 0.01, "%"); // add an enumerated list, discrete parameter, // name, default, numitems GetParam(kMode)->InitEnum("Mode", 0, 4); GetParam(kMode)->SetDisplayText(0, "a"); // set display text for first item to "a" GetParam(kMode)->SetDisplayText(1, "b"); // ... GetParam(kMode)->SetDisplayText(2, "c"); // ... GetParam(kMode)->SetDisplayText(3, "d"); // ... // add a boolean, discreet parameter, // name, default, GetParam(kEnable)->InitBool("Enable", 0); // add an integer, discreet parameter, // name, default, min, max, unit label GetParam(kCount)->InitInt("Count", 50, 0, 100, "%"); // create factory presets MakeDefaultPreset((char *) "-", kNumPrograms); }
Zstort::Zstort(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGain(1.) { TRACE; //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kGain)->InitDouble("Gain", 8., 0., 100.0, 0.01, "%"); GetParam(kGain)->SetShape(2.); GetParam(kTremDepth)->InitDouble("TremDepth", 100., 0., 100.0, 0.01, "%"); GetParam(kTremDepth)->SetShape(2.); GetParam(kTremFreq)->InitDouble("TremFreq", 4., 0.01, 15, 0.01, "hz"); //GetParam(kTremFreq)->SetShape(2.); GetParam(kDist)->InitDouble("Distortion", 100., 0.1, 100., 0.01, "%"); GetParam(kDist)->SetShape(2.); GetParam(kBits)->InitInt("BitRate", 32, 1, 32, "bits"); GetParam(kRate)->InitInt("RateReduction", 1, 1, 32, "x"); IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); pGraphics->AttachPanelBackground(&COLOR_BLACK); IRECT distRect(kDistX, kDistY - 5, 200, 80.); IText textProps3(14, &COLOR_RED, "Arial", IText::kStyleItalic, IText::kAlignNear, 0, IText::kQualityDefault); pGraphics->AttachControl(new ITextControl(this, IRECT(kDistX, kDistY -25, 200, 80), &textProps3, "Distortion")); pGraphics->AttachControl(new ITextControl(this, IRECT(kGainX, kGainY - 25, 200, 80), &textProps3, "Gain")); pGraphics->AttachControl(new ITextControl(this, IRECT(kTremDepthX, kTremDepthY - 25, 200, 80), &textProps3, "Tremolo Depth")); pGraphics->AttachControl(new ITextControl(this, IRECT(kTremFreqX, kTremFreqY - 25, 200, 80), &textProps3, "Tremolo\nFrequency")); pGraphics->AttachControl(new ITextControl(this, IRECT(kRateX, kRateY - 25, 200, 80), &textProps3, "Sample Rate\nReduction")); pGraphics->AttachControl(new ITextControl(this, IRECT(kBitsX, kBitsY - 25, 200, 80), &textProps3, "BitCrusher")); //attempt at updating values live -can't seem to redraw distIdx = pGraphics->AttachControl(new ITextControl(this, IRECT(200, 300, 200, 80), &textProps3, "Distortion: xx!")); IBitmap knob = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, kKnobFrames); pGraphics->AttachControl(new IKnobMultiControl(this, kGainX, kGainY, kGain, &knob)); pGraphics->AttachControl(new IKnobMultiControl(this, kTremDepthX, kTremDepthY, kTremDepth, &knob)); pGraphics->AttachControl(new IKnobMultiControl(this, kTremFreqX, kTremFreqY, kTremFreq, &knob)); pGraphics->AttachControl(new IKnobMultiControl(this, kDistX, kDistY, kDist, &knob)); pGraphics->AttachControl(new IKnobMultiControl(this, kBitsX, kBitsY, kBits, &knob)); pGraphics->AttachControl(new IKnobMultiControl(this, kRateX, kRateY, kRate, &knob)); AttachGraphics(pGraphics); //MakePreset("preset 1", ... ); MakeDefaultPreset((char *) "-", kNumPrograms); this->distortion = new DistortionProcessor(1.); this->bitCrusher = new BitCrushProcessor(32); this->rateReducer = new SampleRateReductionProcessor(1); this->trem = new TremoloProcessor(4., 1, 2, GetSampleRate()); }
IPlugText::IPlugText(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGain(1.) { TRACE; //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kGain)->InitDouble("Gain", 50., 0., 100.0, 0.01, "%"); GetParam(kGain)->SetShape(2.); IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); pGraphics->AttachPanelBackground(&COLOR_GRAY); IRECT tmpRect(10, 10, 200, 30); IText textProps(12, &COLOR_BLACK, "Arial", IText::kStyleNormal, IText::kAlignCenter, 0, IText::kQualityDefault); pGraphics->AttachControl(new ITextControl(this, tmpRect, &textProps, "hello iplug!")); IRECT tmpRect2(30, 30, 200, 60); IText textProps2(18, &COLOR_WHITE, "Tahoma", IText::kStyleNormal, IText::kAlignCenter, 0, IText::kQualityDefault); pGraphics->AttachControl(new ITextControl(this, tmpRect2, &textProps2, "hello iplug!")); IRECT tmpRect3(80, 50, 200, 80.); IText textProps3(24, &COLOR_RED, "Arial", IText::kStyleItalic, IText::kAlignFar, 0, IText::kQualityDefault); pGraphics->AttachControl(new ITextControl(this, tmpRect3, &textProps3, "hello iplug!")); IRECT tmpRect4(120, 60, 300, 120); IText textProps4(40, &COLOR_ORANGE, "Arial", IText::kStyleNormal, IText::kAlignCenter, 0, IText::kQualityDefault); pGraphics->AttachControl(new ITextControl(this, tmpRect4, &textProps4, "hello iplug!")); IRECT tmpRect5(10, 100, 400, 170); IText textProps5(50, &COLOR_BLUE, "Courier", IText::kStyleNormal, IText::kAlignCenter, 0, IText::kQualityDefault); pGraphics->MeasureIText(&textProps5, "hello iplug!", &tmpRect5); // get the bounds of the text and stick them in tmpRect5 pGraphics->AttachControl( new IPanelControl(this, tmpRect5, &COLOR_WHITE)); tmpRect5 = IRECT(10, 100, 400, 170); pGraphics->AttachControl(new ITextControl(this, tmpRect5, &textProps5, "hello iplug!")); DBGMSG("text bounds = %i, %i, %i, %i\n", tmpRect5.L, tmpRect5.T, tmpRect5.R, tmpRect5.B); IBitmap blackText = pGraphics->LoadIBitmap(TEXT_BLACK_ID, TEXT_BLACK_FN, 95, true); IBitmap whiteText = pGraphics->LoadIBitmap(TEXT_WHITE_ID, TEXT_WHITE_FN, 95, true); IRECT tmpRect6(10, 250, 400, 170); pGraphics->AttachControl(new IBitmapTextControl(this, tmpRect6, &blackText, "i'm bitmap monospace text")); IRECT tmpRect7(10, 280, 400, 170); pGraphics->AttachControl(new IBitmapTextControl(this, tmpRect7, &whiteText, "i'm also bitmap monospace text")); AttachGraphics(pGraphics); //MakePreset("preset 1", ... ); MakeDefaultPreset((char *) "-", kNumPrograms); }
IPlugOpenGL::IPlugOpenGL(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGain(1.) { TRACE; //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kGain)->InitDouble("Gain", 50., 0., 100.0, 0.01, "%"); GetParam(kGain)->SetShape(2.); IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight, 30); pGraphics->AttachPanelBackground(&COLOR_BLACK); #ifdef OS_OSX pGraphics->AttachControl(new IOpenGLTestControl(this, IRECT(10, 10, GUI_WIDTH-10, GUI_HEIGHT-10))); #endif AttachGraphics(pGraphics); //MakePreset("preset 1", ... ); MakeDefaultPreset((char *) "-", kNumPrograms); }
IPlugSideChain::IPlugSideChain(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGain(1.) , mPrevL(0.0) , mPrevR(0.0) , mPrevLS(0.0) , mPrevRS(0.0) { TRACE; //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kGain)->InitDouble("Gain", 50., 0., 100.0, 0.01, "%"); GetParam(kGain)->SetShape(2.); IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); pGraphics->AttachPanelBackground(&COLOR_RED); IBitmap knob = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, kKnobFrames); IText text = IText(14); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kGainX, kGainY, kGainX + 48, kGainY + 48 + 20), kGain, &knob, &text)); mMeterIdx_L = pGraphics->AttachControl(new IPeakMeterVert(this, MakeIRect(kMeterL))); mMeterIdx_R = pGraphics->AttachControl(new IPeakMeterVert(this, MakeIRect(kMeterR))); mMeterIdx_LS = pGraphics->AttachControl(new IPeakMeterVert(this, MakeIRect(kMeterLS))); mMeterIdx_RS = pGraphics->AttachControl(new IPeakMeterVert(this, MakeIRect(kMeterRS))); if (GetAPI() == kAPIVST2) // for VST2 we name individual outputs { SetInputLabel(0, "main input L"); SetInputLabel(1, "main input R"); SetInputLabel(2, "sc input L"); SetInputLabel(3, "sc input R"); SetOutputLabel(0, "output L"); SetOutputLabel(1, "output R"); } else // for AU and VST3 we name buses { SetInputBusLabel(0, "main input"); SetInputBusLabel(1, "sc input"); SetOutputBusLabel(0, "output"); } AttachGraphics(pGraphics); //MakePreset("preset 1", ... ); MakeDefaultPreset((char *) "-", kNumPrograms); }
IPlugEffectGUILiveEdit::IPlugEffectGUILiveEdit(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumPublicParams, kNumPrivateParams, kNumPrograms, instanceInfo) { TRACE; //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kGain)->InitDouble("Gain", 50., 0., 100.0, 0.01, "%"); GetParam(kGain)->SetShape(2.); IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); // Here we are attaching our GUI resize control ------------------------------------------------------------------------------ // It is important to create on top of all controls! AttachGUIResize(new IPlugGUIResize(this, pGraphics, true, 16, 16)); // --------------------------------------------------------------------------------------------------------------------------- pGraphics->AttachPanelBackground(&COLOR_GRAY); // Start Live GUI edit GUI_EDIT_START; NEW_LAYER; IRECT knobPosition = DRAW_RECT(80, 110, 128, 158); IBitmap* knob = pGraphics->LoadPointerToBitmap(KNOB_ID, KNOB_FN, kKnobFrames); pGraphics->AttachControl(new IKnobMultiControl(this, knobPosition.L, knobPosition.T, kGain, knob)); END; NEW_LAYER; IColor textColor = IColor(255, 0, 0, 0); IText textProps(24, &textColor, "Arial", IText::kStyleNormal, IText::kAlignCenter, 0, IText::kQualityDefault); pGraphics->AttachControl(new ITextControl(this, DRAW_RECT(50, 20, 190, 60), &textProps, "Hello IPlug!")); END; // End Live GUI edit GUI_EDIT_FINISH; // Attach GUI live edit control. Use __FILE__ macro to get source file path. You can remove it after you edit your GUI. pGraphics->AttachControl(new IPlugGUILiveEdit(this, __FILE__, 10)); AttachGraphics(pGraphics); //MakePreset("preset 1", ... ); MakeDefaultPreset((char *) "-", kNumPrograms); }
MostBasicGUI::MostBasicGUI(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGain(1.) { // add a parameter with type, name, default, min, max, step, unit label GetParam(kGain)->InitDouble("Gain", 50., 0., 100.0, 0.01, "%"); // create graphics context IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); // add a coloured background pGraphics->AttachPanelBackground(&COLOR_RED); // add a PNG image-based knob control, link to parameter and position on gui IBitmap knob = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, kKnobFrames); pGraphics->AttachControl(new IKnobMultiControl(this, kGainX, kGainY, kGain, &knob)); // attach graphics context AttachGraphics(pGraphics); // create factory presets MakeDefaultPreset((char *) "-", kNumPrograms); }
Saturator::Saturator(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mDC(0.2), mDrive(1.) { TRACE; mDistortedDC = (1/ mCharacter) * fastAtan(mDC * mCharacter); //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kDrive)->InitDouble("Drive", 0.0, 0.0, 20.0, 0.01, "dB"); GetParam(kDrive)->SetShape(1.0); GetParam(kMix)->InitDouble("Mix", 100.0, 0.0, 100.0, 0.01, "%"); GetParam(kMix)->SetShape(1.0); GetParam(kClipLevel)->InitDouble("Clip Level", 0, -18.0, 0.0, 0.01, "dB"); GetParam(kClipLevel)->SetShape(1.0); // GetParam(kLowCut)->InitDouble("Low Cut", 0.99, 0.01, 0.99, 0.001, "HZ"); // GetParam(kLowCut)->SetShape(2); // GetParam(kHiCut)->InitDouble("High Cut", 0.99, 0.01, 0.99, 0.001, "HZ"); // GetParam(kHiCut)->SetShape(2); GetParam(kCharacter)->InitDouble("Character", 5.0, 1.0, 10.0, 0.01, "%"); GetParam(kCharacter)->SetShape(1.0); //MakePreset("preset 1", ... ); MakeDefaultPreset((char *) "-", kNumPrograms); }
IPlugEEL::IPlugEEL(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGain(1.) { TRACE; vm = NSEEL_VM_alloc(); // create virtual machine mVmOutput = NSEEL_VM_regvar(vm, "x"); // register a variable into vm to get a value out memset(codetext, 0, 65536); strcpy(codetext, "x=rand(2)-1.;"); codehandle = NSEEL_code_compile(vm, codetext, 0); // compile code //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kGain)->InitDouble("Gain", 50., 0., 100.0, 0.01, "%"); GetParam(kGain)->SetShape(2.); IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); pGraphics->AttachPanelBackground(&COLOR_RED); IBitmap knob = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, kKnobFrames); pGraphics->AttachControl(new IKnobMultiControl(this, kGainX, kGainY, kGain, &knob)); IRECT textRect(5, 70, kWidth-5, kHeight-5); IText textProps(15, &COLOR_BLACK, "Arial", IText::kStyleNormal, IText::kAlignNear, 0, IText::kQualityDefault); mTextControl = new AlgDisplay(this, textRect, &textProps, codetext); pGraphics->AttachControl(mTextControl); AttachGraphics(pGraphics); //MakePreset("preset 1", ... ); MakeDefaultPreset((char *) "-", kNumPrograms); }
ATKStereoCompressor::ATKStereoCompressor(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), inLFilter(NULL, 1, 0, false), inRFilter(NULL, 1, 0, false), volumesplitFilter(2), applyGainFilter(2), volumemergeFilter(2), drywetFilter(2), outLFilter(NULL, 1, 0, false), outRFilter(NULL, 1, 0, false) { TRACE; //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kMiddleside)->InitBool("Middle/Side processing", 0, ""); GetParam(kLinkChannels)->InitBool("Link channels", 0, ""); GetParam(kActivateChannel1)->InitBool("Enable Channel 1", 1, ""); GetParam(kActivateChannel2)->InitBool("Enable Channel 2", 1, ""); GetParam(kAttack1)->InitDouble("Attack ch1", 10., 1., 100.0, 0.1, "ms"); GetParam(kAttack1)->SetShape(2.); GetParam(kRelease1)->InitDouble("Release ch1", 10, 1., 100.0, 0.1, "ms"); GetParam(kRelease1)->SetShape(2.); GetParam(kThreshold1)->InitDouble("Threshold ch1", 0., -40., 0.0, 0.1, "dB"); // threshold is actually power GetParam(kThreshold1)->SetShape(2.); GetParam(kRatio1)->InitDouble("Ratio ch1", 2., 1, 100, 1, "-"); GetParam(kRatio1)->SetShape(2.); GetParam(kSoftness1)->InitDouble("Softness ch1", -2, -4, 0, 0.1, "-"); GetParam(kSoftness1)->SetShape(2.); GetParam(kMakeup1)->InitDouble("Makeup Gain ch1", 0, 0, 40, 0.1, "-"); // Makeup is expressed in amplitude GetParam(kMakeup1)->SetShape(2.); GetParam(kAttack2)->InitDouble("Attack ch2", 10., 1., 100.0, 0.1, "ms"); GetParam(kAttack2)->SetShape(2.); GetParam(kRelease2)->InitDouble("Release ch2", 10, 1., 100.0, 0.1, "ms"); GetParam(kRelease2)->SetShape(2.); GetParam(kThreshold2)->InitDouble("Threshold ch2", 0., -40., 0.0, 0.1, "dB"); // threshold is actually power GetParam(kThreshold2)->SetShape(2.); GetParam(kRatio2)->InitDouble("Ratio ch2", 2., 1, 100, 1, "-"); GetParam(kRatio2)->SetShape(2.); GetParam(kSoftness2)->InitDouble("Softness ch2", -2, -4, 0, 0.1, "-"); GetParam(kSoftness2)->SetShape(2.); GetParam(kMakeup2)->InitDouble("Makeup Gain ch2", 0, 0, 40, 0.1, "-"); // Makeup is expressed in amplitude GetParam(kMakeup2)->SetShape(2.); GetParam(kDryWet)->InitDouble("Dry/Wet", 1, 0, 1, 0.01, "-"); GetParam(kDryWet)->SetShape(1.); IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); pGraphics->AttachBackground(STEREO_COMPRESSOR_ID, STEREO_COMPRESSOR_FN); IBitmap knob = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, kKnobFrames); IBitmap knob1 = pGraphics->LoadIBitmap(KNOB1_ID, KNOB1_FN, kKnobFrames); IBitmap myswitch = pGraphics->LoadIBitmap(SWITCH_ID, SWITCH_FN, 2); IText text = IText(10, 0, 0, IText::kStyleBold); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kAttack1X, kAttack1Y, kAttack1X + 43, kAttack1Y + 43 + 21), kAttack1, &knob, &text, "ms")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kRelease1X, kRelease1Y, kRelease1X + 43, kRelease1Y + 43 + 21), kRelease1, &knob, &text, "ms")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kThreshold1X, kThreshold1Y, kThreshold1X + 43, kThreshold1Y + 43 + 21), kThreshold1, &knob, &text, "dB")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kRatio1X, kRatio1Y, kRatio1X + 43, kRatio1Y + 43 + 21), kRatio1, &knob, &text, "")); pGraphics->AttachControl(new IKnobMultiControl(this, kSoftness1X, kSoftness1Y, kSoftness1, &knob)); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kMakeup1X, kMakeup1Y, kMakeup1X + 43, kMakeup1Y + 43 + 21), kMakeup1, &knob, &text, "dB")); attack2 = new IKnobMultiControlText(this, IRECT(kAttack2X, kAttack2Y, kAttack2X + 43, kAttack2Y + 43 + 21), kAttack2, &knob, &text, "ms"); pGraphics->AttachControl(attack2); release2 = new IKnobMultiControlText(this, IRECT(kRelease2X, kRelease2Y, kRelease2X + 43, kRelease2Y + 43 + 21), kRelease2, &knob, &text, "ms"); pGraphics->AttachControl(release2); threshold2 = new IKnobMultiControlText(this, IRECT(kThreshold2X, kThreshold2Y, kThreshold2X + 43, kThreshold2Y + 43 + 21), kThreshold2, &knob, &text, "dB"); pGraphics->AttachControl(threshold2); ratio2 = new IKnobMultiControlText(this, IRECT(kRatio2X, kRatio2Y, kRatio2X + 43, kRatio2Y + 43 + 21), kRatio2, &knob, &text, ""); pGraphics->AttachControl(ratio2); softness2 = new IKnobMultiControl(this, kSoftness2X, kSoftness2Y, kSoftness2, &knob); pGraphics->AttachControl(softness2); makeup2 = new IKnobMultiControlText(this, IRECT(kMakeup2X, kMakeup2Y, kMakeup2X + 43, kMakeup2Y + 43 + 21), kMakeup2, &knob, &text, "dB"); pGraphics->AttachControl(makeup2); pGraphics->AttachControl(new IKnobMultiControl(this, kDryWetX, kDryWetY, kDryWet, &knob1)); pGraphics->AttachControl(new ISwitchControl(this, kMiddlesideX, kMiddlesideY, kMiddleside, &myswitch)); pGraphics->AttachControl(new ISwitchControl(this, kLinkChannelsX, kLinkChannelsY, kLinkChannels, &myswitch)); pGraphics->AttachControl(new ISwitchControl(this, kActivateChannel1X, kActivateChannel1Y, kActivateChannel1, &myswitch)); pGraphics->AttachControl(new ISwitchControl(this, kActivateChannel2X, kActivateChannel2Y, kActivateChannel2, &myswitch)); AttachGraphics(pGraphics); //MakePreset("preset 1", ... ); MakeDefaultPreset((char *) "-", kNumPrograms); volumesplitFilter.set_volume(std::sqrt(.5)); volumemergeFilter.set_volume(std::sqrt(.5)); endpoint.add_filter(&outLFilter); endpoint.add_filter(&outRFilter); powerFilter1.set_input_port(0, &inLFilter, 0); gainCompressorFilter1.set_input_port(0, &powerFilter1, 0); attackReleaseFilter1.set_input_port(0, &gainCompressorFilter1, 0); applyGainFilter.set_input_port(0, &attackReleaseFilter1, 0); applyGainFilter.set_input_port(1, &inLFilter, 0); makeupFilter1.set_input_port(0, &applyGainFilter, 0); drywetFilter.set_input_port(0, &makeupFilter1, 0); drywetFilter.set_input_port(1, &inLFilter, 0); outLFilter.set_input_port(0, &drywetFilter, 0); powerFilter2.set_input_port(0, &inRFilter, 0); gainCompressorFilter2.set_input_port(0, &powerFilter2, 0); attackReleaseFilter2.set_input_port(0, &gainCompressorFilter2, 0); applyGainFilter.set_input_port(2, &attackReleaseFilter2, 0); applyGainFilter.set_input_port(3, &inRFilter, 0); makeupFilter2.set_input_port(0, &applyGainFilter, 1); drywetFilter.set_input_port(2, &makeupFilter2, 0); drywetFilter.set_input_port(3, &inRFilter, 0); outRFilter.set_input_port(0, &drywetFilter, 1); middlesidesplitFilter.set_input_port(0, &inLFilter, 0); middlesidesplitFilter.set_input_port(1, &inRFilter, 0); volumesplitFilter.set_input_port(0, &middlesidesplitFilter, 0); volumesplitFilter.set_input_port(1, &middlesidesplitFilter, 1); middlesidemergeFilter.set_input_port(0, &makeupFilter1, 0); middlesidemergeFilter.set_input_port(1, &makeupFilter2, 0); volumemergeFilter.set_input_port(0, &middlesidemergeFilter, 0); volumemergeFilter.set_input_port(1, &middlesidemergeFilter, 1); sumFilter.set_input_port(0, &powerFilter1, 0); sumFilter.set_input_port(1, &powerFilter2, 0); powerFilter1.set_memory(0); powerFilter2.set_memory(0); Reset(); }
Arponaut::Arponaut(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, 6, instanceInfo), lastPos_(0), arpIndex_(0), playing_(0) { TRACE; // Define parameter ranges, display units, labels. GetParam(kGainL)->InitDouble("Gain L", 0.0, -44.0, 12.0, 0.1, "dB"); GetParam(kGainL)->NegateDisplay(); GetParam(kGainR)->InitDouble("Gain R", 0.0, -44.0, 12.0, 0.1, "dB"); GetParam(kPan)->InitInt("Pan", 0, -100, 100, "%"); // Params can be enums. GetParam(kChannelSw)->InitEnum("Channel", kDefault, kNumChannelSwitchEnums); GetParam(kChannelSw)->SetDisplayText(kDefault, "default"); GetParam(kChannelSw)->SetDisplayText(kReversed, "reversed"); GetParam(kChannelSw)->SetDisplayText(kAllLeft, "all L"); GetParam(kChannelSw)->SetDisplayText(kAllRight, "all R"); GetParam(kChannelSw)->SetDisplayText(kOff, "mute"); GetParam(kNoteLength)->InitEnum("Note length", kWhole, kNumNoteLengths); GetParam(kNoteLength)->SetDisplayText(kWhole, "1/4"); GetParam(kNoteLength)->SetDisplayText(kHalf, "1/8"); GetParam(kNoteLength)->SetDisplayText(kTriplet, "1/8T"); GetParam(kNoteLength)->SetDisplayText(kQuarter, "1/16"); GetParam(kOctaves)->InitEnum("Octaves", kOne8ve, kNumNoteLengths); GetParam(kOctaves)->SetDisplayText(kOne8ve, "1 octave"); GetParam(kOctaves)->SetDisplayText(kTwo8ve, "2 octaves"); GetParam(kOctaves)->SetDisplayText(kThree8ve, "3 octaves"); GetParam(kOctaves)->SetDisplayText(kFour8ve, "4 octaves"); GetParam(kArpMode)->InitEnum("Arp modes", kUp, kNumArpModes); GetParam(kArpMode)->SetDisplayText(kUp, "Up"); GetParam(kArpMode)->SetDisplayText(kDown, "Down"); GetParam(kArpMode)->SetDisplayText(kUpDown, "Up/Down"); GetParam(kArpMode)->SetDisplayText(kManual, "Manual"); GetParam(kArpMode)->SetDisplayText(kRandom, "Random"); GetParam(kInsertMode)->InitEnum("Insert modes", kInsertOff, kNumInsertModes); GetParam(kInsertMode)->SetDisplayText(kInsertOff, "Off"); GetParam(kInsertMode)->SetDisplayText(kInsertLow, "Low"); GetParam(kInsertMode)->SetDisplayText(kInsertHi, "Hi"); GetParam(kInsertMode)->SetDisplayText(kInsert31, "3-1"); GetParam(kInsertMode)->SetDisplayText(kInsert42, "4-2"); MakePreset("preset 1", -5.0, 5.0, 17, kReversed); MakePreset("preset 2", -15.0, 25.0, 37, kAllRight); MakeDefaultPreset("-", 4); // Instantiate a graphics engine. IGraphics* pGraphics = MakeGraphics(this, kW, kH); // MakeGraphics(this, kW, kH); pGraphics->AttachBackground(BG_ID, BG_FN); // Attach controls to the graphics engine. Controls are automatically associated // with a parameter if you construct the control with a parameter index. // Attach a couple of meters, not associated with any parameter, // which we keep indexes for, so we can push updates from the plugin class. //IBitmap bitmap = pGraphics->LoadIBitmap(METER_ID, METER_FN, kMeter_N); //mMeterIdx_L = pGraphics->AttachControl(new IBitmapControl(this, kMeterL_X, kMeterL_Y, &bitmap)); //mMeterIdx_R = pGraphics->AttachControl(new IBitmapControl(this, kMeterR_X, kMeterR_Y, &bitmap)); // Attach a couple of faders, associated with the parameters GainL and GainR. //bitmap = pGraphics->LoadIBitmap(FADER_ID, FADER_FN); //pGraphics->AttachControl(new IFaderControl(this, kGainL_X, kGainL_Y, kFader_Len, kGainL, &bitmap, kVertical)); //pGraphics->AttachControl(new IFaderControl(this, kGainR_X, kGainR_Y, kFader_Len, kGainR, &bitmap, kVertical)); // Attach a 5-position switch associated with the ChannelSw parameter. IBitmap bitmap = pGraphics->LoadIBitmap(TOGGLE_ID, TOGGLE_FN, kNoteLength_N); pGraphics->AttachControl(new ISwitchControl(this, kNoteLength_X, kNoteLength_Y, kNoteLength, &bitmap)); pGraphics->AttachControl(new ISwitchControl(this, kOctaves_X, kOctaves_Y, kOctaves, &bitmap)); pGraphics->AttachControl(new ISwitchControl(this, kArpMode_X, kArpMode_Y, kArpMode, &bitmap)); pGraphics->AttachControl(new ISwitchControl(this, kInsertMode_X, kInsertMode_Y, kInsertMode, &bitmap)); // Attach a rotating knob associated with the Pan parameter. //bitmap = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN); //pGraphics->AttachControl(new IKnobRotaterControl(this, kPan_X, kPan_Y, kPan, &bitmap)); // See IControl.h for other control types, // IKnobMultiControl, ITextControl, IBitmapOverlayControl, IFileSelectorControl, IGraphControl, etc. IText text; text.mAlign = IText::kAlignNear; textControl_ = new ITextControl(this, &IRECT(21, 0, 200, 100), &text, "Hello world"); pGraphics->AttachControl(textControl_); sequence_ = new Sequence(keymap_, 16); matrix = new ArpMatrix(this, sequence_, kDisplay_X, kDisplay_Y); pGraphics->AttachControl(matrix); AttachGraphics(pGraphics); running_ = false; }
IPlugMultiTargets::IPlugMultiTargets(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGainL(1.), mGainR(1.), mNoteGain(0.), mPhase(0), mSampleRate(44100.), mFreq(440.), mNumKeys(0), mKey(-1), mPrevL(0.0), mPrevR(0.0) { TRACE; memset(mKeyStatus, 0, 128 * sizeof(bool)); //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kGainL)->InitDouble("GainL", -12.0, -70.0, 12.0, 0.1, "dB"); GetParam(kGainR)->InitDouble("GainR", -12.0, -70.0, 12.0, 0.1, "dB"); GetParam(kMode)->InitEnum("Mode", 0, 6); GetParam(kMode)->SetDisplayText(0, "a"); GetParam(kMode)->SetDisplayText(1, "b"); GetParam(kMode)->SetDisplayText(2, "c"); GetParam(kMode)->SetDisplayText(3, "d"); GetParam(kMode)->SetDisplayText(4, "e"); GetParam(kMode)->SetDisplayText(5, "f"); #ifndef OS_IOS IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); pGraphics->AttachBackground(BG_ID, BG_FN); IBitmap knob = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, kKnobFrames); IText text = IText(14); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kGainX, kGainY, kGainX + 48, kGainY + 48 + 20), kGainL, &knob, &text)); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kGainX + 75, kGainY, kGainX + 48 + 75, kGainY + 48 + 20), kGainR, &knob, &text)); pGraphics->AttachControl(new ITempoDisplay(this, IRECT(300, 10, kWidth, 20), &text, &mTimeInfo)); // pGraphics->AttachControl(new IPopUpMenuControl(this, IRECT(10, 100, 60, 115), kMode)); pGraphics->AttachControl(new ITestPopupMenu(this, IRECT(10, 100, 60, 115))); pGraphics->AttachKeyCatcher(new IKeyCatcher(this, IRECT(0, 0, kWidth, kHeight))); mMeterIdx_L = pGraphics->AttachControl(new IPeakMeterVert(this, IRECT(300, 100, 310, 200))); mMeterIdx_R = pGraphics->AttachControl(new IPeakMeterVert(this, IRECT(312, 100, 322, 200))); IBitmap regular = pGraphics->LoadIBitmap(WHITE_KEY_ID, WHITE_KEY_FN, 6); IBitmap sharp = pGraphics->LoadIBitmap(BLACK_KEY_ID, BLACK_KEY_FN); // C# D# F# G# A# int coords[12] = { 0, 7, 12, 20, 24, 36, 43, 48, 56, 60, 69, 72 }; mKeyboard = new IKeyboardControl(this, kKeybX, kKeybY, 48, 5, ®ular, &sharp, coords); pGraphics->AttachControl(mKeyboard); pGraphics->AttachControl(new IPresetMenu(this, IRECT(10, 10, 250, 25))); IBitmap about = pGraphics->LoadIBitmap(ABOUTBOX_ID, ABOUTBOX_FN); mAboutBox = new IBitmapOverlayControl(this, 100, 100, &about, IRECT(540, 250, 680, 290)); pGraphics->AttachControl(mAboutBox); AttachGraphics(pGraphics); #endif //MakePreset("preset 1", ... ); MakeDefaultPreset((char *) "-", kNumPrograms); }
PlugExample::PlugExample(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, 6, instanceInfo), prevL(0.0), prevR(0.0) { TRACE; // Define parameter ranges, display units, labels. GetParam(kGainL)->InitDouble("Gain L", 0.0, -44.0, 12.0, 0.1, "dB"); GetParam(kGainL)->NegateDisplay(); GetParam(kGainR)->InitDouble("Gain R", 0.0, -44.0, 12.0, 0.1, "dB"); GetParam(kPan)->InitInt("Pan", 0, -100, 100, "%"); // Params can be enums. GetParam(kChannelSw)->InitEnum("Channel", kDefault, kNumChannelSwitchEnums); GetParam(kChannelSw)->SetDisplayText(kDefault, "default"); GetParam(kChannelSw)->SetDisplayText(kReversed, "reversed"); GetParam(kChannelSw)->SetDisplayText(kAllLeft, "all L"); GetParam(kChannelSw)->SetDisplayText(kAllRight, "all R"); GetParam(kChannelSw)->SetDisplayText(kOff, "mute"); MakePreset("preset 1", -5.0, 5.0, 17, kReversed); MakePreset("preset 2", -15.0, 25.0, 37, kAllRight); MakeDefaultPreset("-", 4); // Instantiate a graphics engine. IGraphics* pGraphics = MakeGraphics(this, kW, kH); // MakeGraphics(this, kW, kH); pGraphics->AttachBackground(IPLUG_PNG_RESOURCE(BG_ID, BG_FN)); // Attach controls to the graphics engine. Controls are automatically associated // with a parameter if you construct the control with a parameter index. // Attach a couple of meters, not associated with any parameter, // which we keep indexes for, so we can push updates from the plugin class. IBitmap bitmap = pGraphics->LoadIBitmap(IPLUG_PNG_RESOURCE(METER_ID, METER_FN), kMeter_N); mMeterIdx_L = pGraphics->AttachControl(new IBitmapControl(this, kMeterL_X, kMeterL_Y, &bitmap)); mMeterIdx_R = pGraphics->AttachControl(new IBitmapControl(this, kMeterR_X, kMeterR_Y, &bitmap)); // Attach a couple of faders, associated with the parameters GainL and GainR. bitmap = pGraphics->LoadIBitmap(IPLUG_PNG_RESOURCE(FADER_ID, FADER_FN)); pGraphics->AttachControl(new IFaderControl(this, kGainL_X, kGainL_Y, kFader_Len, kGainL, &bitmap, kVertical)); pGraphics->AttachControl(new IFaderControl(this, kGainR_X, kGainR_Y, kFader_Len, kGainR, &bitmap, kVertical)); // Attach a 5-position switch associated with the ChannelSw parameter. bitmap = pGraphics->LoadIBitmap(IPLUG_PNG_RESOURCE(TOGGLE_ID, TOGGLE_FN), kSwitch_N); pGraphics->AttachControl(new ISwitchControl(this, kSwitch_X, kSwitch_Y, kChannelSw, &bitmap)); // Attach a rotating knob associated with the Pan parameter. bitmap = pGraphics->LoadIBitmap(IPLUG_PNG_RESOURCE(KNOB_ID, KNOB_FN)); pGraphics->AttachControl(new IKnobRotaterControl(this, kPan_X, kPan_Y, kPan, &bitmap)); // See IControl.h for other control types, // IKnobMultiControl, ITextControl, IBitmapOverlayControl, IFileSelectorControl, IGraphControl, etc. // 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. }