当前位置: 首页>>代码示例>>C++>>正文


C++ IParam类代码示例

本文整理汇总了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);
    }
  }
}
开发者ID:AdrianGin,项目名称:Pathogen,代码行数:28,代码来源:IGraphics.cpp

示例2: GetParam

ParamValue PLUGIN_API IPlugVST3Plugin::plainParamToNormalized(ParamID tag, ParamValue plainValue)
{
  IParam* param = GetParam(tag);

  if (param)
  {
    return param->GetNormalized(plainValue);
  }

  return plainValue;
}
开发者ID:brightening-eyes,项目名称:wdl-amirfj,代码行数:11,代码来源:IPlugVST3Plugin.cpp

示例3: GetParam

ParamValue PLUGIN_API IPlugVST3::getParamNormalized(ParamID tag)
{
  IParam* param = GetParam(tag);  
  
  if (param)
  {
    return param->GetNormalized();
  }
  
  return 0.0;
}
开发者ID:b-vesco,项目名称:wdl-ol,代码行数:11,代码来源:IPlugVST3.cpp

示例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);
}
开发者ID:b-vesco,项目名称:wdl-ol,代码行数:12,代码来源:IControl.cpp

示例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.
  }
}
开发者ID:b-vesco,项目名称:wdl-ol,代码行数:17,代码来源:IGraphics.cpp

示例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.
    }
  }
}
开发者ID:b-vesco,项目名称:wdl-ol,代码行数:17,代码来源:IGraphics.cpp

示例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;
}
开发者ID:0x4d52,项目名称:wdl-ol,代码行数:45,代码来源:IPlugProcess.cpp

示例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());
  }
}
开发者ID:Acidburn0zzz,项目名称:doxygen,代码行数:20,代码来源:main.cpp

示例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;
}
开发者ID:brightening-eyes,项目名称:wdl-amirfj,代码行数:20,代码来源:IPlugVST3Plugin.cpp

示例10: NotifyAll

void CEntityComponent::NotifyAll(IParam &param)
{
    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);
        }
    }
}
开发者ID:yzfrs,项目名称:ddianle_d1,代码行数:22,代码来源:EntityComponent.cpp

示例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);
  }
}
开发者ID:UIKit0,项目名称:gpu-synth,代码行数:36,代码来源:Synthesis.cpp

示例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);
  }
}
开发者ID:Add9Sus4,项目名称:Synthesis,代码行数:49,代码来源:SpaceBass.cpp

示例13: OnNotify

void ActivenessComponent::OnNotify(IParam &param)
{
    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(); // 保存数据
}
开发者ID:yzfrs,项目名称:ddianle_d1,代码行数:62,代码来源:ActivenessComponent.cpp

示例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)
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例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();
  }
}
开发者ID:0x4d52,项目名称:wdl-ol,代码行数:73,代码来源:IPlugProcess.cpp


注:本文中的IParam类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。