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