示例#1
0
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();
}
void DigitalDistortion::CreatePresets()
{
  MakePreset("clean", 0.0);
  MakePreset("slightly distorted", 20.0);
  MakePreset("woooo", 40.0);
  MakePreset("waaaa", 80.0);
  MakePreset("buzz!!!!", 100.0);
}
void RaspberryJammer::CreatePreset(
        char* pName,
        double pGainL,
        double pGainR,
        double pFilterCutoff,
        double pFilterResonance,
        int pEnvAttack,
        int pEnvDecay,
        double pEnvSustain,
        int pEnvRelease,
        double pLfoRate,
        double pLfoDepth)
{
  MakePreset(
             pName,
             pGainL,
             pGainR,
             pFilterCutoff,
             pFilterResonance,
             pEnvAttack,
             pEnvDecay,
             pEnvSustain,
             pEnvRelease,
             pLfoRate,
             pLfoDepth
  );
}
示例#4
0
文件: Vega.cpp 项目: eriser/VegaVST
void Vega::CreatePresets() {
  MakePreset("clean", 440.0, 0);
}
ATKSideChainCompressor::ATKSideChainCompressor(IPlugInstanceInfo instanceInfo)
  :	IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo),
  inLFilter(nullptr, 1, 0, false), inRFilter(nullptr, 1, 0, false), inSideChainLFilter(nullptr, 1, 0, false), inSideChainRFilter(nullptr, 1, 0, false),
  volumesplitFilter(4), applyGainFilter(2), volumemergeFilter(2), drywetFilter(2), outLFilter(nullptr, 1, 0, false), outRFilter(nullptr, 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, kKnobFrames1);
  IBitmap myswitch = pGraphics->LoadIBitmap(SWITCH_ID, SWITCH_FN, 2);
  IColor color = IColor(255, 255, 255, 255);
  IText text = IText(10, &color, nullptr, IText::kStyleBold);

  pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kAttack1X, kAttack1Y, kAttack1X + 78, kAttack1Y + 78 + 21), kAttack1, &knob, &text, "ms"));
  pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kRelease1X, kRelease1Y, kRelease1X + 78, kRelease1Y + 78 + 21), kRelease1, &knob, &text, "ms"));
  pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kThreshold1X, kThreshold1Y, kThreshold1X + 78, kThreshold1Y + 78 + 21), kThreshold1, &knob, &text, "dB"));
  pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kRatio1X, kRatio1Y, kRatio1X + 78, kRatio1Y + 78 + 21), kRatio1, &knob, &text, ""));
  pGraphics->AttachControl(new IKnobMultiControl(this, kSoftness1X, kSoftness1Y, kSoftness1, &knob));
  pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kMakeup1X, kMakeup1Y, kMakeup1X + 78, kMakeup1Y + 78 + 21), kMakeup1, &knob, &text, "dB"));

  attack2 = new IKnobMultiControlText(this, IRECT(kAttack2X, kAttack2Y, kAttack2X + 78, kAttack2Y + 78 + 21), kAttack2, &knob, &text, "ms");
  pGraphics->AttachControl(attack2);
  release2 = new IKnobMultiControlText(this, IRECT(kRelease2X, kRelease2Y, kRelease2X + 78, kRelease2Y + 78 + 21), kRelease2, &knob, &text, "ms");
  pGraphics->AttachControl(release2);
  threshold2 = new IKnobMultiControlText(this, IRECT(kThreshold2X, kThreshold2Y, kThreshold2X + 78, kThreshold2Y + 78 + 21), kThreshold2, &knob, &text, "dB");
  pGraphics->AttachControl(threshold2);
  ratio2 = new IKnobMultiControlText(this, IRECT(kRatio2X, kRatio2Y, kRatio2X + 78, kRatio2Y + 78 + 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 + 78, kMakeup2Y + 78 + 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", ... );
  MakePreset("Serial compression", false, false, true, true, 10., 10., 0., 2., -2., 0., 10., 10., 0., 2., -2., 0., 0.);
  MakePreset("Middle/side compression", true, false, true, true, 10., 10., 0., 2., -2., 0., 10., 10., 0., 2., -2., 0., 0.);
  MakePreset("Parallel compression", false, false, false, false, 10., 10., 0., 2., -2., 0., 10., 10., 0., 2., -2., 0., 0.5);

  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, &inSideChainLFilter, 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, &inSideChainRFilter, 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);
  sidechainmiddlesidesplitFilter.set_input_port(0, &inSideChainLFilter, 0);
  sidechainmiddlesidesplitFilter.set_input_port(1, &inSideChainRFilter, 0);
  volumesplitFilter.set_input_port(0, &middlesidesplitFilter, 0);
  volumesplitFilter.set_input_port(1, &middlesidesplitFilter, 1);
  volumesplitFilter.set_input_port(2, &sidechainmiddlesidesplitFilter, 0);
  volumesplitFilter.set_input_port(3, &sidechainmiddlesidesplitFilter, 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();
}
示例#6
0
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;
}
示例#7
0
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.
}
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();
}