本文整理汇总了C++中IParam类的典型用法代码示例。如果您正苦于以下问题:C++ IParam类的具体用法?C++ IParam怎么用?C++ IParam使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IParam类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetParameterFromPlug
void IGraphics::SetParameterFromPlug(int paramIdx, double value, bool normalized)
{
if (!normalized)
{
IParam* pParam = mPlug->GetParam(paramIdx);
value = pParam->GetNormalized(value);
}
int i, n = mControls.GetSize();
IControl** ppControl = mControls.GetList();
for (i = 0; i < n; ++i, ++ppControl)
{
IControl* pControl = *ppControl;
if (pControl->ParamIdx() == paramIdx)
{
//WDL_MutexLock lock(&mMutex);
pControl->SetValueFromPlug(value);
// Could be more than one, don't break until we check them all.
}
// now look for any auxilliary parameters
int auxParamIdx = pControl->AuxParamIdx(paramIdx);
if (auxParamIdx > -1) // there are aux params
{
pControl->SetAuxParamValueFromPlug(auxParamIdx, value);
}
}
}
示例2: GetParam
ParamValue PLUGIN_API IPlugVST3Plugin::plainParamToNormalized(ParamID tag, ParamValue plainValue)
{
IParam* param = GetParam(tag);
if (param)
{
return param->GetNormalized(plainValue);
}
return plainValue;
}
示例3: GetParam
ParamValue PLUGIN_API IPlugVST3::getParamNormalized(ParamID tag)
{
IParam* param = GetParam(tag);
if (param)
{
return param->GetNormalized();
}
return 0.0;
}
示例4: Draw
bool ICaptionControl::Draw(IGraphics* pGraphics)
{
IParam* pParam = mPlug->GetParam(mParamIdx);
char cStr[32];
pParam->GetDisplayForHost(cStr);
mStr.Set(cStr);
if (mShowParamLabel) {
mStr.Append(" ");
mStr.Append(pParam->GetLabelForHost());
}
return ITextControl::Draw(pGraphics);
}
示例5: ClampControl
void IGraphics::ClampControl(int paramIdx, double lo, double hi, bool normalized)
{
if (!normalized) {
IParam* pParam = mPlug->GetParam(paramIdx);
lo = pParam->GetNormalized(lo);
hi = pParam->GetNormalized(hi);
}
int i, n = mControls.GetSize();
IControl** ppControl = mControls.GetList();
for (i = 0; i < n; ++i, ++ppControl) {
IControl* pControl = *ppControl;
if (pControl->ParamIdx() == paramIdx) {
pControl->Clamp(lo, hi);
}
// Could be more than one, don't break until we check them all.
}
}
示例6: SetParameterFromPlug
void IGraphics::SetParameterFromPlug(int paramIdx, double value, bool normalized)
{
if (!normalized) {
IParam* pParam = mPlug->GetParam(paramIdx);
value = pParam->GetNormalized(value);
}
int i, n = mControls.GetSize();
IControl** ppControl = mControls.GetList();
for (i = 0; i < n; ++i, ++ppControl) {
IControl* pControl = *ppControl;
if (pControl->ParamIdx() == paramIdx) {
//WDL_MutexLock lock(&mMutex);
pControl->SetValueFromPlug(value);
// Could be more than one, don't break until we check them all.
}
}
}
示例7: sizeof
ComponentResult IPlugProcess::SetChunk(OSType chunkID, SFicPlugInChunk *chunk)
{
TRACE;
if (chunkID == mPluginID)
{
int dataSize = chunk->fSize - sizeof(SFicPlugInChunkHeader);
ByteChunk IPlugChunk;
IPlugChunk.PutBytes(chunk->fData, dataSize);
mPlug->UnserializeState(&IPlugChunk, 0);
for (int i = 0; i< mPlug->NParams(); i++)
{
IParam *p = mPlug->GetParam(i);
int idx = i+kPTParamIdxOffset;
switch (p->Type())
{
case IParam::kTypeDouble:
{
CPluginControl_Continuous *control = dynamic_cast<CPluginControl_Continuous*>(GetControl(idx));
SetControlValue(idx, control->ConvertContinuousToControl( p->Value() ));
break;
}
case IParam::kTypeInt:
case IParam::kTypeEnum:
case IParam::kTypeBool:
{
CPluginControl_Discrete *control = dynamic_cast<CPluginControl_Discrete*>(GetControl(idx));
SetControlValue(idx, control->ConvertDiscreteToControl( p->Int() ));
break;
}
default:
break;
}
}
fNumPlugInChanges++;
return noErr;
}
return kChunkRangeErr;
}
示例8: DumpParamList
void DumpParamList(IParamIterator *pli,int indent)
{
QString indentStr;
indentStr.fill(' ',indent);
IParam *par;
for (pli->toFirst();(par=pli->current());pli->toNext())
{
ILinkedTextIterator *lti = par->type();
QString parType = linkedTextToString(lti);
lti->release();
lti = par->defaultValue();
QString defVal = linkedTextToString(lti);
lti->release();
printf("%sParam type=%s decl_name=%s def_name=%s defvalue=%s\n",
indentStr.data(), parType.latin1(),
par->declarationName()->latin1(),
par->definitionName()->latin1(),
defVal.latin1());
}
}
示例9: return
ParamValue PLUGIN_API IPlugVST3Plugin::getParamNormalized(ParamID tag)
{
if (tag == kBypassParam)
{
return (ParamValue) mIsBypassed;
}
// else if (tag == kPresetParam)
// {
// return (ParamValue) ToNormalizedParam(mCurrentPresetIdx, 0, NPresets(), 1.);
// }
IParam* param = GetParam(tag);
if (param)
{
return param->GetNormalized();
}
return 0.0;
}
示例10: NotifyAll
void CEntityComponent::NotifyAll(IParam ¶m)
{
for (std::list<ISubscriber *>::iterator it = m_listSubscriber.begin();
it != m_listSubscriber.end(); ++it)
{
CommonSubscriber *subscriber = (CommonSubscriber *)*it;
std::string strSubscriberName = subscriber->GetSubscriberName();
std::string strPublisherName = GetPublisherName();
if (strSubscriberName.empty() || strPublisherName.empty() || param.ExistParam(strSubscriberName))
{
subscriber->OnNotify(param);
}
else
{
param.SetParam(strSubscriberName, strPublisherName);
subscriber->OnNotify(param);
param.RemoveParam(strSubscriberName);
}
}
}
示例11: GetParam
void Synthesis::CreateParams() {
for (int i = 0; i < kNumParams; i++) {
IParam* param = GetParam(i);
const parameterProperties_struct& properties = parameterProperties[i];
switch (i) {
// Int parameters:
case mNumPartials:
param->InitInt(properties.name,
10, // default
1, // min
200); // max
break;
// Bool parameters:
// case mNoisyTransient:
// param->InitBool(properties.name, true);
// break;
// Double parameters:
default:
param->InitDouble(properties.name,
properties.defaultVal,
properties.minVal,
properties.maxVal,
parameterStep);
break;
}
}
/// set shape for knobs
GetParam(mB)->SetShape(5);
GetParam(mNumPartials)->SetShape(1);
/// initialize correct default parameter values on load
for (int i = 0; i < kNumParams; i++) {
OnParamChange(i);
}
}
示例12: GetParam
void SpaceBass::CreateParams() {
for (int i = 0; i < kNumParams; i++) {
IParam* param = GetParam(i);
const parameterProperties_struct& properties = parameterProperties[i];
switch (i) {
// Enum Parameters:
case mOsc1Waveform:
case mOsc2Waveform:
param->InitEnum(properties.name,
Oscillator::OSCILLATOR_MODE_SAW,
Oscillator::kNumOscillatorModes);
// For VST3:
param->SetDisplayText(0, properties.name);
break;
case mLFOWaveform:
param->InitEnum(properties.name,
Oscillator::OSCILLATOR_MODE_TRIANGLE,
Oscillator::kNumOscillatorModes);
// For VST3:
param->SetDisplayText(0, properties.name);
break;
case mFilterMode:
param->InitEnum(properties.name,
Filter::FILTER_MODE_LOWPASS,
Filter::kNumFilterModes);
break;
// Double Parameters:
default:
param->InitDouble(properties.name,
properties.defaultVal,
properties.minVal,
properties.maxVal,
parameterStep);
break;
}
}
GetParam(mFilterCutoff)->SetShape(2);
GetParam(mVolumeEnvAttack)->SetShape(3);
GetParam(mFilterEnvAttack)->SetShape(3);
GetParam(mVolumeEnvDecay)->SetShape(3);
GetParam(mFilterEnvDecay)->SetShape(3);
GetParam(mVolumeEnvSustain)->SetShape(2);
GetParam(mFilterEnvSustain)->SetShape(2);
GetParam(mVolumeEnvRelease)->SetShape(3);
GetParam(mFilterEnvRelease)->SetShape(3);
for (int i = 0; i < kNumParams; i++) {
OnParamChange(i);
}
}
示例13: OnNotify
void ActivenessComponent::OnNotify(IParam ¶m)
{
std::string strActiveModule;
param.GetParam(std::string("activeness"), strActiveModule);
int nTargetType = ActivenessTargetConfig::GetTypeFromName(strActiveModule);
ActivenessTargetConfig targetConfig;
if (!ActivenessDataManager::Instance().GetTarget(nTargetType, targetConfig))
{
return;
}
// 根据当前时间充值活动数据
ResetActivinessData(time(NULL));
ActivenessTarget* pTarget = ActivenessTargetFactory::Instance().CreateTarget(targetConfig);
if (pTarget == NULL)
{
return;
}
// 用于自动释放内存
std::auto_ptr<ActivenessTarget> tempPtr(pTarget);
// 设置数据
pTarget->SetProgress(GetTargetProgress(nTargetType));
if (nTargetType == ActivenessTargetConfig::EType_DanceMode)
{
((ActivenessDanceModeTarget*)pTarget)->SetFinishedDanceMode(m_setFinishedDanceMode);
}
//目标是否完成
if (pTarget->IsTargetComplete())
{
return;
}
// 更新目标进度
if (pTarget->UpdateProgress(param))
{
// 更新component进度
UpdateTarget(*pTarget);
}
// 更新活跃度
if (pTarget->IsTargetComplete())
{
AddActiveness(pTarget->GetTargetScore(), nTargetType);
if (CanGetReward())
{
// 重新通知前端
SendActivenessInfo();
}
// 增加舞团试炼活力值
CommonParam commonParam;
commonParam.SetParam("dance_group_active", pTarget->GetTargetScore());
NotifyAll(commonParam);
}
SaveActivinessDataToDb(); // 保存数据
}
示例14: lock
VstIntPtr VSTCALLBACK IPlugVST::VSTDispatcher(AEffect *pEffect, VstInt32 opCode, VstInt32 idx, VstIntPtr value, void *ptr, float opt)
{
// VSTDispatcher is an IPlugVST class member, we can access anything in IPlugVST from here.
IPlugVST* _this = (IPlugVST*) pEffect->object;
if (!_this)
{
return 0;
}
IPlugBase::IMutexLock lock(_this);
// Handle a couple of opcodes here to make debugging easier.
switch (opCode)
{
case effEditIdle:
case __effIdleDeprecated:
#ifdef USE_IDLE_CALLS
_this->OnIdle();
#endif
return 0;
}
Trace(TRACELOC, "%d(%s):%d:%d", opCode, VSTOpcodeStr(opCode), idx, (int) value);
switch (opCode)
{
case effOpen:
{
_this->HostSpecificInit();
_this->OnParamReset();
return 0;
}
case effClose:
{
lock.Destroy();
DELETE_NULL(_this);
return 0;
}
case effGetParamLabel:
{
if (idx >= 0 && idx < _this->NParams())
{
strcpy((char*) ptr, _this->GetParam(idx)->GetLabelForHost());
}
return 0;
}
case effGetParamDisplay:
{
if (idx >= 0 && idx < _this->NParams())
{
_this->GetParam(idx)->GetDisplayForHost((char*) ptr);
}
return 0;
}
case effGetParamName:
{
if (idx >= 0 && idx < _this->NParams())
{
strcpy((char*) ptr, _this->GetParam(idx)->GetNameForHost());
}
return 0;
}
//could implement effGetParameterProperties to group parameters, but can't find a host that supports it
// case effGetParameterProperties:
// {
// if (idx >= 0 && idx < _this->NParams())
// {
// VstParameterProperties* props = (VstParameterProperties*) ptr;
//
// props->flags = kVstParameterSupportsDisplayCategory;
// props->category = idx+1;
// props->numParametersInCategory = 1;
// strcpy(props->categoryLabel, "test");
// }
// return 1;
// }
case effGetParameterProperties:
{
if (idx >= 0 && idx < _this->NParams())
{
VstParameterProperties* props = (VstParameterProperties*) ptr;
props->flags = 0;
IParam* pParam = _this->GetParam(idx);
if (pParam->Type() == IParam::kTypeBool) {
props->flags |= kVstParameterIsSwitch;
}
if (pParam->Type() == IParam::kTypeEnum || pParam->Type() == IParam::kTypeInt) {
props->flags |= kVstParameterUsesFloatStep;
int possibleValuesCount = (int) (pParam->GetMax() - pParam->GetMin());
props->stepFloat = 1.0 / possibleValuesCount;
props->smallStepFloat = props->stepFloat;
props->largeStepFloat = props->stepFloat;
}
}
return 1;
}
case effString2Parameter:
{
if (idx >= 0 && idx < _this->NParams())
{
if (ptr)
//.........这里部分代码省略.........
示例15: AddControl
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();
}
}