IRECT GetRegionRect(EventRef pEvent, int gfxW, int gfxH) { RgnHandle pRgn = 0; if (GetEventParameter(pEvent, kEventParamRgnHandle, typeQDRgnHandle, 0, sizeof(RgnHandle), 0, &pRgn) == noErr && pRgn) { Rect rct; GetRegionBounds(pRgn, &rct); return IRECT(rct.left, rct.top, rct.right, rct.bottom); } return IRECT(0, 0, gfxW, gfxH); }
IRECT IGraphicsWin::GetWindowRECT() { if (mPlugWnd) { RECT r; GetWindowRect(mPlugWnd, &r); r.right -= TOOLWIN_BORDER_W; r.bottom -= TOOLWIN_BORDER_H; return IRECT(r.left, r.top, r.right, r.bottom); } return IRECT(); }
IFaderControl::IFaderControl(IPlugBase* pPlug, int x, int y, int len, int paramIdx, IBitmap* pBitmap, EDirection direction) : IControl(pPlug, IRECT(), paramIdx), mLen(len), mBitmap(*pBitmap), mDirection(direction) { if (direction == kVertical) { mHandleHeadroom = mBitmap.H; mRECT = mTargetRECT = IRECT(x, y, x + mBitmap.W, y + len); } else { mHandleHeadroom = mBitmap.W; mRECT = mTargetRECT = IRECT(x, y, x + len, y + mBitmap.H); } }
IRECT GetRegionRect(EventRef pEvent, int gfxW, int gfxH) { #if __MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 RgnHandle pRgn = 0; if (GetEventParameter(pEvent, kEventParamRgnHandle, typeQDRgnHandle, 0, sizeof(RgnHandle), 0, &pRgn) == noErr && pRgn) { Rect rct; GetRegionBounds(pRgn, &rct); return IRECT(rct.left, rct.top, rct.right, rct.bottom); } #endif return IRECT(0, 0, gfxW, gfxH); }
bool IGraphics::DrawRotatedMask(IBitmap* pIBase, IBitmap* pIMask, IBitmap* pITop, int x, int y, double angle, const IChannelBlend* pBlend) { LICE_IBitmap* pBase = (LICE_IBitmap*) pIBase->mData; LICE_IBitmap* pMask = (LICE_IBitmap*) pIMask->mData; LICE_IBitmap* pTop = (LICE_IBitmap*) pITop->mData; double dA = angle * PI / 180.0; int W = pIBase->W; int H = pIBase->H; // RECT srcR = { 0, 0, W, H }; float xOffs = (W % 2 ? -0.5f : 0.0f); if (!mTmpBitmap) { mTmpBitmap = new LICE_MemBitmap(); } _LICE::LICE_Copy(mTmpBitmap, pBase); _LICE::LICE_ClearRect(mTmpBitmap, 0, 0, W, H, LICE_RGBA(255, 255, 255, 0)); _LICE::LICE_RotatedBlit(mTmpBitmap, pMask, 0, 0, W, H, 0.0f, 0.0f, (float) W, (float) H, (float) dA, true, 1.0f, LICE_BLIT_MODE_ADD | LICE_BLIT_FILTER_BILINEAR | LICE_BLIT_USE_ALPHA, xOffs, 0.0f); _LICE::LICE_RotatedBlit(mTmpBitmap, pTop, 0, 0, W, H, 0.0f, 0.0f, (float) W, (float) H, (float) dA, true, 1.0f, LICE_BLIT_MODE_COPY | LICE_BLIT_FILTER_BILINEAR | LICE_BLIT_USE_ALPHA, xOffs, 0.0f); IRECT r = IRECT(x, y, x + W, y + H).Intersect(&mDrawRECT); _LICE::LICE_Blit(mDrawBitmap, mTmpBitmap, r.L, r.T, r.L - x, r.T - y, r.R - r.L, r.B - r.T, LiceWeight(pBlend), LiceBlendMode(pBlend)); // ReaperExt::LICE_Blit(mDrawBitmap, mTmpBitmap, x, y, &srcR, LiceWeight(pBlend), LiceBlendMode(pBlend)); return true; }
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()); }
void attachKnob(IGraphics *pGraphics, IPlugBase *pPlug, uint8_t r, uint8_t c, int paramIdx, IBitmap *pBmp) { int x = (pBmp->W+X_PAD)*(c)+X_PAD; int y = (pBmp->frameHeight() + LBL_H + Y_PAD)*(r)+Y_PAD; ITextControl* knobLabel; IText textprops(10, &COLOR_YELLOW, "Arial"); IRECT textrect = IRECT(x, y + pBmp->frameHeight(), x + pBmp->W, y + pBmp->frameHeight() + LBL_H); knobLabel = new ITextControl(pPlug, textrect, &textprops, pPlug->GetParam(paramIdx)->GetLabelForHost()); pGraphics->AttachControl(new IKnobMultiControl(pPlug, x, y, paramIdx, pBmp)); pGraphics->AttachControl(knobLabel); }
IRadioButtonsControl::IRadioButtonsControl(IPlugBase* pPlug, IRECT pR, int paramIdx, int nButtons, IBitmap* pBitmap, EDirection direction) : IControl(pPlug, pR, paramIdx), mBitmap(*pBitmap) { mRECTs.Resize(nButtons); int x = mRECT.L, y = mRECT.T, h = int((double) pBitmap->H / (double) pBitmap->N); if (direction == kHorizontal) { int dX = int((double) (pR.W() - nButtons * pBitmap->W) / (double) (nButtons - 1)); for (int i = 0; i < nButtons; ++i) { mRECTs.Get()[i] = IRECT(x, y, x + pBitmap->W, y + h); x += pBitmap->W + dX; } } else { int dY = int((double) (pR.H() - nButtons * h) / (double) (nButtons - 1)); for (int i = 0; i < nButtons; ++i) { mRECTs.Get()[i] = IRECT(x, y, x + pBitmap->W, y + h); y += h + dY; } } }
ATKColoredCompressor::ATKColoredCompressor(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), inFilter(nullptr, 1, 0, false), outFilter(nullptr, 1, 0, false), gainCompressorFilter(1, 256*1024) { TRACE; //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kPower)->InitDouble("Power", 10., 0., 100.0, 0.1, "ms"); GetParam(kPower)->SetShape(2.); GetParam(kAttack)->InitDouble("Attack", 10., 1., 100.0, 0.1, "ms"); GetParam(kAttack)->SetShape(2.); GetParam(kRelease)->InitDouble("Release", 10, 1., 100.0, 0.1, "ms"); GetParam(kRelease)->SetShape(2.); GetParam(kThreshold)->InitDouble("Threshold", 0., -40., 0.0, 0.1, "dB"); // threshold is actually power GetParam(kSlope)->InitDouble("Slope", 2., 1.5, 100, .1, "-"); GetParam(kSlope)->SetShape(2.); GetParam(kColored)->InitDouble("Color", 0, -.5, .5, 0.01, "-"); GetParam(kQuality)->InitDouble("Quality", 0.1, 0.01, .2, 0.01, "-"); GetParam(kSoftness)->InitDouble("Softness", -2, -4, 0, 0.1, "-"); GetParam(kSoftness)->SetShape(2.); GetParam(kMakeup)->InitDouble("Makeup Gain", 0, 0, 40, 0.1, "dB"); // Makeup is expressed in amplitude GetParam(kDryWet)->InitDouble("Dry/Wet", 1, 0, 1, 0.01, "-"); IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); pGraphics->AttachBackground(COLORED_COMPRESSOR_ID, COLORED_COMPRESSOR_FN); IBitmap knob = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, kKnobFrames); IBitmap knob1 = pGraphics->LoadIBitmap(KNOB1_ID, KNOB1_FN, kKnobFrames1); IColor color = IColor(255, 255, 255, 255); IText text = IText(10, &color, nullptr, IText::kStyleBold); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kPowerX, kPowerY, kPowerX + 78, kPowerY + 78 + 21), kPower, &knob, &text, "ms")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kAttackX, kAttackY, kAttackX + 78, kAttackY + 78 + 21), kAttack, &knob, &text, "ms")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kReleaseX, kReleaseY, kReleaseX + 78, kReleaseY + 78 + 21), kRelease, &knob, &text, "ms")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kThresholdX, kThresholdY, kThresholdX + 78, kThresholdY + 78 + 21), kThreshold, &knob, &text, "dB")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kSlopeX, kSlopeY, kSlopeX + 78, kSlopeY + 78 + 21), kSlope, &knob, &text, "")); pGraphics->AttachControl(new IKnobMultiControl(this, kSoftnessX, kSoftnessY, kSoftness, &knob)); pGraphics->AttachControl(new IKnobMultiControl(this, kColoredX, kColoredY, kColored, &knob1)); pGraphics->AttachControl(new IKnobMultiControl(this, kQualityX, kQualityY, kQuality, &knob)); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kMakeupX, kMakeupY, kMakeupX + 78, kMakeupY + 78 + 21), kMakeup, &knob, &text, "dB")); pGraphics->AttachControl(new IKnobMultiControl(this, kDryWetX, kDryWetY, kDryWet, &knob1)); AttachGraphics(pGraphics); //MakePreset("preset 1", ... ); MakePreset("Serial Compression", 10., 10., 10., 0., 2., .1, 0., .01, 0., 1.); MakePreset("Parallel Compression", 10., 10., 10., 0., 2., .1, 0., .01, 0., 0.5); powerFilter.set_input_port(0, &inFilter, 0); attackReleaseFilter.set_input_port(0, &powerFilter, 0); gainCompressorFilter.set_input_port(0, &attackReleaseFilter, 0); applyGainFilter.set_input_port(0, &gainCompressorFilter, 0); applyGainFilter.set_input_port(1, &inFilter, 0); volumeFilter.set_input_port(0, &applyGainFilter, 0); drywetFilter.set_input_port(0, &volumeFilter, 0); drywetFilter.set_input_port(1, &inFilter, 0); outFilter.set_input_port(0, &drywetFilter, 0); Reset(); }
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); }
IPlugChunks::IPlugChunks(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGain(1.) { TRACE; memset(mSteps, 0, NUM_SLIDERS*sizeof(double)); // Define parameter ranges, display units, labels. //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kGain)->InitDouble("Gain", 0.0, -70.0, 12.0, 0.1, "dB"); MakePresetFromBlob("Ramp Up", "AAAAAJqZqT8AAAAAmpm5PwAAAIA9Csc/AAAAAAAA0D8AAABA4XrUPwAAAIDC9dg/AAAAwMzM3D8AAAAQ16PgPwAAALBH4eI/AAAA0MzM5D8AAADwUbjmPwAAAAjXo+g/AAAAKFyP6j8AAADMzMzsPwAAAOxRuO4/AAAAAAAA8D8AAAAAAAC8Pg==", 136); MakePresetFromBlob("Ramp Down", "AAAA7FG47j8AAABI4XrsPwAAALBH4eo/AAAAGK5H6T8AAABwPQrnPwAAANDMzOQ/AAAAwB6F4z8AAAAghevhPwAAAAB7FN4/AAAAgOtR2D8AAABAuB7VPwAAAACuR9E/AAAAgEfhyj8AAAAAhevBPwAAAABSuK4/AAAAAOB6hD8AAAAAAAC8Pg==", 136); MakePresetFromBlob("Triangle", "AAAAAIXrwT8AAACAR+HKPwAAAEBcj9I/AAAAgBSu1z8AAADA9SjcPwAAABDXo+A/AAAAsEfh4j8AAABQuB7lPwAAAGBmZuY/AAAAMDMz4z8AAAAAAADgPwAAAMD1KNw/AAAAQI/C1T8AAAAArkfRPwAAAICPwsU/AAAAAJqZuT8AAAAAAAAAAA==", 136); MakePresetFromBlob("Inv Triangle", "AAAAAAAA8D8AAABQuB7tPwAAAKBwPeo/AAAAcD0K5z8AAABA4XrkPwAAAJDC9eA/AAAAwEfh2j8AAABAj8LVPwAAAECPwtU/AAAAwMzM3D8AAAAghevhPwAAANDMzOQ/AAAAgBSu5z8AAACYmZnpPwAAAFyPwu0/AAAAAAAA8D8AAAAAAAAAAA==", 136); MakePresetFromBlob("Da Endz", "AAAAAAAA8D8AAAAA4HqEPwAAAADgeoQ/AAAAAOB6hD8AAAAA4HqEPwAAAADgeoQ/AAAAAOB6hD8AAAAA4HqEPwAAAADgeoQ/AAAAAOB6hD8AAAAA4HqEPwAAAADgeoQ/AAAAAOB6hD8AAAAA4HqEPwAAAADgeoQ/AAAAAAAA8D8AAAAAAAAAAA==", 136); MakePresetFromBlob("Alternate", "AAAAAAAA8D8AAAAA4HqEPwAAAAAAAPA/AAAAAOB6hD8AAAAAAADwPwAAAADgeoQ/AAAAAAAA8D8AAAAA4HqEPwAAAAAAAPA/AAAAAOB6hD8AAAAAAADwPwAAAADgeoQ/AAAAAAAA8D8AAAAA4HqEPwAAAAAAAPA/AAAAAOB6hD8AAAAAAAAAAA==", 136); MakePresetFromBlob("Alt Ramp Down", "AAAAAAAA8D8AAAAA4HqEPwAAALgehes/AAAAAOB6hD8AAACI61HoPwAAAADgeoQ/AAAAQArX4z8AAAAA4HqEPwAAAAAAAOA/AAAAAOB6hD8AAABAuB7VPwAAAADgeoQ/AAAAAKRwzT8AAAAA4HqEPwAAAAAzM8M/AAAAAOB6hD8AAAAAAAAAAA==", 136); MakePresetFromBlob("Alt Ramp Up", "AAAAgJmZyT8AAAAA4HqEPwAAAIBmZtY/AAAAAOB6hD8AAAAAKVzfPwAAAADgeoQ/AAAAMFyP4j8AAAAA4HqEPwAAAEDheuQ/AAAAAOB6hD8AAADwKFznPwAAAADgeoQ/AAAAIIXr6T8AAAAA4HqEPwAAANijcO0/AAAAAOB6hD8AAAAAAAAAAA==", 136); IGraphics* pGraphics = MakeGraphics(this, kW, kH); pGraphics->AttachPanelBackground(&COLOR_BLUE); mMSlider = new MultiSliderControlV(this, IRECT(10, 10, 170, 110), kDummyParamForMultislider, NUM_SLIDERS, 10, &COLOR_WHITE, &COLOR_BLACK, &COLOR_RED); pGraphics->AttachControl(mMSlider); pGraphics->AttachControl(new IVSliderControl(this, IRECT(200, 10, 220, 110), kGain, 20, &COLOR_WHITE, &COLOR_GREEN)); //pGraphics->AttachControl(new ITempPresetSaveButtonControl(this, IRECT(350, 250, 390, 290))); pGraphics->AttachControl(new PresetFunctionsMenu(this, IRECT(350, 250, 390, 290))); AttachGraphics(pGraphics); // call RestorePreset(0) here which will initialize the multislider in the gui and the mSteps array RestorePreset(0); }
void IControl::PromptUserInput() { if (mParamIdx >= 0 && !mDisablePrompt) { if (mPlug->GetParam(mParamIdx)->GetNDisplayTexts()) // popup menu { mPlug->GetGUI()->PromptUserInput(this, mPlug->GetParam(mParamIdx), &mRECT ); } else // text entry { int cX = (int) mRECT.MW(), cY = (int) mRECT.MH(); IRECT txtRECT = IRECT(cX - (float) PARAM_EDIT_W/2., cY - (PARAM_EDIT_H / 2.), cX + (float) PARAM_EDIT_W/2., cY + (PARAM_EDIT_H / 2.) ); mPlug->GetGUI()->PromptUserInput(this, mPlug->GetParam(mParamIdx), &txtRECT ); } Redraw(); } }
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); }
void IGraphics::AttachPanelBackground(const IColor *pColor) { IControl* pBG = new IPanelControl(mPlug, IRECT(0, 0, mWidth, mHeight), pColor); mControls.Insert(0, pBG); }
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(); }
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); }
// static pascal OSStatus IGraphicsCarbon::MainEventHandler(EventHandlerCallRef pHandlerCall, EventRef pEvent, void* pGraphicsCarbon) { IGraphicsCarbon* _this = (IGraphicsCarbon*) pGraphicsCarbon; IGraphicsMac* pGraphicsMac = _this->mGraphicsMac; UInt32 eventClass = GetEventClass(pEvent); UInt32 eventKind = GetEventKind(pEvent); switch (eventClass) { case kEventClassKeyboard: { switch (eventKind) { case kEventRawKeyDown: { if (_this->mTextEntryView) return eventNotHandledErr; bool handle = true; int key; UInt32 k; GetEventParameter(pEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &k); char c; GetEventParameter(pEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &c); if (k == 49) key = KEY_SPACE; else if (k == 125) key = KEY_DOWNARROW; else if (k == 126) key = KEY_UPARROW; else if (k == 123) key = KEY_LEFTARROW; else if (k == 124) key = KEY_RIGHTARROW; else if (c >= '0' && c <= '9') key = KEY_DIGIT_0+c-'0'; else if (c >= 'A' && c <= 'Z') key = KEY_ALPHA_A+c-'A'; else if (c >= 'a' && c <= 'z') key = KEY_ALPHA_A+c-'a'; else handle = false; if(handle) handle = pGraphicsMac->OnKeyDown(_this->mPrevX, _this->mPrevY, key); if(handle) return noErr; else return eventNotHandledErr; } } } case kEventClassControl: { switch (eventKind) { case kEventControlDraw: { int gfxW = pGraphicsMac->Width(), gfxH = pGraphicsMac->Height(); IRECT r = GetRegionRect(pEvent, gfxW, gfxH); CGrafPtr port = 0; if (_this->mIsComposited) { GetEventParameter(pEvent, kEventParamCGContextRef, typeCGContextRef, 0, sizeof(CGContextRef), 0, &(_this->mCGC)); CGContextTranslateCTM(_this->mCGC, 0, gfxH); CGContextScaleCTM(_this->mCGC, 1.0, -1.0); pGraphicsMac->Draw(&r); } else { GetEventParameter(pEvent, kEventParamGrafPort, typeGrafPtr, 0, sizeof(CGrafPtr), 0, &port); QDBeginCGContext(port, &(_this->mCGC)); //RgnHandle clipRegion = NewRgn(); //GetPortClipRegion(port, clipRegion); Rect portBounds; GetPortBounds(port, &portBounds); int offsetW = 0; int offsetH = -portBounds.top; //int offsetH = (portBounds.bottom - portBounds.top) - gfxH; // this almost works with AS, but clip rect seems wrong when previewing/breaks RTAS if ((portBounds.right - portBounds.left) >= gfxW) { offsetW = 0.5 * ((portBounds.right - portBounds.left) - gfxW); } CGContextTranslateCTM(_this->mCGC, portBounds.left + offsetW, offsetH); r = IRECT(0, 0, pGraphicsMac->Width(), pGraphicsMac->Height()); pGraphicsMac->Draw(&r); // Carbon non-composited will redraw everything, the IRECT passed here is the entire plugin-gui QDEndCGContext(port, &(_this->mCGC)); //DisposeRgn(clipRegion); } return noErr; } } break; } case kEventClassMouse: { HIPoint hp; GetEventParameter(pEvent, kEventParamWindowMouseLocation, typeHIPoint, 0, sizeof(HIPoint), 0, &hp); #ifdef RTAS_API // Header offset hp.x -= _this->GetLeftOffset(); hp.y -= _this->GetTopOffset(); Rect bounds; GetWindowBounds(_this->mWindow, kWindowTitleBarRgn, &bounds); // adjust x mouse coord if the gui is less wide than the window // int windowWidth = (bounds.right - bounds.left); // // if (windowWidth > pGraphicsMac->Width()) // { // hp.x -= (int) floor((windowWidth - pGraphicsMac->Width()) / 2.); // } // Title bar Y offset hp.y -= bounds.bottom - bounds.top; int x = (int) hp.x; int y = (int) hp.y; #else // NOT RTAS HIPointConvert(&hp, kHICoordSpaceWindow, _this->mWindow, kHICoordSpaceView, _this->mView); int x = (int) hp.x - 2; int y = (int) hp.y - 3; #endif UInt32 mods; GetEventParameter(pEvent, kEventParamKeyModifiers, typeUInt32, 0, sizeof(UInt32), 0, &mods); EventMouseButton button; GetEventParameter(pEvent, kEventParamMouseButton, typeMouseButton, 0, sizeof(EventMouseButton), 0, &button); if (button == kEventMouseButtonPrimary && (mods & cmdKey)) button = kEventMouseButtonSecondary; IMouseMod mmod(true, button == kEventMouseButtonSecondary, (mods & shiftKey), (mods & controlKey), (mods & optionKey)); switch (eventKind) { case kEventMouseDown: { if (_this->mTextEntryView) { #if !(USE_MLTE) HIViewRef view; HIViewGetViewForMouseEvent(_this->mView, pEvent, &view); if (view == _this->mTextEntryView) break; #endif _this->EndUserInput(true); } #ifdef RTAS_API // RTAS triple click if (mmod.L && mmod.R && mmod.C && (pGraphicsMac->GetParamIdxForPTAutomation(x, y) > -1)) { return CallNextEventHandler(pHandlerCall, pEvent); } #endif CallNextEventHandler(pHandlerCall, pEvent); UInt32 clickCount = 0; GetEventParameter(pEvent, kEventParamClickCount, typeUInt32, 0, sizeof(UInt32), 0, &clickCount); if (clickCount > 1) { pGraphicsMac->OnMouseDblClick(x, y, &mmod); } else { pGraphicsMac->OnMouseDown(x, y, &mmod); } return noErr; } case kEventMouseUp: { pGraphicsMac->OnMouseUp(x, y, &mmod); return noErr; } case kEventMouseMoved: { _this->mPrevX = x; _this->mPrevY = y; pGraphicsMac->OnMouseOver(x, y, &mmod); return noErr; } case kEventMouseDragged: { if (!_this->mTextEntryView) pGraphicsMac->OnMouseDrag(x, y, &mmod); return noErr; } case kEventMouseWheelMoved: { EventMouseWheelAxis axis; GetEventParameter(pEvent, kEventParamMouseWheelAxis, typeMouseWheelAxis, 0, sizeof(EventMouseWheelAxis), 0, &axis); if (axis == kEventMouseWheelAxisY) { int d; GetEventParameter(pEvent, kEventParamMouseWheelDelta, typeSInt32, 0, sizeof(SInt32), 0, &d); if (_this->mTextEntryView) _this->EndUserInput(false); pGraphicsMac->OnMouseWheel(x, y, &mmod, d); return noErr; } } } break; } case kEventClassWindow: { WindowRef window; if (GetEventParameter(pEvent, kEventParamDirectObject, typeWindowRef, NULL, sizeof (WindowRef), NULL, &window) != noErr) break; switch (eventKind) { case kEventWindowDeactivated: { if (_this->mTextEntryView) _this->EndUserInput(false); break; } } break; } } return eventNotHandledErr; }
void Synthesis::CreateGraphics() { IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); pGraphics->AttachPanelBackground(&COLOR_BLACK); //pGraphics->AttachBackground(BG_ID, BG_FN); IBitmap whiteKeyImage = pGraphics->LoadIBitmap(WHITE_KEY_ID, WHITE_KEY_FN, 6); IBitmap blackKeyImage = pGraphics->LoadIBitmap(BLACK_KEY_ID, BLACK_KEY_FN); //mOscilloscope = new Oscilloscope(this, IRECT(0, 300, GUI_WIDTH, GUI_HEIGHT)); // C# D# F# G# A# int keyCoordinates[12] = { 0, 10, 17, 30, 35, 52, 61, 68, 79, 85, 97, 102 }; mVirtualKeyboard = new IKeyboardControl(this, kKeybX, kKeybY, virtualKeyboardMinimumNoteNumber, /* octaves: */ 8, &whiteKeyImage, &blackKeyImage, keyCoordinates); pGraphics->AttachControl(mVirtualKeyboard); // Knob bitmap IBitmap knobBitmap = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, 101); for (int i = 0; i < kNumParams; i++) { const parameterProperties_struct& properties = parameterProperties[i]; IControl* control; IControl* labelcontrol; IBitmap* graphic; IText text = IText(14, &COLOR_WHITE); IText labeltext = IText(14, &COLOR_WHITE); switch (i) { // Knobs: default: graphic = &knobBitmap; control = new IKnobMultiControlText(this, IRECT(properties.x1, properties.y1, properties.x2, properties.y2), i, graphic, &text); labelcontrol = new ITextControl(this, IRECT(properties.x1, properties.y1-20, properties.x2, properties.y1), &labeltext, properties.name); break; } pGraphics->AttachControl(control); pGraphics->AttachControl(labelcontrol); } // // caption // IText mBLabel(14, &COLOR_WHITE); // pGraphics->AttachControl(new ITextControl(this, IRECT(60-12, 154-20, 60+50, 154+20), &mBLabel, "Inharmonicity")); // // // TEXT TESTING // // IRECT tmpRect4(650, 50, 800, 120); // IText textProps4(40, &COLOR_WHITE, "Helvetica", IText::kStyleNormal, IText::kAlignCenter, 0, IText::kQualityDefault); // pGraphics->AttachControl(new ITextControl(this, tmpRect4, &textProps4, "STRING SYNTH")); //pGraphics->AttachControl(mOscilloscope); AttachGraphics(pGraphics); }
RaspberryJammer::RaspberryJammer(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGainL(1.), mGainR(1.), 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(kFilterCutoff)->InitDouble("Cutoff", 440., 0., 12000., 1.); GetParam(kFilterResonance)->InitDouble("Q", 0.1, 0.0, 1.0, 0.01); GetParam(kLfoRate)->InitDouble("LFO Rate", 0.5, 0.001, 20.0, 0.001); GetParam(kLfoDepth)->InitDouble("LFO Depth", 1., 0.0, 1000., 0.0001); GetParam(kEnvAttack)->InitInt("Env Attack", 300, 0, 100000); GetParam(kEnvDecay)->InitInt("Env Decay", 1000, 0, 100000); GetParam(kEnvSustain)->InitDouble("Env Sustain", 1., 0., 1., 0.01); GetParam(kEnvRelease)->InitInt("Env Release", 2000, 0, 100000); 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); IBitmap regular = pGraphics->LoadIBitmap(WHITE_KEY_ID, WHITE_KEY_FN, 6); IBitmap sharp = pGraphics->LoadIBitmap(BLACK_KEY_ID, BLACK_KEY_FN); // Filter knobs mCutoffKnob = new IKnobMultiControl(this, kFilterCutoffX, kFilterCutoffY, kFilterCutoff, &knob); pGraphics->AttachControl(mCutoffKnob); mResonanceKnob = new IKnobMultiControl(this, kFilterResonanceX, kFilterResonanceY, kFilterResonance, &knob); pGraphics->AttachControl(mResonanceKnob); // LFO knobs mLfoRateKnob = new IKnobMultiControl(this, kLfoRateX, kLfoRateY, kLfoRate, &knob); pGraphics->AttachControl(mLfoRateKnob); mLfoDepthKnob = new IKnobMultiControl(this, kLfoDepthX, kLfoDepthY, kLfoDepth, &knob); pGraphics->AttachControl(mLfoDepthKnob); // ADSR envelope knobs mEnvAttackKnob = new IKnobMultiControl(this, kEnvAttackX, kEnvAttackY, kEnvAttack, &knob); pGraphics->AttachControl(mEnvAttackKnob); mEnvDecayKnob = new IKnobMultiControl(this, kEnvDecayX, kEnvDecayY, kEnvDecay, &knob); pGraphics->AttachControl(mEnvDecayKnob); mEnvSustainKnob = new IKnobMultiControl(this, kEnvSustainX, kEnvSustainY, kEnvSustain, &knob); pGraphics->AttachControl(mEnvSustainKnob); mEnvReleaseKnob = new IKnobMultiControl(this, kEnvReleaseX, kEnvReleaseY, kEnvRelease, &knob); pGraphics->AttachControl(mEnvReleaseKnob); // 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); 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); //MakePreset("preset 1", ... ); this->CreatePresets(); }
void DrawBitmapedText(IGraphics* pGraphics, IBitmap* pTextBitmap, IRECT* controlRect, IText* pItext, IChannelBlend* pBlend, const char* str, bool vCenter, bool multiline, int charWidth, int charHeight, int charOffset) { if (CSTR_NOT_EMPTY(str)) { int len = strlen(str); int basicYOffset, basicXOffset; if (vCenter) basicYOffset = controlRect->T + ((controlRect->H() - charHeight) / 2); else basicYOffset = controlRect->T; if (pItext->mAlign == IText::kAlignCenter) basicXOffset = controlRect->L + ((controlRect->W() - (len * charWidth)) / 2); else basicXOffset = controlRect->L + charWidth; int widthAsOneLine = charWidth * len; int lineWidth = controlRect->W() - (charWidth * 2); assert(lineWidth > 0); int nLines; int stridx = 0; int lineCount; if(multiline) { if (widthAsOneLine > lineWidth) { lineCount = lineWidth / charWidth; nLines = widthAsOneLine / lineWidth; } else// line is shorter than width of rect { lineCount = len; nLines = 1; } } else { nLines = 1; lineCount = lineWidth / charWidth; } //int newlines = 0; for(int line=0; line<=nLines; line++) { int yOffset = basicYOffset + line * charHeight; for(int linepos=0; linepos<lineCount; linepos++) { if (str[stridx] == '\0') return; // else if(str[stridx] == '\n') // { // yOffset = basicYOffset + line * charHeight; // } int frameOffset = (int) str[stridx++] - 31; // calculate which frame to look up int xOffset = (linepos * (charWidth + charOffset)) + basicXOffset; // calculate xOffset for character we're drawing IRECT charRect = IRECT(xOffset, yOffset, xOffset + charWidth, yOffset + charHeight); pGraphics->DrawBitmap(pTextBitmap, &charRect, frameOffset, pBlend); } } } }
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; }
AutoTalent::AutoTalent(IPlugInstanceInfo instanceInfo): IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo) { TRACE; //====================================================================================================== init(fs); IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); // Define parameter ranges, display units, labels. //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kMix)->InitDouble("Mix", 100., 0., 100., 0.01, "%"); GetParam(kShift)->InitDouble("Transpose", 0.0, -12., 12., 1., "st"); GetParam(kTune)->InitDouble("Fine Tune", 0.0, -100., 100., 1, "ct"); GetParam(kAmount)->InitDouble("Amount", 100., 0., 100., 0.01, "%"); GetParam(kGlide)->InitDouble("Glide", 0.0, 0., 1000., 0.01, "ms"); GetParam(kC)->InitDouble("C", 100., 0., 100., 0.01, "%"); GetParam(kDb)->InitDouble("Db", 100., 0., 100., 0.01, "%"); GetParam(kD)->InitDouble("D", 100., 0., 100., 0.01, "%"); GetParam(kEb)->InitDouble("Eb", 100., 0., 100., 0.01, "%"); GetParam(kE)->InitDouble("E", 100., 0., 100., 0.01, "%"); GetParam(kF)->InitDouble("F", 100., 0., 100., 0.01, "%"); GetParam(kGb)->InitDouble("Gb", 100., 0., 100., 0.01, "%"); GetParam(kG)->InitDouble("G", 100., 0., 100., 0.01, "%"); GetParam(kAb)->InitDouble("Ab", 100., 0., 100., 0.01, "%"); GetParam(kA)->InitDouble("A", 100., 0., 100., 0.01, "%"); GetParam(kBb)->InitDouble("Bb", 100., 0., 100., 0.01, "%"); GetParam(kB)->InitDouble("B", 100., 0., 100., 0.01, "%"); GetParam(kRoot)->InitEnum("Root", 0, 12); GetParam(kRoot)->SetDisplayText(0, "C"); GetParam(kRoot)->SetDisplayText(1, "Db"); GetParam(kRoot)->SetDisplayText(2, "D"); GetParam(kRoot)->SetDisplayText(3, "Eb"); GetParam(kRoot)->SetDisplayText(4, "E"); GetParam(kRoot)->SetDisplayText(5, "F"); GetParam(kRoot)->SetDisplayText(6, "Gb"); GetParam(kRoot)->SetDisplayText(7, "G"); GetParam(kRoot)->SetDisplayText(8, "Ab"); GetParam(kRoot)->SetDisplayText(9, "A"); GetParam(kRoot)->SetDisplayText(10, "Bb"); GetParam(kRoot)->SetDisplayText(11, "B"); GetParam(kScale)->InitEnum("Scale", 0, 13); GetParam(kScale)->SetDisplayText(0, "Chromatic"); GetParam(kScale)->SetDisplayText(1, "Major"); GetParam(kScale)->SetDisplayText(2, "Minor"); GetParam(kScale)->SetDisplayText(3, "Dorian"); GetParam(kScale)->SetDisplayText(4, "Mixolydian"); GetParam(kScale)->SetDisplayText(5, "Lydian"); GetParam(kScale)->SetDisplayText(6, "Phrygian"); GetParam(kScale)->SetDisplayText(7, "Locrian"); GetParam(kScale)->SetDisplayText(8, "Harmonic Minor"); GetParam(kScale)->SetDisplayText(9, "Melodic Minor"); GetParam(kScale)->SetDisplayText(10, "Major Pentatonic"); GetParam(kScale)->SetDisplayText(11, "Minor Pentatonic"); GetParam(kScale)->SetDisplayText(12, "Minor Blues"); GetParam(kScale)->SetIsMeta(true); GetParam(kRoot)->SetIsMeta(true); IBitmap Knob = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, kKnobFrames); IBitmap KeyC = pGraphics->LoadIBitmap(KEYC_ID, KEYC_FN, 2); IBitmap KeyD = pGraphics->LoadIBitmap(KEYD_ID, KEYD_FN, 2); IBitmap KeyE = pGraphics->LoadIBitmap(KEYE_ID, KEYE_FN, 2); IBitmap KeyF = pGraphics->LoadIBitmap(KEYF_ID, KEYF_FN, 2); IBitmap KeyG = pGraphics->LoadIBitmap(KEYG_ID, KEYG_FN, 2); IBitmap KeyA = pGraphics->LoadIBitmap(KEYA_ID, KEYA_FN, 2); IBitmap KeyB = pGraphics->LoadIBitmap(KEYB_ID, KEYB_FN, 2); IBitmap KeyBlack = pGraphics->LoadIBitmap(KEYBLACK_ID, KEYBLACK_FN, 2); Keys[0] = new ISwitchControl(this, kKeyboardX, kKeyboardY, kC, &KeyC); Keys[1] = new ISwitchControl(this, kKeyboardX + kKeyboardSpacingB, kKeyboardY, kDb, &KeyBlack); Keys[2] = new ISwitchControl(this, kKeyboardX + kKeyboardSpacingW, kKeyboardY, kD, &KeyD); Keys[3] = new ISwitchControl(this, kKeyboardX + kKeyboardSpacingW + kKeyboardSpacingB, kKeyboardY, kEb, &KeyBlack); Keys[4] = new ISwitchControl(this, kKeyboardX + 2 * kKeyboardSpacingW, kKeyboardY, kE, &KeyE); Keys[5] = new ISwitchControl(this, kKeyboardX + 3 * kKeyboardSpacingW, kKeyboardY, kF, &KeyF); Keys[6] = new ISwitchControl(this, kKeyboardX + 3 * kKeyboardSpacingW + kKeyboardSpacingB, kKeyboardY, kGb, &KeyBlack); Keys[7] = new ISwitchControl(this, kKeyboardX + 4 * kKeyboardSpacingW, kKeyboardY, kG, &KeyG); Keys[8] = new ISwitchControl(this, kKeyboardX + 4 * kKeyboardSpacingW + kKeyboardSpacingB, kKeyboardY, kAb, &KeyBlack); Keys[9] = new ISwitchControl(this, kKeyboardX + 5 * kKeyboardSpacingW, kKeyboardY, kA, &KeyA); Keys[10] = new ISwitchControl(this, kKeyboardX + 5 * kKeyboardSpacingW + kKeyboardSpacingB, kKeyboardY, kBb, &KeyBlack); Keys[11] = new ISwitchControl(this, kKeyboardX + 6 * kKeyboardSpacingW, kKeyboardY, kB, &KeyB); for (int i=0; i<12; i++) { pGraphics->AttachControl(Keys[i]); } pGraphics->AttachBackground(BACKGROUND_ID, BACKGROUND_FN); IText caption = IText(14, &COLOR_WHITE, "Futura", IText::kStyleNormal, IText::kAlignCenter); IText label = IText(14, &COLOR_WHITE, "Futura", IText::kStyleNormal, IText::kAlignNear); IText title = IText(16, &COLOR_WHITE, "Futura", IText::kStyleNormal, IText::kAlignCenter); mRootControl = new IPopUpMenuControl(this, IRECT(110, 140, 149, 155), LIGHT_GRAY, COLOR_WHITE, LIGHT_YELLOW, kRoot); mScaleControl = new IPopUpMenuControl(this, IRECT(197, 140, 300, 155), LIGHT_GRAY, COLOR_WHITE, LIGHT_YELLOW, kScale); pGraphics->AttachControl(mRootControl); pGraphics->AttachControl(mScaleControl); pGraphics->AttachControl(new ITextControl(this, IRECT(77, 141, 110, 154), &label, "Root:")); pGraphics->AttachControl(new ITextControl(this, IRECT(160, 141, 197, 154), &label, "Scale:")); //pGraphics->AttachControl(new IKnobMultiControl(this, kKnob1X, kKnobsY, kShift, &Knob)); //pGraphics->AttachControl(new IKnobMultiControl(this, kKnob2X, kKnobsY, kTune, &Knob)); //pGraphics->AttachControl(new IKnobMultiControl(this, kKnob3X, kKnobsY, kAmount, &Knob)); //pGraphics->AttachControl(new IKnobMultiControl(this, kKnob4X, kKnobsY, kGlide, &Knob)); pGraphics->AttachControl(new IKnobMultiControlCaption(this, IRECT(kKnob1X, kKnobsY, kKnob1X+83, kKnobsY+90), kShift, &Knob, &caption, true)); pGraphics->AttachControl(new IKnobMultiControlCaption(this, IRECT(kKnob2X, kKnobsY, kKnob2X+83, kKnobsY+90), kTune, &Knob, &caption, true)); pGraphics->AttachControl(new IKnobMultiControlCaption(this, IRECT(kKnob3X, kKnobsY, kKnob3X+83, kKnobsY+90), kGlide, &Knob, &caption, true)); pGraphics->AttachControl(new IKnobMultiControlCaption(this, IRECT(kKnob4X, kKnobsY, kKnob4X+83, kKnobsY+90), kAmount, &Knob, &caption, true)); pGraphics->AttachControl(new ITextControl(this, IRECT(kKnob1X, kTitlesY, kKnob1X+83, kKnobsY+5), &title, "Transpose")); pGraphics->AttachControl(new ITextControl(this, IRECT(kKnob2X, kTitlesY, kKnob2X+83, kKnobsY+5), &title, "Fine Tune")); pGraphics->AttachControl(new ITextControl(this, IRECT(kKnob3X, kTitlesY, kKnob3X+83, kKnobsY+5), &title, "Glide")); pGraphics->AttachControl(new ITextControl(this, IRECT(kKnob4X, kTitlesY, kKnob4X+83, kKnobsY+5), &title, "Amount")); IText versionText = IText(10, &LIGHTER_GRAY, "Futura", IText::kStyleNormal, IText::kAlignNear); pGraphics->AttachControl(new ITextControl(this, IRECT(178, 330, 220, 340), &versionText, version)); AttachGraphics(pGraphics); //MakePreset("preset 1", ... ); }
ATKTransientSplitter::ATKTransientSplitter(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), inFilter(nullptr, 1, 0, false), gainSwellFilter(1, 256*1024), applyGainFilter(2), outTransientFilter(nullptr, 1, 0, false), outSustainFilter(nullptr, 1, 0, false) { TRACE; //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kPower)->InitDouble("Power", 10., 0., 100.0, 0.1, "ms"); GetParam(kPower)->SetShape(2.); GetParam(kAttack)->InitDouble("Attack", 10., 1., 100.0, 0.1, "ms"); GetParam(kAttack)->SetShape(2.); GetParam(kAttackRatio)->InitDouble("Attack Ratio", 10., 0.1, 100.0, 0.1, "%"); GetParam(kRelease)->InitDouble("Release", 10, 1., 100.0, 0.1, "ms"); GetParam(kRelease)->SetShape(2.); GetParam(kReleaseRatio)->InitDouble("Release Ratio", 100, 0.1, 100.0, 0.1, "%"); GetParam(kThreshold)->InitDouble("Threshold", -30., -60., -20.0, 0.1, "dB"); // threshold is actually power GetParam(kSlope)->InitDouble("Slope", 2., 1, 10, .1, "-"); GetParam(kSlope)->SetShape(2.); GetParam(kSoftness)->InitDouble("Softness", -2, -4, 0, 0.1, "-"); GetParam(kSoftness)->SetShape(2.); IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); pGraphics->AttachBackground(COLORED_COMPRESSOR_ID, COLORED_COMPRESSOR_FN); IBitmap knob = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, kKnobFrames); IColor color = IColor(255, 255, 255, 255); IText text = IText(10, &color, nullptr, IText::kStyleBold); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kPowerX, kPowerY, kPowerX + 78, kPowerY + 78 + 21), kPower, &knob, &text, "ms")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kAttackX, kAttackY, kAttackX + 78, kAttackY + 78 + 21), kAttack, &knob, &text, "ms")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kAttackRatioX, kAttackRatioY, kAttackRatioX + 78, kAttackRatioY + 78 + 21), kAttackRatio, &knob, &text, "%")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kReleaseX, kReleaseY, kReleaseX + 78, kReleaseY + 78 + 21), kRelease, &knob, &text, "ms")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kReleaseRatioX, kReleaseRatioY, kReleaseRatioX + 78, kReleaseRatioY + 78 + 21), kReleaseRatio, &knob, &text, "%")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kThresholdX, kThresholdY, kThresholdX + 78, kThresholdY + 78 + 21), kThreshold, &knob, &text, "dB")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kSlopeX, kSlopeY, kSlopeX + 78, kSlopeY + 78 + 21), kSlope, &knob, &text, "")); pGraphics->AttachControl(new IKnobMultiControl(this, kSoftnessX, kSoftnessY, kSoftness, &knob)); AttachGraphics(pGraphics); //MakePreset("preset 1", ... ); MakePreset("Serial Shaper", 10., 10., 10., 10., 100., -30., 2., -2.); MakePreset("Parallel Shaper", 10., 10., 10., 10., 100., -30., 2., -2.); powerFilter.set_input_port(0, &inFilter, 0); slowAttackReleaseFilter.set_input_port(0, &powerFilter, 0); fastAttackReleaseFilter.set_input_port(0, &powerFilter, 0); invertFilter.set_input_port(0, &slowAttackReleaseFilter, 0); sumFilter.set_input_port(0, &invertFilter, 0); sumFilter.set_input_port(1, &fastAttackReleaseFilter, 0); gainSwellFilter.set_input_port(0, &sumFilter, 0); oneMinusFilter.set_input_port(0, &gainSwellFilter, 0); applyGainFilter.set_input_port(0, &gainSwellFilter, 0); applyGainFilter.set_input_port(1, &inFilter, 0); applyGainFilter.set_input_port(2, &oneMinusFilter, 0); applyGainFilter.set_input_port(3, &inFilter, 0); outTransientFilter.set_input_port(0, &applyGainFilter, 1); outSustainFilter.set_input_port(0, &applyGainFilter, 0); invertFilter.set_volume(-1); sinkFilter.add_filter(&outTransientFilter); sinkFilter.add_filter(&outSustainFilter); Reset(); }