//------------------------------------------------------------------------ tresult PLUGIN_API AnimationTestController::initialize (FUnknown* context) { tresult res = UIDescriptionBaseController::initialize (context); if (res == kResultTrue) { // add ui parameters StringListParameter* slp = new StringListParameter (USTRING("Animation Switch"), 20000); slp->appendString (USTRING("On")); slp->appendString (USTRING("Off")); uiParameters.addParameter (slp); } return res; }
//----------------------------------------------------------------------------- // member function of PluginController! // define parameter definitions here... tresult PLUGIN_API Instrument::initialize (FUnknown* context){ parameters.addParameter(new RangeParameter(STR16("Gain"), kGainId, STR16("dB"), -100, 0, GAIN_DEFAULT_DB)); parameters.addParameter(new RangeParameter(STR16("Attack"), kAttackId, STR16("ms"), 0, 1000, ATTACK_DEFAULT_MS)); parameters.addParameter(new RangeParameter(STR16("Decay"), kDecayId, STR16("ms"),0, 1000, DECAY_DEFAULT_MS)); parameters.addParameter(new RangeParameter(STR16("Sustain Rate"), kSustainRateId, STR16("%"), 0, 100, SUSTAINRATE_DEFAULT)); parameters.addParameter(new RangeParameter(STR16("Release"), kReleaseId, STR16("ms"), 0, 1000, RELEASE_DEFAULT_MS)); // StringlistParameter fuer Auswahl von Waveform StringListParameter* stringListParameter = new StringListParameter(STR16("Waveform"), kWaveTypeId); stringListParameter->appendString(USTRING("Sinus")); stringListParameter->appendString(USTRING("Sawtooth")); stringListParameter->appendString(USTRING("Squarewave")); stringListParameter->appendString(USTRING("Triangle")); parameters.addParameter(stringListParameter); parameters.addParameter(new RangeParameter(STR16("PWM"), kPWMId, STR16("%"), 0, 100, PWM_DEFAULT_PERCENTAGE)); parameters.addParameter(new RangeParameter(STR16("PWM LFO"), kLFO_PWM_freqId, STR16("Hz"), 0, 10, LFO_PWM_FREQ_DEFAULT_VALUE)); parameters.addParameter(new RangeParameter(STR16("CutOff"), kCutOffId, STR16("Hz"), 20, 20000, CUTOFF_DEFAULT_FREQUENCY)); parameters.addParameter(new RangeParameter(STR16("Resonance"), kResId, STR16("%"), 100, 0, RESONANCE_DEFAULT_VALUE)); parameters.addParameter(new RangeParameter(STR16("Autopan Freq"), kLFO_autopan_freqId, STR16("Hz"), 0, 15, LFO_AUTOPAN_FREQ_DEFAULT_VALUE)); parameters.addParameter(new RangeParameter(STR16("Autopan Phase"), kLFO_autopan_phaseId, STR16("%"), 0, 100, LFO_AUTOPAN_PHASE_DEFAULT_VALUE)); // fix for RangeParameter (default value is not yet set) for(int i = 0; i < parameters.getParameterCount(); i++){ Parameter* p = parameters.getParameterByIndex(i); p->setNormalized(p->getInfo().defaultNormalizedValue); } // SET Parameters ON STARTUP // GAIN float dB = 20 * log(DEFAULTGAIN); processor.setGain(dB); processor.setCutOff(CUTOFF_DEFAULT_FREQUENCY); processor.setRes(1.4f); processor.setCutOff(CUTOFF_DEFAULT_FREQUENCY); processor.setSustainRate(SUSTAINRATE_DEFAULT); return InstrumentAdapter::initialize(context); }
tresult PLUGIN_API IPlugVST3Plugin::initialize (FUnknown* context) { TRACE; tresult result = SingleComponentEffect::initialize(context); String128 tmpStringBuf; char hostNameCString[128]; FUnknownPtr<IHostApplication>app(context); if (app) { app->getName(tmpStringBuf); Steinberg::UString(tmpStringBuf, 128).toAscii(hostNameCString, 128); SetHost(hostNameCString, 0); // Can't get version in VST3 } if (result == kResultOk) { int maxInputs = getSpeakerArrForChans(NInChannels()-mScChans); if(maxInputs < 0) maxInputs = 0; // add io buses with the maximum i/o to start with if (maxInputs) { Steinberg::UString(tmpStringBuf, 128).fromAscii(GetInputBusLabel(0)->Get(), 128); addAudioInput(tmpStringBuf, maxInputs); } if(!mIsInst) // if effect, just add one output bus with max chan count { Steinberg::UString(tmpStringBuf, 128).fromAscii(GetOutputBusLabel(0)->Get(), 128); addAudioOutput(tmpStringBuf, getSpeakerArrForChans(NOutChannels()) ); } else { for (int i = 0, busIdx = 0; i < NOutChannels(); i+=2, busIdx++) { Steinberg::UString(tmpStringBuf, 128).fromAscii(GetOutputBusLabel(busIdx)->Get(), 128); addAudioOutput(tmpStringBuf, SpeakerArr::kStereo ); } } if (mScChans) { if (mScChans > 2) mScChans = 2; Steinberg::UString(tmpStringBuf, 128).fromAscii(GetInputBusLabel(1)->Get(), 128); addAudioInput(tmpStringBuf, getSpeakerArrForChans(mScChans), kAux, 0); } if(DoesMIDI()) { addEventInput (STR16("MIDI Input"), 1); //addEventOutput(STR16("MIDI Output"), 1); } if (NPresets()) { parameters.addParameter(new Parameter(STR16("Preset"), kPresetParam, STR16(""), 0, NPresets(), ParameterInfo::kIsProgramChange)); } if(!mIsInst) { StringListParameter * bypass = new StringListParameter(STR16("Bypass"), kBypassParam, 0, ParameterInfo::kCanAutomate | ParameterInfo::kIsBypass | ParameterInfo::kIsList); bypass->appendString(STR16("off")); bypass->appendString(STR16("on")); parameters.addParameter(bypass); } for (int i=0; i<NParams(); i++) { IParam *p = GetParam(i); int32 flags = 0; UnitID unitID = kRootUnitId; const char* paramGroupName = p->GetParamGroupForHost(); if (CSTR_NOT_EMPTY(paramGroupName)) { for(int j = 0; j < mParamGroups.GetSize(); j++) { if(strcmp(paramGroupName, mParamGroups.Get(j)) == 0) { unitID = j+1; } } if (unitID == kRootUnitId) // new unit, nothing found, so add it { mParamGroups.Add(paramGroupName); unitID = mParamGroups.GetSize(); } } if (p->GetCanAutomate()) { flags |= ParameterInfo::kCanAutomate; } switch (p->Type()) { case IParam::kTypeDouble: case IParam::kTypeInt: { Parameter* param = new RangeParameter( STR16(p->GetNameForHost()), i, STR16(p->GetLabelForHost()), p->GetMin(), p->GetMax(), p->GetDefault(), 0, // continuous flags, unitID); param->setPrecision (p->GetPrecision()); parameters.addParameter(param); break; } case IParam::kTypeEnum: case IParam::kTypeBool: { StringListParameter* param = new StringListParameter (STR16(p->GetNameForHost()), i, STR16(p->GetLabelForHost()), flags | ParameterInfo::kIsList, unitID); int nDisplayTexts = p->GetNDisplayTexts(); assert(nDisplayTexts); for (int j=0; j<nDisplayTexts; j++) { param->appendString(STR16(p->GetDisplayText(j))); } parameters.addParameter(param); break; } default: break; } } } OnHostIdentified(); RestorePreset(0); return result; }
//------------------------------------------------------------------------ tresult PLUGIN_API UIDescriptionTestController::initialize (FUnknown* context) { tresult res = UIDescriptionBaseController::initialize (context); if (res == kResultTrue) { // add ui parameters StringListParameter* slp = new StringListParameter (USTRING("TabController"), 20000); slp->appendString (USTRING("Tab1")); slp->appendString (USTRING("Tab2")); slp->appendString (USTRING("Tab3")); slp->appendString (USTRING("Tab4")); slp->appendString (USTRING("Tab5")); uiParameters.addParameter (slp); slp = new StringListParameter (USTRING("LineStyle"), 20001); slp->appendString (USTRING("Solid")); slp->appendString (USTRING("Solid Round Join")); slp->appendString (USTRING("Solid Bevel Join")); slp->appendString (USTRING("On-Off")); slp->appendString (USTRING("On-Off Round Cap")); slp->appendString (USTRING("On-Off Square Cap")); uiParameters.addParameter (slp); slp = new StringListParameter (USTRING("KnobStepCountTestParameter"), 20002); slp->appendString (USTRING("1")); slp->appendString (USTRING("2")); slp->appendString (USTRING("3")); slp->appendString (USTRING("4")); slp->appendString (USTRING("5")); slp->appendString (USTRING("6")); uiParameters.addParameter (slp); } return res; }
tresult PLUGIN_API IPlugVST3::initialize (FUnknown* context) { TRACE; tresult result = SingleComponentEffect::initialize (context); if (result == kResultOk) { addAudioInput (STR16("Audio Input"), getSpeakerArrForChans(NInChannels()) ); addAudioOutput (STR16("Audio Output"), getSpeakerArrForChans(NOutChannels()) ); if (mScChans == 1) addAudioInput(STR16("Sidechain Input"), SpeakerArr::kMono, kAux, 0); else if (mScChans >= 2) { mScChans = 2; addAudioInput(STR16("Sidechain Input"), SpeakerArr::kStereo, kAux, 0); } if(mDoesMidi) { addEventInput (STR16("MIDI In"), 1); addEventOutput(STR16("MIDI Out"), 1); } for (int i=0;i<NParams();i++) { IParam *p = GetParam(i); int32 flags = 0; if (p->GetCanAutomate()) { flags |= ParameterInfo::kCanAutomate; } switch (p->Type()) { case IParam::kTypeDouble: case IParam::kTypeInt: { Parameter* param = new RangeParameter ( STR16(p->GetNameForHost()), i, STR16(p->GetLabelForHost()), p->GetMin(), p->GetMax(), p->GetDefault(), p->GetStep(), flags); param->setPrecision (p->GetPrecision()); parameters.addParameter (param); break; } case IParam::kTypeEnum: case IParam::kTypeBool: { StringListParameter* param = new StringListParameter (STR16(p->GetNameForHost()), i, STR16(p->GetLabelForHost()), flags | ParameterInfo::kIsList); int nDisplayTexts = p->GetNDisplayTexts(); assert(nDisplayTexts); for (int j=0; j<nDisplayTexts; j++) { param->appendString(STR16(p->GetDisplayText(j))); } parameters.addParameter (param); break; } default: break; } } } return result; }
//------------------------------------------------------------------------ // PlugController Implementation //------------------------------------------------------------------------ tresult PLUGIN_API PlugController::initialize (FUnknown* context) { tresult result = EditControllerEx1::initialize (context); if (result != kResultOk) { return result; } //---Create Parameters------------ //---Bypass parameter--- int32 stepCount = 1; ParamValue defaultVal = 0; int32 flags = ParameterInfo::kCanAutomate | ParameterInfo::kIsBypass; int32 tag = kBypassId; parameters.addParameter (STR16 ("Bypass"), nullptr, stepCount, defaultVal, flags, tag); //---Read only parameters String128 undefinedStr; Steinberg::UString (undefinedStr, 128).fromAscii ("undefined"); flags = ParameterInfo::kIsReadOnly; StringListParameter* strParam = NEW StringListParameter (STR16 ("Ch Uid"), kChannelUIDId, nullptr, flags); strParam->appendString (undefinedStr); parameters.addParameter (strParam); strParam = NEW StringListParameter (STR16 ("Ch Uid Len"), kChannelUIDLengthId, nullptr, flags); strParam->appendString (undefinedStr); parameters.addParameter (strParam); strParam = NEW StringListParameter (STR16 ("Ch Name"), kChannelNameId, nullptr, flags); strParam->appendString (undefinedStr); parameters.addParameter (strParam); strParam = NEW StringListParameter (STR16 ("Ch Name Len"), kChannelNameLengthId, nullptr, flags); strParam->appendString (undefinedStr); parameters.addParameter (strParam); strParam = NEW StringListParameter (STR16 ("Ch Index"), kChannelIndexId, nullptr, flags); strParam->appendString (undefinedStr); parameters.addParameter (strParam); strParam = NEW StringListParameter (STR16 ("Ch Index Namespace Order"), kChannelIndexNamespaceOrderId, nullptr, flags); strParam->appendString (undefinedStr); parameters.addParameter (strParam); strParam = NEW StringListParameter (STR16 ("Ch Index Namespace"), kChannelIndexNamespaceId, nullptr, flags); strParam->appendString (undefinedStr); parameters.addParameter (strParam); strParam = NEW StringListParameter (STR16 ("Ch Index Namespace Len"), kChannelIndexNamespaceLengthId, nullptr, flags); strParam->appendString (undefinedStr); parameters.addParameter (strParam); strParam = NEW StringListParameter (STR16 ("Ch Color"), kChannelColorId, nullptr, flags); strParam->appendString (undefinedStr); parameters.addParameter (strParam); strParam = NEW StringListParameter (STR16 ("Ch Plug Loc."), kChannelPluginLocationId, nullptr, flags); strParam->appendString (undefinedStr); parameters.addParameter (strParam); return result; }
//----------------------------------------------------------------------------- // member function of PluginController! // define parameter definitions here... void PluginController::setupParameters(){ /*------------------Low Band Parameters----------------------------*/ // Filter Type StringListParameter* stringListParameter = new StringListParameter(STR16("Typ_low"), kFilterTypeLowId); stringListParameter->appendString(USTRING("Peak")); stringListParameter->appendString(USTRING("Lowpass")); stringListParameter->appendString(USTRING("Highpass")); stringListParameter->appendString(USTRING("Low Shelf")); stringListParameter->appendString(USTRING("High Shelf")); parameters.addParameter(stringListParameter); // low Frequenz: 20...200 Hz parameters.addParameter(new RangeParameter(STR16("Frequency_low"), kFrequencyLowId, STR16("Hz"), MINFREQ_low, MAXFREQ_low, 1)); // low Q: 0,1 ... 18 parameters.addParameter(new RangeParameter(STR16("Q_low"), kQLowId, STR16("Hz"), 0.1, MAXQ)); // low Gain: -24 dB ... +24 dB parameters.addParameter(new RangeParameter(STR16("Gain_low"), kGainLowId, STR16("dB"), -MAXGAIN, MAXGAIN, 0)); // low Bypass parameters.addParameter(new RangeParameter(STR16("Bypass_low"), kBypassLowId, STR16(""), false, true, 1)); /*------------------Mid Band 1 Parameters ------------------------*/ StringListParameter* stringListParameter_mid1 = new StringListParameter(STR16("Typ_mid1"), kFilterTypeMid1Id); stringListParameter_mid1->appendString(USTRING("Peak")); stringListParameter_mid1->appendString(USTRING("Lowpass")); stringListParameter_mid1->appendString(USTRING("Highpass")); stringListParameter_mid1->appendString(USTRING("Low Shelf")); stringListParameter_mid1->appendString(USTRING("High Shelf")); parameters.addParameter(stringListParameter_mid1); // mid1 Frequenz: parameters.addParameter(new RangeParameter(STR16("Frequency_mid1"), kFrequencyMid1Id, STR16("Hz"), MINFREQ_mid1, MAXFREQ_mid1)); // mid1 Q: 0,1 ... 18 parameters.addParameter(new RangeParameter(STR16("Q_mid1"), kQMid1Id, STR16("Hz"), 0.1, MAXQ)); // mid1 Gain: -24 dB ... +24 dB parameters.addParameter(new RangeParameter(STR16("Gain_mid1"), kGainMid1Id, STR16("dB"), -MAXGAIN, MAXGAIN, 0)); //bypass parameters.addParameter(new RangeParameter(STR16("Bypass_mid1"), kBypassMid1Id, STR16(""), false, true, 1)); /*------------------Mid Band 2 Parameters ------------------------*/ StringListParameter* stringListParameter_mid2 = new StringListParameter(STR16("Typ_mid2"), kFilterTypeMid2Id); stringListParameter_mid2->appendString(USTRING("Peak")); stringListParameter_mid2->appendString(USTRING("Lowpass")); stringListParameter_mid2->appendString(USTRING("Highpass")); stringListParameter_mid2->appendString(USTRING("Low Shelf")); stringListParameter_mid2->appendString(USTRING("High Shelf")); parameters.addParameter(stringListParameter_mid2); // mid2 Frequenz: parameters.addParameter(new RangeParameter(STR16("Frequency_mid2"), kFrequencyMid2Id, STR16("Hz"), MINFREQ_mid2, MAXFREQ_mid2, (MINFREQ_mid2 + MAXFREQ_mid2)/2)); // mid2 Q: 0,1 ... 18 parameters.addParameter(new RangeParameter(STR16("Q_mid2"), kQMid2Id, STR16("Hz"), 0.1, MAXQ)); // mid2 Gain: -24 dB ... +24 dB parameters.addParameter(new RangeParameter(STR16("Gain_mid2"), kGainMid2Id, STR16("dB"), -MAXGAIN, MAXGAIN, 0)); //bypass parameters.addParameter(new RangeParameter(STR16("Bypass_mid2"), kBypassMid2Id, STR16(""), false, true, 1)); /*------------------Mid Band 3 Parameters ------------------------*/ StringListParameter* stringListParameter_mid3 = new StringListParameter(STR16("Typ_mid3"), kFilterTypeMid3Id); stringListParameter_mid3->appendString(USTRING("Peak")); stringListParameter_mid3->appendString(USTRING("Lowpass")); stringListParameter_mid3->appendString(USTRING("Highpass")); stringListParameter_mid3->appendString(USTRING("Low Shelf")); stringListParameter_mid3->appendString(USTRING("High Shelf")); parameters.addParameter(stringListParameter_mid3); // mid3 Frequenz: parameters.addParameter(new RangeParameter(STR16("Frequency_mid3"), kFrequencyMid3Id, STR16("Hz"), MINFREQ_mid3, MAXFREQ_mid3, (MINFREQ_mid3 + MAXFREQ_mid3)/2)); // mid3 Q: 0,1 ... 18 parameters.addParameter(new RangeParameter(STR16("Q_mid3"), kQMid3Id, STR16("Hz"), 0.1, MAXQ)); // mid3 Gain: -24 dB ... +24 dB parameters.addParameter(new RangeParameter(STR16("Gain_mid3"), kGainMid3Id, STR16("dB"), -MAXGAIN, MAXGAIN, 0)); //bypass parameters.addParameter(new RangeParameter(STR16("Bypass_mid3"), kBypassMid3Id, STR16(""), false, true, 1)); /*------------------Mid Band 4 Parameters ------------------------*/ StringListParameter* stringListParameter_mid4 = new StringListParameter(STR16("Typ_mid4"), kFilterTypeMid4Id); stringListParameter_mid4->appendString(USTRING("Peak")); stringListParameter_mid4->appendString(USTRING("Lowpass")); stringListParameter_mid4->appendString(USTRING("Highpass")); stringListParameter_mid4->appendString(USTRING("Low Shelf")); stringListParameter_mid4->appendString(USTRING("High Shelf")); parameters.addParameter(stringListParameter_mid4); // mid4 Frequenz: parameters.addParameter(new RangeParameter(STR16("Frequency_mid4"), kFrequencyMid4Id, STR16("Hz"), MINFREQ_mid4, MAXFREQ_mid4, (MINFREQ_mid4 + MAXFREQ_mid4)/2)); // mid4 Q: 0,1 ... 18 parameters.addParameter(new RangeParameter(STR16("Q_mid4"), kQMid4Id, STR16("Hz"), 0.1, MAXQ)); // mid4 Gain: -24 dB ... +24 dB parameters.addParameter(new RangeParameter(STR16("Gain_mid4"), kGainMid4Id, STR16("dB"), -MAXGAIN, MAXGAIN, 0)); //bypass parameters.addParameter(new RangeParameter(STR16("Bypass_mid4"), kBypassMid4Id, STR16(""), false, true, 1)); /*------------------ High Band Parameters-------------------------*/ // Filter Type StringListParameter* stringListParameter_high = new StringListParameter(STR16("Typ_high"), kFilterTypeHighId); stringListParameter_high->appendString(USTRING("Peak")); stringListParameter_high->appendString(USTRING("Lowpass")); stringListParameter_high->appendString(USTRING("Highpass")); stringListParameter_high->appendString(USTRING("Low Shelf")); stringListParameter_high->appendString(USTRING("High Shelf")); parameters.addParameter(stringListParameter_high); // high Frequenz: 2500...18000 Hz parameters.addParameter(new RangeParameter(STR16("Frequency_high"), kFrequencyHighId, STR16("Hz"), MINFREQ_high, MAXFREQ_high)); // high Q: 0,1 ... 18 parameters.addParameter(new RangeParameter(STR16("Q_high"), kQHighId, STR16("Hz"), 0.1, MAXQ)); // high Gain: -24 dB ... +24 dB parameters.addParameter(new RangeParameter(STR16("Gain_high"), kGainHighId, STR16("dB"), -MAXGAIN, MAXGAIN, 0)); //bypass parameters.addParameter(new RangeParameter(STR16("Bypass_high"), kBypassHighId, STR16(""), false, true, 1)); }