Пример #1
0
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();
}
Пример #2
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);
}
Пример #3
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());
}
Пример #4
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);
}
Пример #5
0
Synthesis::Synthesis(IPlugInstanceInfo instanceInfo)
	: IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), lastVirtualKeyboardNoteNumber(virtualKeyboardMinimumNoteNumber - 1) {
	TRACE;

	IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight);
	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);

	//							  C#	 D#			 F#		 G#		 A#
	int keyCoordinates[12] = { 0, 7, 12, 20, 24, 36, 43, 48, 56, 60, 69, 72 };
	mVirtualKeyboard = new IKeyboardControl(this, kKeybX, kKeybY, virtualKeyboardMinimumNoteNumber, /* octaves: */ 5, &whiteKeyImage, &blackKeyImage, keyCoordinates);

	pGraphics->AttachControl(mVirtualKeyboard);

	// Waveform switch
	GetParam(mWaveform)->InitEnum("Waveform", OSCILLATOR_MODE_SINE, kNumOscillatorModes);
	GetParam(mWaveform)->SetDisplayText(0, "Sine"); // Needed for VST3
	IBitmap waveformBitmap = pGraphics->LoadIBitmap(WAVEFORM_ID, WAVEFORM_FN, 4);
	pGraphics->AttachControl(new ISwitchControl(this, 24, 53, mWaveform, &waveformBitmap));

	// knob bitmap for ADSR
	IBitmap knobBitmap = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, 64);
	// Attack knob:
	GetParam(mAttack)->InitDouble("Attack", 0.01, 0.01, 10.0, 0.001);
	GetParam(mAttack)->SetShape(3);
	pGraphics->AttachControl(new IKnobMultiControl(this, 95, 34, mAttack, &knobBitmap));
	//Decay knob:
	GetParam(mDecay)->InitDouble("Decay", 0.5, 0.01, 15.0, 0.001);
	GetParam(mDecay)->SetShape(3);
	pGraphics->AttachControl(new IKnobMultiControl(this, 177, 34, mDecay, &knobBitmap));
	// Sustain knob:
	GetParam(mSustain)->InitDouble("Sustain", 0.1, 0.001, 1.0, 0.001);
	GetParam(mSustain)->SetShape(2);
	pGraphics->AttachControl(new IKnobMultiControl(this, 259, 34, mSustain, &knobBitmap));
	//Release knob:
	GetParam(mRelease)->InitDouble("Release", 1.0, 0.001, 15.0, 0.001);
	GetParam(mRelease)->SetShape(3);
	pGraphics->AttachControl(new IKnobMultiControl(this, 341, 34, mRelease, &knobBitmap));

	AttachGraphics(pGraphics);
	
	CreatePresets();

	mMIDIReceiver.noteOn.Connect(this, &Synthesis::onNoteOn);
	mMIDIReceiver.noteOff.Connect(this, &Synthesis::onNoteOff);
	mEnvelopeGenerator.beganEnvelopeCycle.Connect(this, &Synthesis::onBeganEnvelopeCycle);
	mEnvelopeGenerator.finishedEnvelopeCycle.Connect(this, &Synthesis::onFinishedEnvelopeCycle);
}
Пример #6
0
IPlugConvoEngine::IPlugConvoEngine(IPlugInstanceInfo instanceInfo):
	IPLUG_CTOR(kNumParams, 0, instanceInfo),
	#ifdef _USE_R8BRAIN
	mResampler(NULL),
	#endif
	mSampleRate(0)
{
	TRACE;

	GetParam(kDry)->InitDouble("Dry", 0., 0., 1., 0.001);
	GetParam(kWet)->InitDouble("Wet", 1., 0., 1., 0.001);
  
  IGraphics* pGraphics = MakeGraphics(this, GUI_WIDTH, GUI_HEIGHT);
  IText textProps(12, &COLOR_BLACK, "Verdana", IText::kStyleNormal, IText::kAlignNear, 0, IText::kQualityNonAntiAliased);
	GenerateKnobGUI(pGraphics, this, &textProps, &COLOR_WHITE, &COLOR_BLACK, 60, 70);
  AttachGraphics(pGraphics);
}
Пример #7
0
IPlugOpenGL::IPlugOpenGL(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, 30);
  pGraphics->AttachPanelBackground(&COLOR_BLACK);
  #ifdef OS_OSX
  pGraphics->AttachControl(new IOpenGLTestControl(this, IRECT(10, 10, GUI_WIDTH-10, GUI_HEIGHT-10)));
  #endif
  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);
}
Пример #9
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);
}
Пример #10
0
IPlugDistortion::IPlugDistortion(IPlugInstanceInfo instanceInfo):
  IPLUG_CTOR(kNumParams, 0, instanceInfo),
  mOversampling(8), mDC(0.2)
{
  TRACE;

  mAntiAlias.Calc(0.5 / (double)mOversampling);
  mUpsample.Reset();
  mDownsample.Reset();

  mDistortedDC = fast_tanh(mDC);

  GetParam(kDrive)->InitDouble("Drive", 0.5, 0., 1., 0.001);
  
  IGraphics* pGraphics = MakeGraphics(this, GUI_WIDTH, GUI_HEIGHT);
  IText textProps(12, &COLOR_BLACK, "Verdana", IText::kStyleNormal, IText::kAlignNear, 0, IText::kQualityNonAntiAliased);
	GenerateKnobGUI(pGraphics, this, &textProps, &COLOR_WHITE, &COLOR_BLACK, 60, 70);
  AttachGraphics(pGraphics);
}
Пример #11
0
Synthesis::Synthesis(IPlugInstanceInfo instanceInfo)
    :   IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo),
    lastVirtualKeyboardNoteNumber(virtualKeyboardMinimumNoteNumber - 1)  {
    TRACE;

    IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight);
	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);

    int keyCoordinates[12] = { 0, 7, 12, 20, 24, 36, 43, 48, 56, 60, 69, 72 };
    mVirtualKeyboard = new IKeyboardControl(this, kKeybX, kKeybY, virtualKeyboardMinimumNoteNumber, /* octaves: */ 5, &whiteKeyImage, &blackKeyImage, keyCoordinates);

	pGraphics->AttachControl(mVirtualKeyboard);

    AttachGraphics(pGraphics);
    CreatePresets();
}
Пример #12
0
FreakkTrem::FreakkTrem(IPlugInstanceInfo instanceInfo):
  IPLUG_CTOR(kNumParams, 0, instanceInfo)
{
  TRACE;
  //arguments are: name, defaultVal, minVal, maxVal, step, label
  GetParam(kGain)->InitDouble("Gain", 1, 0., 1.5, 0.001, ""); // Gain knob offers a little amplification
  GetParam(kDepth)->InitDouble("Depth", 0.5, 0., 1., 0.001, "%");
  GetParam(kFreq)->InitDouble("Freq", 6, 0., 12, 0.5, "Hz");
  GetParam(kModMix)->InitDouble("Mod", 0., 0., 1., 0.01, "S<>C" ); // Mod Mixer
  

  GetParam(kIKnobRotaterControl_def)->InitDouble("IKnobRotaterControl Default", 2., .0, 5., .1, "");

  IGraphics* pGraphics = MakeGraphics(this, kW, kH); // MakeGraphics(this, kW, kH);
  pGraphics->AttachBackground(BG_ID, BG_FN);
  
  //Attach the IKnobRotaterControl default rotation range
  IBitmap bitmap = pGraphics->LoadIBitmap(KNOB_SPEED_ID, KNOB_SPEED_FN);
  pGraphics->AttachControl(new IKnobRotaterControl(this, kSpeedKnob_def_X, kSpeedKnob_def_Y, kFreq, &bitmap));
  
  bitmap = pGraphics->LoadIBitmap(KNOB_DEPTH_ID, KNOB_DEPTH_FN);
  pGraphics->AttachControl(new IKnobRotaterControl(this, kDepthKnob_def_X, kDepthKnob_def_Y, kDepth, &bitmap));

  bitmap = pGraphics->LoadIBitmap(KNOB_GAIN_ID, KNOB_GAIN_FN);
  pGraphics->AttachControl(new IKnobRotaterControl(this, kGainKnob_def_X, kGainKnob_def_Y, kGain, &bitmap));

  bitmap = pGraphics->LoadIBitmap(KNOB_TYPE_ID, KNOB_TYPE_FN);
  pGraphics->AttachControl(new IKnobRotaterControl(this, kTypeKnob_def_X, kTypeKnob_def_Y, kModMix, &bitmap));

  //IGraphics* pGraphics = MakeGraphics(this, GUI_WIDTH, GUI_HEIGHT);
  //IText textProps(12, &COLOR_BLACK, "Verdana", IText::kStyleNormal, IText::kAlignNear, 0, IText::kQualityNonAntiAliased);
  //GenerateKnobGUI(pGraphics, this, &textProps, &COLOR_WHITE, &COLOR_BLACK, 60, 70);

  AttachGraphics(pGraphics);
  panL = panR = 1;

  //mSampleRate = GetSampleRate();
  counter=0;

}
Пример #13
0
MostBasicGUI::MostBasicGUI(IPlugInstanceInfo instanceInfo)
:	IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGain(1.)
{  
  // add a parameter with type, name, default, min, max, step, unit label
  GetParam(kGain)->InitDouble("Gain", 50., 0., 100.0, 0.01, "%");
  
  // create graphics context
  IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight);
  
  // add a coloured background
  pGraphics->AttachPanelBackground(&COLOR_RED);
  
  // add a PNG image-based knob control, link to parameter and position on gui
  IBitmap knob = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, kKnobFrames);
  pGraphics->AttachControl(new IKnobMultiControl(this, kGainX, kGainY, kGain, &knob));
  
  // attach graphics context
  AttachGraphics(pGraphics);

  // create factory presets
  MakeDefaultPreset((char *) "-", kNumPrograms);
}
Пример #14
0
IPlugEEL::IPlugEEL(IPlugInstanceInfo instanceInfo)
  :	IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGain(1.)
{
  TRACE;
  
  vm = NSEEL_VM_alloc(); // create virtual machine
  
  mVmOutput = NSEEL_VM_regvar(vm, "x"); // register a variable into vm to get a value out

  memset(codetext, 0, 65536);
  strcpy(codetext, "x=rand(2)-1.;");
  
  codehandle = NSEEL_code_compile(vm, codetext, 0); // compile code

  //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);

  pGraphics->AttachControl(new IKnobMultiControl(this, kGainX, kGainY, kGain, &knob));
  
  IRECT textRect(5, 70, kWidth-5, kHeight-5);
  IText textProps(15, &COLOR_BLACK, "Arial", IText::kStyleNormal, IText::kAlignNear, 0, IText::kQualityDefault);
  
  mTextControl = new AlgDisplay(this, textRect, &textProps, codetext);
  pGraphics->AttachControl(mTextControl);

  AttachGraphics(pGraphics);

  //MakePreset("preset 1", ... );
  MakeDefaultPreset((char *) "-", kNumPrograms);
}
Пример #15
0
IPlugChunks::IPlugChunks(IPlugInstanceInfo instanceInfo)
  : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mGain(1.)
{
  TRACE;
  
  memset(mSteps, 0, NUM_SLIDERS*sizeof(double));

  // Define parameter ranges, display units, labels.
  //arguments are: name, defaultVal, minVal, maxVal, step, label
  GetParam(kGain)->InitDouble("Gain", 0.0, -70.0, 12.0, 0.1, "dB");

  MakePresetFromBlob("Ramp Up", "AAAAAJqZqT8AAAAAmpm5PwAAAIA9Csc/AAAAAAAA0D8AAABA4XrUPwAAAIDC9dg/AAAAwMzM3D8AAAAQ16PgPwAAALBH4eI/AAAA0MzM5D8AAADwUbjmPwAAAAjXo+g/AAAAKFyP6j8AAADMzMzsPwAAAOxRuO4/AAAAAAAA8D8AAAAAAAC8Pg==", 136);
  MakePresetFromBlob("Ramp Down", "AAAA7FG47j8AAABI4XrsPwAAALBH4eo/AAAAGK5H6T8AAABwPQrnPwAAANDMzOQ/AAAAwB6F4z8AAAAghevhPwAAAAB7FN4/AAAAgOtR2D8AAABAuB7VPwAAAACuR9E/AAAAgEfhyj8AAAAAhevBPwAAAABSuK4/AAAAAOB6hD8AAAAAAAC8Pg==", 136);
  MakePresetFromBlob("Triangle", "AAAAAIXrwT8AAACAR+HKPwAAAEBcj9I/AAAAgBSu1z8AAADA9SjcPwAAABDXo+A/AAAAsEfh4j8AAABQuB7lPwAAAGBmZuY/AAAAMDMz4z8AAAAAAADgPwAAAMD1KNw/AAAAQI/C1T8AAAAArkfRPwAAAICPwsU/AAAAAJqZuT8AAAAAAAAAAA==", 136);
  MakePresetFromBlob("Inv Triangle", "AAAAAAAA8D8AAABQuB7tPwAAAKBwPeo/AAAAcD0K5z8AAABA4XrkPwAAAJDC9eA/AAAAwEfh2j8AAABAj8LVPwAAAECPwtU/AAAAwMzM3D8AAAAghevhPwAAANDMzOQ/AAAAgBSu5z8AAACYmZnpPwAAAFyPwu0/AAAAAAAA8D8AAAAAAAAAAA==", 136);
  MakePresetFromBlob("Da Endz", "AAAAAAAA8D8AAAAA4HqEPwAAAADgeoQ/AAAAAOB6hD8AAAAA4HqEPwAAAADgeoQ/AAAAAOB6hD8AAAAA4HqEPwAAAADgeoQ/AAAAAOB6hD8AAAAA4HqEPwAAAADgeoQ/AAAAAOB6hD8AAAAA4HqEPwAAAADgeoQ/AAAAAAAA8D8AAAAAAAAAAA==", 136);
  MakePresetFromBlob("Alternate", "AAAAAAAA8D8AAAAA4HqEPwAAAAAAAPA/AAAAAOB6hD8AAAAAAADwPwAAAADgeoQ/AAAAAAAA8D8AAAAA4HqEPwAAAAAAAPA/AAAAAOB6hD8AAAAAAADwPwAAAADgeoQ/AAAAAAAA8D8AAAAA4HqEPwAAAAAAAPA/AAAAAOB6hD8AAAAAAAAAAA==", 136);
  MakePresetFromBlob("Alt Ramp Down", "AAAAAAAA8D8AAAAA4HqEPwAAALgehes/AAAAAOB6hD8AAACI61HoPwAAAADgeoQ/AAAAQArX4z8AAAAA4HqEPwAAAAAAAOA/AAAAAOB6hD8AAABAuB7VPwAAAADgeoQ/AAAAAKRwzT8AAAAA4HqEPwAAAAAzM8M/AAAAAOB6hD8AAAAAAAAAAA==", 136);
  MakePresetFromBlob("Alt Ramp Up", "AAAAgJmZyT8AAAAA4HqEPwAAAIBmZtY/AAAAAOB6hD8AAAAAKVzfPwAAAADgeoQ/AAAAMFyP4j8AAAAA4HqEPwAAAEDheuQ/AAAAAOB6hD8AAADwKFznPwAAAADgeoQ/AAAAIIXr6T8AAAAA4HqEPwAAANijcO0/AAAAAOB6hD8AAAAAAAAAAA==", 136);

  IGraphics* pGraphics = MakeGraphics(this, kW, kH);
  pGraphics->AttachPanelBackground(&COLOR_BLUE);

  mMSlider = new MultiSliderControlV(this, IRECT(10, 10, 170, 110), kDummyParamForMultislider, NUM_SLIDERS, 10, &COLOR_WHITE, &COLOR_BLACK, &COLOR_RED);

  pGraphics->AttachControl(mMSlider);
  pGraphics->AttachControl(new IVSliderControl(this, IRECT(200, 10, 220, 110), kGain, 20, &COLOR_WHITE, &COLOR_GREEN));

  //pGraphics->AttachControl(new ITempPresetSaveButtonControl(this, IRECT(350, 250, 390, 290)));
  pGraphics->AttachControl(new PresetFunctionsMenu(this, IRECT(350, 250, 390, 290)));

  AttachGraphics(pGraphics);
  
  // call RestorePreset(0) here which will initialize the multislider in the gui and the mSteps array
  RestorePreset(0);
}
Пример #16
0
DigitalDistortion::DigitalDistortion(IPlugInstanceInfo instanceInfo)
  :	IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), mDistortionAmount(1.)
{
  TRACE;

  //arguments are: name, defaultVal, minVal, maxVal, step, label
  GetParam(kDistortionAmount)->InitDouble("Distortion Amount", 0.0, 0.0, 99.0, 0.01, "%"); //modified so there is no division by zero
  //can give nonlinear behavior to the knob (offsets from center)
  GetParam(kDistortionAmount)->SetShape(2.);

  //loads a red background to the window with height/width parameters
  IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight);
  //pGraphics->AttachPanelBackground(&COLOR_RED);
  pGraphics->AttachBackground(BACKGROUND_ID, BACKGROUND_FN);
  //creates knob with 60 frames
  IBitmap knob = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, kKnobFrames);

  pGraphics->AttachControl(new IKnobMultiControl(this, kDistortionAmountX, kDistortionAmountY, kDistortionAmount, &knob));

  AttachGraphics(pGraphics);

  //MakePreset("preset 1", ... );
  CreatePresets();
}
Пример #17
0
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", ... );
  
}
Пример #18
0
Arponaut::Arponaut(IPlugInstanceInfo instanceInfo)
:	IPLUG_CTOR(kNumParams, 6, instanceInfo), lastPos_(0), arpIndex_(0), playing_(0)
{
    TRACE;

    // Define parameter ranges, display units, labels.

    GetParam(kGainL)->InitDouble("Gain L", 0.0, -44.0, 12.0, 0.1, "dB");
    GetParam(kGainL)->NegateDisplay();
    GetParam(kGainR)->InitDouble("Gain R", 0.0, -44.0, 12.0, 0.1, "dB");
    GetParam(kPan)->InitInt("Pan", 0, -100, 100, "%");

    // Params can be enums.

    GetParam(kChannelSw)->InitEnum("Channel", kDefault, kNumChannelSwitchEnums);
    GetParam(kChannelSw)->SetDisplayText(kDefault, "default");
    GetParam(kChannelSw)->SetDisplayText(kReversed, "reversed");
    GetParam(kChannelSw)->SetDisplayText(kAllLeft, "all L");
    GetParam(kChannelSw)->SetDisplayText(kAllRight, "all R");
    GetParam(kChannelSw)->SetDisplayText(kOff, "mute");

    GetParam(kNoteLength)->InitEnum("Note length", kWhole, kNumNoteLengths);
    GetParam(kNoteLength)->SetDisplayText(kWhole, "1/4");
    GetParam(kNoteLength)->SetDisplayText(kHalf, "1/8");
    GetParam(kNoteLength)->SetDisplayText(kTriplet, "1/8T");
    GetParam(kNoteLength)->SetDisplayText(kQuarter, "1/16");

    GetParam(kOctaves)->InitEnum("Octaves", kOne8ve, kNumNoteLengths);
    GetParam(kOctaves)->SetDisplayText(kOne8ve,   "1 octave");
    GetParam(kOctaves)->SetDisplayText(kTwo8ve,   "2 octaves");
    GetParam(kOctaves)->SetDisplayText(kThree8ve, "3 octaves");
    GetParam(kOctaves)->SetDisplayText(kFour8ve,  "4 octaves");

    GetParam(kArpMode)->InitEnum("Arp modes", kUp, kNumArpModes);
    GetParam(kArpMode)->SetDisplayText(kUp, "Up");
    GetParam(kArpMode)->SetDisplayText(kDown, "Down");
    GetParam(kArpMode)->SetDisplayText(kUpDown, "Up/Down");
    GetParam(kArpMode)->SetDisplayText(kManual,  "Manual");
    GetParam(kArpMode)->SetDisplayText(kRandom,  "Random");

    GetParam(kInsertMode)->InitEnum("Insert modes", kInsertOff, kNumInsertModes);
    GetParam(kInsertMode)->SetDisplayText(kInsertOff, "Off");
    GetParam(kInsertMode)->SetDisplayText(kInsertLow, "Low");
    GetParam(kInsertMode)->SetDisplayText(kInsertHi,  "Hi");
    GetParam(kInsertMode)->SetDisplayText(kInsert31,  "3-1");
    GetParam(kInsertMode)->SetDisplayText(kInsert42,  "4-2");

    MakePreset("preset 1", -5.0, 5.0, 17, kReversed);
    MakePreset("preset 2", -15.0, 25.0, 37, kAllRight);
    MakeDefaultPreset("-", 4);

    // Instantiate a graphics engine.

    IGraphics* pGraphics = MakeGraphics(this, kW, kH); // MakeGraphics(this, kW, kH);
    pGraphics->AttachBackground(BG_ID, BG_FN);

    // Attach controls to the graphics engine.  Controls are automatically associated
    // with a parameter if you construct the control with a parameter index.

    // Attach a couple of meters, not associated with any parameter,
    // which we keep indexes for, so we can push updates from the plugin class.

    //IBitmap bitmap = pGraphics->LoadIBitmap(METER_ID, METER_FN, kMeter_N);
    //mMeterIdx_L = pGraphics->AttachControl(new IBitmapControl(this, kMeterL_X, kMeterL_Y, &bitmap));
    //mMeterIdx_R = pGraphics->AttachControl(new IBitmapControl(this, kMeterR_X, kMeterR_Y, &bitmap));

    // Attach a couple of faders, associated with the parameters GainL and GainR.

    //bitmap = pGraphics->LoadIBitmap(FADER_ID, FADER_FN);
    //pGraphics->AttachControl(new IFaderControl(this, kGainL_X, kGainL_Y, kFader_Len, kGainL, &bitmap, kVertical));
    //pGraphics->AttachControl(new IFaderControl(this, kGainR_X, kGainR_Y, kFader_Len, kGainR, &bitmap, kVertical));

    // Attach a 5-position switch associated with the ChannelSw parameter.

    IBitmap bitmap = pGraphics->LoadIBitmap(TOGGLE_ID, TOGGLE_FN, kNoteLength_N);
    pGraphics->AttachControl(new ISwitchControl(this, kNoteLength_X, kNoteLength_Y, kNoteLength, &bitmap));
    pGraphics->AttachControl(new ISwitchControl(this, kOctaves_X, kOctaves_Y, kOctaves, &bitmap));
    pGraphics->AttachControl(new ISwitchControl(this, kArpMode_X, kArpMode_Y, kArpMode, &bitmap));
    pGraphics->AttachControl(new ISwitchControl(this, kInsertMode_X, kInsertMode_Y, kInsertMode, &bitmap));

    // Attach a rotating knob associated with the Pan parameter.

    //bitmap = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN);
    //pGraphics->AttachControl(new IKnobRotaterControl(this, kPan_X, kPan_Y, kPan, &bitmap));

    // See IControl.h for other control types,
    // IKnobMultiControl, ITextControl, IBitmapOverlayControl, IFileSelectorControl, IGraphControl, etc.
    IText text;
    text.mAlign = IText::kAlignNear;
    textControl_ = new ITextControl(this, &IRECT(21, 0, 200, 100), &text, "Hello world");
    pGraphics->AttachControl(textControl_);

    sequence_ = new Sequence(keymap_, 16);
    matrix = new ArpMatrix(this, sequence_, kDisplay_X, kDisplay_Y);
    pGraphics->AttachControl(matrix);

    AttachGraphics(pGraphics);

    running_ = false;
}
Пример #19
0
void Vega::CreateGraphics() {
  int keyboardX, keyboardY;

  IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight);
  pGraphics->AttachBackground(BACKGROUND_ID, BACKGROUND_FN);

  IBitmap knobImage = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, kKnobFrames);
  IBitmap whiteKeyImage = pGraphics->LoadIBitmap(PIANO_WHT_ID, PIANO_WHT_FN, 6);
  IBitmap blackKeyImage = pGraphics->LoadIBitmap(PIANO_BLK_ID, PIANO_BLK_FN);
  IBitmap miniKnobImage = pGraphics->LoadIBitmap(MINIKNOB_ID, MINIKNOB_FN, kKnobFrames);
  IBitmap waveImage = pGraphics->LoadIBitmap(WAVE_ID, WAVE_FN, 4);
  IBitmap slopeImage = pGraphics->LoadIBitmap(SLOPE_ID, SLOPE_FN, 3);
  IBitmap voicesImage = pGraphics->LoadIBitmap(VOICES_ID, VOICES_FN, 8);
  IBitmap octaveImage = pGraphics->LoadIBitmap(OCTAVE_ID, OCTAVE_FN, 9);
  IBitmap noteImage = pGraphics->LoadIBitmap(NOTE_ID, NOTE_FN, 15);
  IBitmap passImage = pGraphics->LoadIBitmap(PASS_ID, PASS_FN, 3);
  IBitmap sliderImage = pGraphics->LoadIBitmap(SLIDER_ID, SLIDER_FN, 1);
  IBitmap buttonGrnImage = pGraphics->LoadIBitmap(BUTTON_ID, BUTTON_FN, 2);
  IBitmap buttonAddImage = pGraphics->LoadIBitmap(ADD_ID, ADD_FN, 2);
  IBitmap wheelImage = pGraphics->LoadIBitmap(PITCHMOD_ID, PITCHMOD_FN, kKnobFrames);

  keyboardY = kHeight - 85;
  keyboardX = kWidth - 788;

  int keyCoordinates[12] = { 0, 17, 0, 49, 0, 0, 98, 0, 128, 0, 157, 0 };
  mVirtualKeyboard = new IKeyboardControl(this, keyboardX, keyboardY, virtualKeyboardMinimumNoteNumber,
    4, &whiteKeyImage, &blackKeyImage, keyCoordinates);
  pGraphics->AttachControl(mVirtualKeyboard);

  for (int i = 0; i < kNumParams; i++) {
    const paramProperties& properties = paramProps[i];
    IControl* control;
    IBitmap* graphic;
    switch (i) {
    case mOsc1Wave:
    case mOsc2Wave:
    case mOsc3Wave:
    case mLFOWave:
      graphic = &waveImage;
      control = new IKnobMultiControl(this, properties.x, properties.y, i, graphic);
      break;
    case mFilterType:
      graphic = &passImage;
      control = new IKnobMultiControl(this, properties.x, properties.y, i, graphic);
      break;
    case mFilterSlope:
      graphic = &slopeImage;
      control = new IKnobMultiControl(this, properties.x, properties.y, i, graphic);
      break;
    case mOsc1Invert:
    case mOsc1Retrig:  
    case mOsc2Invert:
    case mOsc2Retrig:
    case mOsc3Invert:
    case mOsc3Retrig:
      graphic = &buttonGrnImage;    
      control = new ISwitchControl(this, properties.x, properties.y, i, graphic);
      break;
    case mVolAttack:
    case mVolDecay:
    case mVolSustain:
    case mVolRelease:
    case mFilterAttack:
    case mFilterDecay:
    case mFilterSustain:
    case mFilterRelease:
      graphic = &sliderImage;
      control = new IFaderControl(this, properties.x, properties.y, 73, i, graphic);
      break;
    case mOsc1Voices:
    case mOsc2Voices:
    case mOsc3Voices:
      graphic = &voicesImage;
      control = new IKnobMultiControl(this, properties.x, properties.y, i, graphic);
      break;
    case mOsc1Oct:
    case mOsc2Oct:
    case mOsc3Oct:
      graphic = &octaveImage;
      control = new IKnobMultiControl(this, properties.x, properties.y, i, graphic);
      break;
    case mOsc1Pitch:
    case mOsc2Pitch:
    case mOsc3Pitch:
    case mBendRange:
      graphic = &noteImage;
      control = new IKnobMultiControl(this, properties.x, properties.y, i, graphic);
      break;
    case mOsc1Fine:
    case mOsc2Fine:
    case mOsc3Fine:
    case mGlide:
      graphic = &miniKnobImage;
      control = new IKnobMultiControl(this, properties.x, properties.y, i, graphic);
      break;
    case mPitchMod:
      graphic = &wheelImage;
      control = new IKnobMultiControl(this, properties.x, properties.y, i, graphic);
      break;
    default:
      graphic = &knobImage;
      control = new IKnobMultiControl(this, properties.x, properties.y, i, graphic);
      break;
    }
    pGraphics->AttachControl(control);
  }

  AttachGraphics(pGraphics);
}
Пример #20
0
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();
}
Пример #21
0
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();
}
Пример #22
0
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();
}
Пример #23
0
PlugExample::PlugExample(IPlugInstanceInfo instanceInfo)
:	IPLUG_CTOR(kNumParams, 6, instanceInfo), prevL(0.0), prevR(0.0)
{
  TRACE;

	// Define parameter ranges, display units, labels.

	GetParam(kGainL)->InitDouble("Gain L", 0.0, -44.0, 12.0, 0.1, "dB");
	GetParam(kGainL)->NegateDisplay();
	GetParam(kGainR)->InitDouble("Gain R", 0.0, -44.0, 12.0, 0.1, "dB");
	GetParam(kPan)->InitInt("Pan", 0, -100, 100, "%");

	// Params can be enums.

	GetParam(kChannelSw)->InitEnum("Channel", kDefault, kNumChannelSwitchEnums);
	GetParam(kChannelSw)->SetDisplayText(kDefault, "default");
	GetParam(kChannelSw)->SetDisplayText(kReversed, "reversed");
	GetParam(kChannelSw)->SetDisplayText(kAllLeft, "all L");
	GetParam(kChannelSw)->SetDisplayText(kAllRight, "all R");
	GetParam(kChannelSw)->SetDisplayText(kOff, "mute");

  MakePreset("preset 1", -5.0, 5.0, 17, kReversed);
  MakePreset("preset 2", -15.0, 25.0, 37, kAllRight);
  MakeDefaultPreset("-", 4);

	// Instantiate a graphics engine.

	IGraphics* pGraphics = MakeGraphics(this, kW, kH); // MakeGraphics(this, kW, kH);
	pGraphics->AttachBackground(IPLUG_PNG_RESOURCE(BG_ID, BG_FN));

  // Attach controls to the graphics engine.  Controls are automatically associated
	// with a parameter if you construct the control with a parameter index.

	// Attach a couple of meters, not associated with any parameter,
	// which we keep indexes for, so we can push updates from the plugin class.

	IBitmap bitmap = pGraphics->LoadIBitmap(IPLUG_PNG_RESOURCE(METER_ID, METER_FN), kMeter_N);
  mMeterIdx_L = pGraphics->AttachControl(new IBitmapControl(this, kMeterL_X, kMeterL_Y, &bitmap));
	mMeterIdx_R = pGraphics->AttachControl(new IBitmapControl(this, kMeterR_X, kMeterR_Y, &bitmap));

	// Attach a couple of faders, associated with the parameters GainL and GainR.

	bitmap = pGraphics->LoadIBitmap(IPLUG_PNG_RESOURCE(FADER_ID, FADER_FN));
	pGraphics->AttachControl(new IFaderControl(this, kGainL_X, kGainL_Y, kFader_Len, kGainL, &bitmap, kVertical));
	pGraphics->AttachControl(new IFaderControl(this, kGainR_X, kGainR_Y, kFader_Len, kGainR, &bitmap, kVertical));

	// Attach a 5-position switch associated with the ChannelSw parameter.

	bitmap = pGraphics->LoadIBitmap(IPLUG_PNG_RESOURCE(TOGGLE_ID, TOGGLE_FN), kSwitch_N);
	pGraphics->AttachControl(new ISwitchControl(this, kSwitch_X, kSwitch_Y, kChannelSw, &bitmap));

	// Attach a rotating knob associated with the Pan parameter.

	bitmap = pGraphics->LoadIBitmap(IPLUG_PNG_RESOURCE(KNOB_ID, KNOB_FN));
	pGraphics->AttachControl(new IKnobRotaterControl(this, kPan_X, kPan_Y, kPan, &bitmap));

	// See IControl.h for other control types,
	// IKnobMultiControl, ITextControl, IBitmapOverlayControl, IFileSelectorControl, IGraphControl, etc.

	// Attach the graphics engine to the plugin.

	AttachGraphics(pGraphics);

	// No cleanup necessary, the graphics engine manages all of its resources and cleans up when closed.
}
Пример #24
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);
}
Пример #25
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);
}