void IPlugProcess::EffectInit() { TRACE; if (mPlug) { AddControl(new CPluginControl_OnOff('bypa', "Master Bypass\nMastrByp\nMByp\nByp", false, true)); // Default to off DefineMasterBypassControlIndex(1); int paramCount = mPlug->NParams(); for (int i=0; i<paramCount; i++) { IParam *p = mPlug->GetParam(i); switch (p->Type()) { case IParam::kTypeDouble: AddControl(new CPluginControl_Linear(' ld '+i, p->GetNameForHost(), p->GetMin(), p->GetMax(), p->GetStep(), p->GetDefault(), p->GetCanAutomate())); break; case IParam::kTypeInt: AddControl(new CPluginControl_Discrete(' ld '+i, p->GetNameForHost(), (long) p->GetMin(), (long) p->GetMax(), (long) p->GetDefault(), p->GetCanAutomate())); break; case IParam::kTypeEnum: case IParam::kTypeBool: { std::vector<std::string> displayTexts; for (int j=0; j<p->GetNDisplayTexts(); j++) { displayTexts.push_back(p->GetDisplayTextAtIdx(j)); } assert(displayTexts.size()); AddControl(new CPluginControl_List(' ld '+i, p->GetNameForHost(), displayTexts, (long) p->GetDefault(), p->GetCanAutomate())); break; } default: break; } } #if PLUG_DOES_MIDI if (!IsAS()) { ComponentResult result = noErr; Cmn_Int32 requestedVersion = 7; std::string midiNodeName(PLUG_NAME" Midi"); while (requestedVersion) { result = DirectMidi_RegisterClient(requestedVersion, this, reinterpret_cast<Cmn_UInt32>(this), (void **)&mDirectMidiInterface); if (result == noErr && mDirectMidiInterface != NULL) { mDirectMidiInterface->CreateRTASBufferedMidiNode(0, const_cast<char *>(midiNodeName.c_str()), 1); break; } requestedVersion--; } } #endif mPlug->SetIO(GetNumInputs(), GetNumOutputs()); mPlug->SetSampleRate(GetSampleRate()); mPlug->Reset(); } }
AAX_Result IPlugAAX::EffectInit() { TRACE; AAX_CString bypassID = NULL; this->GetMasterBypassParameter( &bypassID ); mBypassParameter = new AAX_CParameter<bool>(bypassID.CString(), AAX_CString("Master Bypass"), false, AAX_CBinaryTaperDelegate<bool>(), AAX_CBinaryDisplayDelegate<bool>("bypass", "on"), true); mBypassParameter->SetNumberOfSteps( 2 ); mBypassParameter->SetType( AAX_eParameterType_Discrete ); mParameterManager.AddParameter(mBypassParameter); for (int i=0;i<NParams();i++) { IParam *p = GetParam(i); AAX_IParameter* param = 0; WDL_String* paramID = new WDL_String("_", 1); paramID->SetFormatted(32, "%i", i+kAAXParamIdxOffset); mParamIDs.Add(paramID); switch (p->Type()) { case IParam::kTypeDouble: { param = new AAX_CParameter<double>(paramID->Get(), AAX_CString(p->GetNameForHost()), p->GetDefault(), AAX_CIPlugTaperDelegate<double>(p->GetMin(), p->GetMax(), p->GetShape()), AAX_CUnitDisplayDelegateDecorator<double>( AAX_CNumberDisplayDelegate<double>(), AAX_CString(p->GetLabelForHost())), p->GetCanAutomate()); param->SetNumberOfSteps(128); // TODO: check this https://developer.digidesign.com/index.php?L1=5&L2=13&L3=56 param->SetType(AAX_eParameterType_Continuous); break; } case IParam::kTypeInt: { param = new AAX_CParameter<int>(paramID->Get(), AAX_CString(p->GetNameForHost()), (int)p->GetDefault(), AAX_CLinearTaperDelegate<int>((int)p->GetMin(), (int)p->GetMax()), AAX_CUnitDisplayDelegateDecorator<int>( AAX_CNumberDisplayDelegate<int>(), AAX_CString(p->GetLabelForHost())), p->GetCanAutomate()); param->SetNumberOfSteps(128); param->SetType(AAX_eParameterType_Continuous); break; } case IParam::kTypeEnum: case IParam::kTypeBool: { int nTexts = p->GetNDisplayTexts(); std::map<int, AAX_CString> displayTexts; for (int j=0; j<p->GetNDisplayTexts(); j++) { int value; const char* text = p->GetDisplayTextAtIdx(j, &value); displayTexts.insert(std::pair<int, AAX_CString>(value, AAX_CString(text)) ); } param = new AAX_CParameter<int>(paramID->Get(), AAX_CString(p->GetNameForHost()), (int)p->GetDefault(), AAX_CLinearTaperDelegate<int>((int)p->GetMin(), (int)p->GetMax()), AAX_CStringDisplayDelegate<int>(displayTexts), p->GetCanAutomate()); param->SetNumberOfSteps(nTexts); param->SetType(AAX_eParameterType_Discrete); break; } default: break; } mParameterManager.AddParameter(param); } AAX_CSampleRate sr; Controller()->GetSampleRate(&sr); SetSampleRate(sr); Reset(); return AAX_SUCCESS; }