Beispiel #1
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);
}
IPlugVST3Plugin::IPlugVST3Plugin(IPlugInstanceInfo instanceInfo,
                     int nParams,
                     const char* channelIOStr,
                     int nPresets,
                     const char* effectName,
                     const char* productName,
                     const char* mfrName,
                     int vendorVersion,
                     int uniqueID,
                     int mfrID,
                     int latency,
                     bool plugDoesMidi,
                     bool plugDoesChunks,
                     bool plugIsInst,
                     int plugScChans)
  : IPlugBase(nParams,
              channelIOStr,
              nPresets,
              effectName,
              productName,
              mfrName,
              vendorVersion,
              uniqueID,
              mfrID,
              latency,
              plugDoesMidi,
              plugDoesChunks,
              plugIsInst,
              kAPIVST3)
  , mScChans(plugScChans)
  , mSidechainActive(false)
{
  SetInputChannelConnections(0, NInChannels(), true);
  SetOutputChannelConnections(0, NOutChannels(), true);
  
  if (NInChannels()) 
  {
    mDelay = new NChanDelayLine(NInChannels(), NOutChannels());
    mDelay->SetDelayTime(latency);
  }

  // initialize the bus labels
  SetInputBusLabel(0, "Main Input");

  if (mScChans)
  {
    SetInputBusLabel(1, "Aux Input");
  }

  if (IsInst())
  {
    int busNum = 0;
    char label[32];

    for (int i = 0; i < NOutChannels(); i+=2) // stereo buses only
    {
      sprintf(label, "Output %i", busNum+1);
      SetOutputBusLabel(busNum++, label);
    }
  }
  else
  {
    SetOutputBusLabel(0, "Output");
  }
}