Esempio n. 1
0
//-----------------------------------------------------------------------------------
bool TutorialEditor::open (void* ptr)
{
	//-- first we create the frame with a size of 300, 300 and set the background to white
	CRect frameSize (0, 0, 300, 300);
	CFrame* newFrame = new CFrame (frameSize, ptr, this);
	newFrame->setBackgroundColor (kWhiteCColor);

	//-- load some bitmaps we need
	CBitmap* background = new CBitmap ("KnobBackground.png");
	CBitmap* handle = new CBitmap ("KnobHandle.png");
	CBitmap* handleHighlight = new CBitmap ("KnobHandleHighlight.png");

	//-- creating a knob and adding it to the frame
	CRect r (0, 0, background->getWidth (), background->getHeight ());
	CKnob* knob1 = new MyKnob (r, this, kLeftVolumeParameter, background, handle, handleHighlight);
	newFrame->addView (knob1);

	//-- creating another knob, we are offsetting the rect, so that the knob is next to the previous knob
	r.offset (background->getWidth () + 5, 0);
	CKnob* knob2 = new MyKnob (r, this, kRightVolumeParameter, background, handle, handleHighlight);
	newFrame->addView (knob2);

	//-- forget the bitmaps
	background->forget ();
	handle->forget ();

	//-- remember our controls so that we can sync them with the state of the effect
	controls[kLeftVolumeParameter] = knob1;
	controls[kRightVolumeParameter] = knob2;

	//-- set the member frame to our frame
	frame = newFrame;

	//-- sync parameters
	for (int i = 0; i < kNumParameters; i++)
		setParameter (i, effect->getParameter (i));
	return true;
}
Esempio n. 2
0
//
//								open
//
bool SDEditor::open (void *ptr)
{
	// !!! always call this !!!
	AEffGUIEditor::open (ptr);
	
	//--load some bitmaps
	CBitmap* hFaderBody   = new CBitmap (kFaderBodyId);
	CBitmap* hFaderHandle = new CBitmap (kFaderHandleId);

	//--init background frame-----------------------------------------------
	// We use a local CFrame object so that calls to setParameter won't call into objects which may not exist yet. 
	// If all GUI objects are created we assign our class member to this one. See bottom of this method.
	CRect size (0, 0, hBackground->getWidth (), hBackground->getHeight ());
	CFrame* lFrame = new CFrame (size, ptr, this);
	lFrame->setBackground (hBackground);

	//--init the faders------------------------------------------------
	int minPos = kFaderY;
	int maxPos = kFaderY + hFaderBody->getHeight () - hFaderHandle->getHeight () - 1;
	CPoint point (0, 0);
	CPoint offset (1, 0);

	// fine pitch
	size (kFaderX, kFaderY,
          kFaderX + hFaderBody->getWidth (), kFaderY + hFaderBody->getHeight ());
	finePitchFader = new CVerticalSlider (size, this, kFinePitch, minPos, maxPos, hFaderHandle, hFaderBody, point);
	finePitchFader->setOffsetHandle (offset);
	finePitchFader->setValue (effect->getParameter (kFinePitch));
	lFrame->addView (finePitchFader);

	// delay
	size.offset (kFaderInc + hFaderBody->getWidth (), 0);
	delayFader = new CVerticalSlider (size, this, kDelay, minPos, maxPos, hFaderHandle, hFaderBody, point);
	delayFader->setOffsetHandle (offset);
	delayFader->setValue (effect->getParameter (kDelay));
	lFrame->addView (delayFader);

	// feedback
	size.offset (kFaderInc + hFaderBody->getWidth (), 0);
	feedbackFader = new CVerticalSlider (size, this, kFeedback, minPos, maxPos, hFaderHandle, hFaderBody, point);
	feedbackFader->setOffsetHandle (offset);
	feedbackFader->setValue (effect->getParameter (kFeedback));
	lFrame->addView (feedbackFader);

	// Coarse pitch shift in steps
	size (kSelectX, kSelectY,
          kSelectX + kSelectWidth, kSelectY + kSelectHeight);
	coarsePitchOption = new COptionMenu(size, this, kCoarsePitch);
	coarsePitchOption->addEntry("+12");
	coarsePitchOption->addEntry("+11");
	coarsePitchOption->addEntry("+10");
	coarsePitchOption->addEntry("+9");
	coarsePitchOption->addEntry("+8");
	coarsePitchOption->addEntry("+7");
	coarsePitchOption->addEntry("+6");
	coarsePitchOption->addEntry("+5");
	coarsePitchOption->addEntry("+4");
	coarsePitchOption->addEntry("+3");
	coarsePitchOption->addEntry("+2");
	coarsePitchOption->addEntry("+1");
	coarsePitchOption->addEntry("0");
	coarsePitchOption->addEntry("-1");
	coarsePitchOption->addEntry("-2");
	coarsePitchOption->addEntry("-3");
	coarsePitchOption->addEntry("-4");
	coarsePitchOption->addEntry("-5");
	coarsePitchOption->addEntry("-6");
	coarsePitchOption->addEntry("-7");
	coarsePitchOption->addEntry("-8");
	coarsePitchOption->addEntry("-9");
	coarsePitchOption->addEntry("-10");
	coarsePitchOption->addEntry("-11");
	coarsePitchOption->addEntry("-12");
	coarsePitchOption->setCurrent(ROUND((effect->getParameter(kCoarsePitch)*NUM_PITCHES)));
	lFrame->addView (coarsePitchOption);

	// Mix mode
	size.offset( 0, kSelectInc );
	mixOption = new COptionMenu(size, this, kMixMode);
	mixOption->addEntry("mono");
	mixOption->addEntry("wet only");
	mixOption->addEntry("wet left");
	mixOption->addEntry("wet right");
	mixOption->addEntry("wet part left");
	mixOption->addEntry("wet part right");
	mixOption->addEntry("stereo");
	mixOption->setCurrent((int)(effect->getParameter(kMixMode)*NUM_MIX_MODES));
	lFrame->addView (mixOption);

	// Note : in the constructor of a CBitmap, the number of references is set to 1.
	// Then, each time the bitmap is used (for hinstance in a vertical slider), this
	// number is incremented.
	// As a consequence, everything happens as if the constructor by itself was adding
	// a reference. That's why we need til here a call to forget ().
	// You mustn't call delete here directly, because the bitmap is used by some CControls...
	// These "rules" apply to the other VSTGUI objects too.
	hFaderBody->forget ();
	hFaderHandle->forget ();

	frame = lFrame;
	return true;
}
Esempio n. 3
0
//
//								open
//
bool SDEditor::open (void *ptr)
{
	// !!! always call this !!!
	AEffGUIEditor::open (ptr);
	
	//--load some bitmaps
	CBitmap* hFaderBody   = new CBitmap (kFaderBodyId);
	CBitmap* hFaderHandle = new CBitmap (kFaderHandleId);

	//--init background frame-----------------------------------------------
	// We use a local CFrame object so that calls to setParameter won't call into objects which may not exist yet. 
	// If all GUI objects are created we assign our class member to this one. See bottom of this method.
	CRect size (0, 0, hBackground->getWidth (), hBackground->getHeight ());
	CFrame* lFrame = new CFrame (size, ptr, this);
	lFrame->setBackground (hBackground);

	//--init the faders------------------------------------------------
	int minPos = kFaderY;
	int maxPos = kFaderY + hFaderBody->getHeight () - hFaderHandle->getHeight () - 1;
	CPoint point (0, 0);
	CPoint offset (1, 0);

	// Rate
	size (kFaderX, kFaderY,
          kFaderX + hFaderBody->getWidth (), kFaderY + hFaderBody->getHeight ());
	rateFader = new CVerticalSlider (size, this, kRate, minPos, maxPos, hFaderHandle, hFaderBody, point);
	rateFader->setOffsetHandle (offset);
	rateFader->setValue (effect->getParameter (kRate));
	lFrame->addView (rateFader);

	// Width
	size.offset (kFaderInc + hFaderBody->getWidth (), 0);
	widthFader = new CVerticalSlider (size, this, kWidth, minPos, maxPos, hFaderHandle, hFaderBody, point);
	widthFader->setOffsetHandle (offset);
	widthFader->setValue (effect->getParameter (kWidth));
	lFrame->addView (widthFader);

	// Feedback
	//size.offset (kFaderInc + hFaderBody->getWidth (), 0);
	//feedbackFader = new CVerticalSlider (size, this, kFeedback, minPos, maxPos, hFaderHandle, hFaderBody, point);
	//feedbackFader->setOffsetHandle (offset);
	//feedbackFader->setValue (effect->getParameter (kFeedback));
	//lFrame->addView (feedbackFader);

	// Stages
	size (kSelectX, kSelectY,
          kSelectX + kSelectWidth, kSelectY + kSelectHeight);
	delayOption = new COptionMenu(size, this, kDelay);
	delayOption->addEntry("1 ms");
	delayOption->addEntry("1.2 ms");
	delayOption->addEntry("2.5 ms");
	delayOption->addEntry("4 ms");
	delayOption->addEntry("6.3 ms");
	delayOption->addEntry("10 ms");
	delayOption->addEntry("12 ms");
	delayOption->addEntry("25 ms");
	delayOption->addEntry("40 ms");
	delayOption->addEntry("63 ms");
	delayOption->addEntry("100 ms");
	delayOption->setCurrent(ROUND((effect->getParameter(kDelay)*NUM_DELAYS)));
	lFrame->addView (delayOption);

	// Mix mode
	size.offset( 0, kSelectInc );
	mixOption = new COptionMenu(size, this, kMixMode);
	mixOption->addEntry("normal");
	mixOption->addEntry("wet only");
	mixOption->addEntry("wet left");
	mixOption->addEntry("wet right");
	mixOption->addEntry("wet left 75%");
	mixOption->addEntry("wet right 75%");
	mixOption->addEntry("stereo");
	mixOption->setCurrent((int)(effect->getParameter(kMixMode)*NUM_MIX_MODES));
	lFrame->addView (mixOption);

	// Note : in the constructor of a CBitmap, the number of references is set to 1.
	// Then, each time the bitmap is used (for hinstance in a vertical slider), this
	// number is incremented.
	// As a consequence, everything happens as if the constructor by itself was adding
	// a reference. That's why we need til here a call to forget ().
	// You mustn't call delete here directly, because the bitmap is used by some CControls...
	// These "rules" apply to the other VSTGUI objects too.
	hFaderBody->forget ();
	hFaderHandle->forget ();

	frame = lFrame;
	return true;
}
Esempio n. 4
0
bool GuiEditor::open (void *ptr)
{
	AEffGUIEditor::open (ptr);
	CRect size (rect.left , rect.top, rect.right, rect.bottom);


	CBitmap* hHFaderBody   = new CBitmap (kHFaderBodyId);
	CBitmap* hHFaderHandle = new CBitmap (kHFaderHandleId);



	CFrame* lFrame = new CFrame(size, ptr, this);
	//lFrame->setBackgroundColor(kGreyCColor);

	int middle = 150;

	size(0,0,dWidth,middle);

	CViewContainer* graphicsView = new CViewContainer(size, lFrame);
	graphicsView->setBackgroundColor(kBlackCColor);

	lFrame->addView(graphicsView);

	size(0,middle,dWidth,dBottom);
	CViewContainer* controlsView = new CViewContainer(size, lFrame);
	controlsView->setBackgroundColor(kGreyCColor);

	lFrame->addView(controlsView);


	size(0,0,700,150);
	mySpectrumView = new SpectrumView(size,effect);
	graphicsView->addView(mySpectrumView);


	int left, top, right, bottom, minPos, maxPos;

	//------------------------------------------------------------------------------
	left = 20;
	top = 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* bufferLabel = new CTextLabel(size,"BufferSize");
	bufferLabel->setFont (kNormalFontSmall);
	bufferLabel->setFontColor (kWhiteCColor);
	bufferLabel->setBackColor (kBlackCColor);
	bufferLabel->setFrameColor (kBlackCColor);
	controlsView->addView(bufferLabel);

	//------------------------------------------------------------------------------
	left = right + 10;
	top = 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	bufferMenu = new COptionMenu(size, this,kBufferSize);
	bufferMenu->setFont (kNormalFontSmall);
	bufferMenu->setFontColor (kWhiteCColor);
	bufferMenu->setBackColor (kBlackCColor);
	bufferMenu->setFrameColor (kWhiteCColor);

	bufferMenu->addEntry("512",0);
	bufferMenu->addEntry("1024",1);
	bufferMenu->addEntry("2048",2);
	bufferMenu->addEntry("4096",3);
	bufferMenu->addEntry("8192",4);
	bufferMenu->setCurrent(3);

	controlsView->addView(bufferMenu);

	//----------------------------------------------------------------------------

	left = right + 10;
	right = left + 60;


		size(left, top, right, bottom);
	CTextLabel* displayLabel = new CTextLabel(size,"Display");
	displayLabel->setFont (kNormalFontSmall);
	displayLabel->setFontColor (kWhiteCColor);
	displayLabel->setBackColor (kBlackCColor);
	displayLabel->setFrameColor (kBlackCColor);
	controlsView->addView(displayLabel);


	left = right + 10;
	right = left + 50;

	size(left, top, right, bottom);
	displayMenu = new COptionMenu(size, this,kDisplay);
	displayMenu->setFont (kNormalFontSmall);
	displayMenu->setFontColor (kWhiteCColor);
	displayMenu->setBackColor (kBlackCColor);
	displayMenu->setFrameColor (kWhiteCColor);

	displayMenu->addEntry("Bands",0);
	displayMenu->addEntry("Lines",1);
	displayMenu->setCurrent(0);

	controlsView->addView(displayMenu);


	//------------------------------------------------------------------------------

	left = 20;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* gainLabel = new CTextLabel(size,"Gain");
	gainLabel->setFont (kNormalFontSmall);
	gainLabel->setFontColor (kWhiteCColor);
	gainLabel->setBackColor (kBlackCColor);
	gainLabel->setFrameColor (kBlackCColor);
	controlsView->addView(gainLabel);

	left = right + 10;
	right = left + hHFaderBody->getWidth ();
	bottom = top + hHFaderBody->getHeight ();

	minPos = left;
	maxPos = right - hHFaderHandle->getWidth () - 1;
	CPoint point (0, 0);

	size (left, top, right, bottom);
	gainFader = new CHorizontalSlider (size, this, kGain, minPos, maxPos, hHFaderHandle, hHFaderBody, point, kLeft);
	controlsView->addView(gainFader);

	left = right + 10;
	right = left + 30;
	

	size (left, top, right, bottom);
	gainDisplay = new CTextEdit(size, this, kGainText, "0");
	gainDisplay->setFont (kNormalFontSmall);
	gainDisplay->setFontColor (kWhiteCColor);
	gainDisplay->setBackColor (kBlackCColor);
	gainDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (gainDisplay);

	//---------------------------------------------------------------------------
	
	left = 20;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* responseLabel = new CTextLabel(size,"Response");
	responseLabel->setFont (kNormalFontSmall);
	responseLabel->setFontColor (kWhiteCColor);
	responseLabel->setBackColor (kBlackCColor);
	responseLabel->setFrameColor (kBlackCColor);
	controlsView->addView(responseLabel);

	left = right + 10;
	right = left + hHFaderBody->getWidth ();
	bottom = top + hHFaderBody->getHeight ();

	minPos = left;
	maxPos = right - hHFaderHandle->getWidth () - 1;
	point (0, 0);

	size (left, top, right, bottom);
	responseFader = new CHorizontalSlider (size, this, kResponse, minPos, maxPos, hHFaderHandle, hHFaderBody, point, kLeft);
	controlsView->addView(responseFader);

	left = right + 10;
	right = left + 30;
	

	size (left, top, right, bottom);
	responseDisplay = new CTextEdit (size, this, kResponseText, "0");
	responseDisplay->setFont (kNormalFontSmall);
	responseDisplay->setFontColor (kWhiteCColor);
	responseDisplay->setBackColor (kBlackCColor);
	responseDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (responseDisplay);


	//---------------------------------------------------------------------------
	left = 20;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

		size(left, top, right, bottom);
	CTextLabel* bandsLabel = new CTextLabel(size,"Bands");
	bandsLabel->setFont (kNormalFontSmall);
	bandsLabel->setFontColor (kWhiteCColor);
	bandsLabel->setBackColor (kBlackCColor);
	bandsLabel->setFrameColor (kBlackCColor);
	controlsView->addView(bandsLabel);

	left = right + 10;
	right = left + hHFaderBody->getWidth ();
	bottom = top + hHFaderBody->getHeight ();

	minPos = left;
	maxPos = right - hHFaderHandle->getWidth () - 1;
	point (0, 0);

	size (left, top, right, bottom);
	bandsFader = new CHorizontalSlider(size, this, kBands, minPos, maxPos, hHFaderHandle, hHFaderBody, point, kLeft);
	controlsView->addView(bandsFader);
	bandsFader->setValue(0.5);

	left = right + 10;
	right = left + 30;
	

	size (left, top, right, bottom);
	bandsDisplay = new CTextEdit (size, this, kBandsText, "32");
	bandsDisplay->setFont (kNormalFontSmall);
	bandsDisplay->setFontColor (kWhiteCColor);
	bandsDisplay->setBackColor (kBlackCColor);
	bandsDisplay->setFrameColor (kWhiteCColor);
	//bandsDisplay->setStringConvert(bandsStringConvert);
	controlsView->addView (bandsDisplay);


	//---------------------------------------------------------------------------
	int left2 = right + 40;
	left = left2;
	top = 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* ampScaleLabel = new CTextLabel(size,"Amp Scale");
	ampScaleLabel->setFont (kNormalFontSmall);
	ampScaleLabel->setFontColor (kWhiteCColor);
	ampScaleLabel->setBackColor (kBlackCColor);
	ampScaleLabel->setFrameColor (kBlackCColor);
	controlsView->addView(ampScaleLabel);


	left = right + 10;
	right = left + 70;

	size(left, top, right, bottom);
	ampScaleMenu = new COptionMenu(size, this,kAmpScale);
	ampScaleMenu->setFont (kNormalFontSmall);
	ampScaleMenu->setFontColor (kWhiteCColor);
	ampScaleMenu->setBackColor (kBlackCColor);
	ampScaleMenu->setFrameColor (kWhiteCColor);

	ampScaleMenu->addEntry("No Scaling",0);
	ampScaleMenu->addEntry("Log",1);
	ampScaleMenu->setCurrent(1);

	controlsView->addView(ampScaleMenu);


	//------------------------------------------------------------------------------

	left = left2;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

		size(left, top, right, bottom);
	CTextLabel* freqScaleLabel = new CTextLabel(size,"Freq Scale");
	freqScaleLabel->setFont (kNormalFontSmall);
	freqScaleLabel->setFontColor (kWhiteCColor);
	freqScaleLabel->setBackColor (kBlackCColor);
	freqScaleLabel->setFrameColor (kBlackCColor);
	controlsView->addView(freqScaleLabel);

	left = right +10;
	right = left + 70;

	size(left, top, right, bottom);
	freqScaleMenu = new COptionMenu(size, this,kFreqScale);
	freqScaleMenu->setFont (kNormalFontSmall);
	freqScaleMenu->setFontColor (kWhiteCColor);
	freqScaleMenu->setBackColor (kBlackCColor);
	freqScaleMenu->setFrameColor (kWhiteCColor);

	freqScaleMenu->addEntry("No Scaling",0);
	freqScaleMenu->addEntry("Log",1);
	freqScaleMenu->setCurrent(1);

	controlsView->addView(freqScaleMenu);

	


	//------------------------------------------------------------------------------

		left = left2;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

		size(left, top, right, bottom);
	CTextLabel* resamplingLabel = new CTextLabel(size,"Resampling");
	resamplingLabel->setFont (kNormalFontSmall);
	resamplingLabel->setFontColor (kWhiteCColor);
	resamplingLabel->setBackColor (kBlackCColor);
	resamplingLabel->setFrameColor (kBlackCColor);
	controlsView->addView(resamplingLabel);

	left = right +10;
	right = left + 70;

	size(left, top, right, bottom);
	resamplingMenu = new COptionMenu(size, this,kResampling);
	resamplingMenu->setFont (kNormalFontSmall);
	resamplingMenu->setFontColor (kWhiteCColor);
	resamplingMenu->setBackColor (kBlackCColor);
	resamplingMenu->setFrameColor (kWhiteCColor);

	resamplingMenu->addEntry("Decim",0);
	resamplingMenu->addEntry("Sum",1);
	resamplingMenu->setCurrent(0);

	controlsView->addView(resamplingMenu);

	
	//------------------------------------------------------------------------------

	left = left2;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* xScaleLabel = new CTextLabel(size,"X Scale");
	xScaleLabel->setFont (kNormalFontSmall);
	xScaleLabel->setFontColor (kWhiteCColor);
	xScaleLabel->setBackColor (kBlackCColor);
	xScaleLabel->setFrameColor (kBlackCColor);
	controlsView->addView(xScaleLabel);

	left = right + 10;
	right = left + hHFaderBody->getWidth ();
	bottom = top + hHFaderBody->getHeight ();

	minPos = left;
	maxPos = right - hHFaderHandle->getWidth () - 1;
	point (0, 0);

	size (left, top, right, bottom);
	xScaleFader = new CHorizontalSlider (size, this, kXScale, minPos, maxPos, hHFaderHandle, hHFaderBody, point, kLeft);
	controlsView->addView(xScaleFader);

	left = right + 10;
	right = left + 30;
	

	size (left, top, right, bottom);
	xScaleDisplay = new CTextEdit (size, this, kXScaleText, "0");
	xScaleDisplay->setFont (kNormalFontSmall);
	xScaleDisplay->setFontColor (kWhiteCColor);
	xScaleDisplay->setBackColor (kBlackCColor);
	xScaleDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (xScaleDisplay);


	//---------------------------------------------------------------------------

		left = left2;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* yScaleLabel = new CTextLabel(size,"Y Scale");
	yScaleLabel->setFont (kNormalFontSmall);
	yScaleLabel->setFontColor (kWhiteCColor);
	yScaleLabel->setBackColor (kBlackCColor);
	yScaleLabel->setFrameColor (kBlackCColor);
	controlsView->addView(yScaleLabel);

	left = right + 10;
	right = left + hHFaderBody->getWidth ();
	bottom = top + hHFaderBody->getHeight ();

	minPos = left;
	maxPos = right - hHFaderHandle->getWidth () - 1;
	point (0, 0);

	size (left, top, right, bottom);
	yScaleFader = new CHorizontalSlider (size, this, kYScale, minPos, maxPos, hHFaderHandle, hHFaderBody, point, kLeft);
	controlsView->addView(yScaleFader);

	left = right + 10;
	right = left + 30;
	

	size (left, top, right, bottom);
	yScaleDisplay = new CTextEdit (size, this, kYScaleText, "0");
	yScaleDisplay->setFont (kNormalFontSmall);
	yScaleDisplay->setFontColor (kWhiteCColor);
	yScaleDisplay->setBackColor (kBlackCColor);
	yScaleDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (yScaleDisplay);


	//---------------------------------------------------------------------------

	int left3 = right + 40;
	left = left3;
	top = 10;
	right = left + 70;
	bottom = top + 16;

	
		size(left, top, right, bottom);
	CTextLabel* typeLabel = new CTextLabel(size,"Type");
	typeLabel->setFont (kNormalFontSmall);
	typeLabel->setFontColor (kWhiteCColor);
	typeLabel->setBackColor (kBlackCColor);
	typeLabel->setFrameColor (kBlackCColor);
	controlsView->addView(typeLabel);


	left = right + 10;
	right = left + 70;

	size(left, top, right, bottom);
	typeMenu = new COptionMenu(size, this,kType);
	typeMenu->setFont (kNormalFontSmall);
	typeMenu->setFontColor (kWhiteCColor);
	typeMenu->setBackColor (kBlackCColor);
	typeMenu->setFrameColor (kWhiteCColor);

	typeMenu->addEntry("FFT Mono",0);
	typeMenu->addEntry("FFT Average",1);
	typeMenu->addEntry("Filtersbank",2);
	typeMenu->addEntry("Levels",3);
	typeMenu->setCurrent(0);

	controlsView->addView(typeMenu);

	//--------------------------------------------------------------------


	left = left3;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* addressLabel = new CTextLabel(size,"Adress");
	addressLabel->setFont (kNormalFontSmall);
	addressLabel->setFontColor (kWhiteCColor);
	addressLabel->setBackColor (kBlackCColor);
	addressLabel->setFrameColor (kBlackCColor);
	controlsView->addView(addressLabel);

	left = right +10;
	right = left + 70;

	size (left, top, right, bottom);
	addressDisplay = new CTextEdit(size, this, kAddress, "out1");
	addressDisplay->setFont (kNormalFontSmall);
	addressDisplay->setFontColor (kWhiteCColor);
	addressDisplay->setBackColor (kBlackCColor);
	addressDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (addressDisplay);

	//------------------------------------------------------------------------------

	left = left3;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* portLabel = new CTextLabel(size,"Port");
	portLabel->setFont (kNormalFontSmall);
	portLabel->setFontColor (kWhiteCColor);
	portLabel->setBackColor (kBlackCColor);
	portLabel->setFrameColor (kBlackCColor);
	controlsView->addView(portLabel);

	left = right +10;
	right = left + 70;

	size (left, top, right, bottom);
	portDisplay = new CTextEdit (size, this, kPort, "12000");
	portDisplay->setFont (kNormalFontSmall);
	portDisplay->setFontColor (kWhiteCColor);
	portDisplay->setBackColor (kBlackCColor);
	portDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (portDisplay);

	//------------------------------------------------------------------------------

	left = left3;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* hostLabel = new CTextLabel(size,"host");
	hostLabel->setFont (kNormalFontSmall);
	hostLabel->setFontColor (kWhiteCColor);
	hostLabel->setBackColor (kBlackCColor);
	hostLabel->setFrameColor (kBlackCColor);
	controlsView->addView(hostLabel);

	left = right +10;
	right = left + 70;

	size (left, top, right, bottom);
	hostDisplay = new CTextEdit (size, this, kHost, "localhost");
	hostDisplay->setFont (kNormalFontSmall);
	hostDisplay->setFontColor (kWhiteCColor);
	hostDisplay->setBackColor (kBlackCColor);
	hostDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (hostDisplay);

	//------------------------------------------------------------------------------


	hHFaderBody->forget ();
	hHFaderHandle->forget ();

	opened = true;

	updateDisplay();

	this->frame = lFrame;


	start();


	return true;
}
Esempio n. 5
0
//-----------------------------------------------------------------------------
bool SDEditor::open (void *ptr)
{
	// !!! always call this !!!
	AEffGUIEditor::open (ptr);
	
	//--load some bitmaps
	CBitmap* hFaderBody   = new CBitmap (kFaderBodyId);
	CBitmap* hFaderHandle = new CBitmap (kFaderHandleId);

	//--init background frame-----------------------------------------------
	// We use a local CFrame object so that calls to setParameter won't call into objects which may not exist yet. 
	// If all GUI objects are created we assign our class member to this one. See bottom of this method.
	CRect size (0, 0, hBackground->getWidth (), hBackground->getHeight ());
	CFrame* lFrame = new CFrame (size, ptr, this);
	lFrame->setBackground (hBackground);

	//--init the faders------------------------------------------------
	int minPos = kFaderY;
	int maxPos = kFaderY + hFaderBody->getHeight () - hFaderHandle->getHeight () - 1;
	CPoint point (0, 0);
	CPoint offset (1, 0);

	// Delay
	size (kFaderX, kFaderY,
          kFaderX + hFaderBody->getWidth (), kFaderY + hFaderBody->getHeight ());
	delayFader = new CVerticalSlider (size, this, kDelay, minPos, maxPos, hFaderHandle, hFaderBody, point);
	delayFader->setOffsetHandle (offset);
	delayFader->setValue (effect->getParameter (kDelay));
	lFrame->addView (delayFader);

	// FeedBack
	size.offset (kFaderInc + hFaderBody->getWidth (), 0);
	feedbackFader = new CVerticalSlider (size, this, kFeedBack, minPos, maxPos, hFaderHandle, hFaderBody, point);
	feedbackFader->setOffsetHandle (offset);
	feedbackFader->setValue (effect->getParameter (kFeedBack));
	lFrame->addView (feedbackFader);

	// Volume
	size.offset (kFaderInc + hFaderBody->getWidth (), 0);
	volumeFader = new CVerticalSlider (size, this, kOut, minPos, maxPos, hFaderHandle, hFaderBody, point);
	volumeFader->setOffsetHandle (offset);
	volumeFader->setValue (effect->getParameter (kOut));
	volumeFader->setDefaultValue (0.75f);
	lFrame->addView (volumeFader);

	//--init the display------------------------------------------------
	// Delay
	size (kDisplayX, kDisplayY,
          kDisplayX + kDisplayXWidth, kDisplayY + kDisplayHeight);
	delayDisplay = new CParamDisplay (size, 0, kCenterText);
	delayDisplay->setFont (kNormalFontSmall);
	delayDisplay->setFontColor (kWhiteCColor);
	delayDisplay->setBackColor (kBlackCColor);
	delayDisplay->setFrameColor (kBlueCColor);
	delayDisplay->setValue (effect->getParameter (kDelay));
	lFrame->addView (delayDisplay);

	// FeedBack
	size.offset (kFaderInc + hFaderBody->getWidth (), 0);
	feedbackDisplay = new CParamDisplay (size, 0, kCenterText);
	feedbackDisplay->setFont (kNormalFontSmall);
	feedbackDisplay->setFontColor (kWhiteCColor);
	feedbackDisplay->setBackColor (kBlackCColor);
	feedbackDisplay->setFrameColor (kBlueCColor);
	feedbackDisplay->setValue (effect->getParameter (kFeedBack));
	feedbackDisplay->setStringConvert (percentStringConvert);
	lFrame->addView (feedbackDisplay);

	// Volume
	size.offset (kFaderInc + hFaderBody->getWidth (), 0);
	volumeDisplay = new CParamDisplay (size, 0, kCenterText);
	volumeDisplay->setFont (kNormalFontSmall);
	volumeDisplay->setFontColor (kWhiteCColor);
	volumeDisplay->setBackColor (kBlackCColor);
	volumeDisplay->setFrameColor (kBlueCColor);
	volumeDisplay->setValue (effect->getParameter (kOut));
	volumeDisplay->setStringConvert (percentStringConvert);
	lFrame->addView (volumeDisplay);


	// Note : in the constructor of a CBitmap, the number of references is set to 1.
	// Then, each time the bitmap is used (for hinstance in a vertical slider), this
	// number is incremented.
	// As a consequence, everything happens as if the constructor by itself was adding
	// a reference. That's why we need til here a call to forget ().
	// You mustn't call delete here directly, because the bitmap is used by some CControls...
	// These "rules" apply to the other VSTGUI objects too.
	hFaderBody->forget ();
	hFaderHandle->forget ();

	frame = lFrame;
	return true;
}