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); }
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); }
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); }
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 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); }