Esempio n. 1
0
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());
}
Esempio n. 2
0
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);
}