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); }
IPlugConvoEngine::IPlugConvoEngine(IPlugInstanceInfo instanceInfo): IPLUG_CTOR(kNumParams, 0, instanceInfo), #ifdef _USE_R8BRAIN mResampler(NULL), #endif mSampleRate(0) { TRACE; GetParam(kDry)->InitDouble("Dry", 0., 0., 1., 0.001); GetParam(kWet)->InitDouble("Wet", 1., 0., 1., 0.001); IGraphics* pGraphics = MakeGraphics(this, GUI_WIDTH, GUI_HEIGHT); IText textProps(12, &COLOR_BLACK, "Verdana", IText::kStyleNormal, IText::kAlignNear, 0, IText::kQualityNonAntiAliased); GenerateKnobGUI(pGraphics, this, &textProps, &COLOR_WHITE, &COLOR_BLACK, 60, 70); AttachGraphics(pGraphics); }
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); }
IPlugDistortion::IPlugDistortion(IPlugInstanceInfo instanceInfo): IPLUG_CTOR(kNumParams, 0, instanceInfo), mOversampling(8), mDC(0.2) { TRACE; mAntiAlias.Calc(0.5 / (double)mOversampling); mUpsample.Reset(); mDownsample.Reset(); mDistortedDC = fast_tanh(mDC); GetParam(kDrive)->InitDouble("Drive", 0.5, 0., 1., 0.001); IGraphics* pGraphics = MakeGraphics(this, GUI_WIDTH, GUI_HEIGHT); IText textProps(12, &COLOR_BLACK, "Verdana", IText::kStyleNormal, IText::kAlignNear, 0, IText::kQualityNonAntiAliased); GenerateKnobGUI(pGraphics, this, &textProps, &COLOR_WHITE, &COLOR_BLACK, 60, 70); AttachGraphics(pGraphics); }
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); }