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();
}
Beispiel #2
0
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);
}
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", ... );
  
}
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();
}
Beispiel #5
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);
}
Beispiel #6
0
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, &regular, &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);
}
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, &regular, &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();
}
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();
}