本文整理汇总了C++中IParam::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ IParam::Set方法的具体用法?C++ IParam::Set怎么用?C++ IParam::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IParam
的用法示例。
在下文中一共展示了IParam::Set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VSTDispatcher
//.........这里部分代码省略.........
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)
{
double v;
IParam* pParam = _this->GetParam(idx);
if (pParam->GetNDisplayTexts())
{
int vi;
if (!pParam->MapDisplayText((char*)ptr, &vi)) return 0;
v = (double)vi;
}
else
{
v = atof((char*)ptr);
if (pParam->DisplayIsNegated()) v = -v;
}
if (_this->GetGUI()) _this->GetGUI()->SetParameterFromPlug(idx, v, false);
pParam->Set(v);
_this->OnParamChange(idx);
}
return 1;
}
return 0;
}
case effSetSampleRate:
{
_this->SetSampleRate(opt);
_this->Reset();
return 0;
}
case effSetBlockSize:
{
_this->SetBlockSize(value);
_this->Reset();
return 0;
}
case effMainsChanged:
{
if (!value)
{
_this->OnActivate(false);
_this->Reset();
}
else
{
_this->OnActivate(true);
}
return 0;
}
示例2: VSTDispatcher
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;
}
case effString2Parameter:
{
if (idx >= 0 && idx < _this->NParams())
{
if (ptr)
{
IParam* pParam = _this->GetParam(idx);
double v = VSTString2Parameter(pParam, (char*)ptr);
if (_this->GetGUI()) _this->GetGUI()->SetParameterFromPlug(idx, v, false);
pParam->Set(v);
_this->OnParamChange(idx);
}
return 1;
}
return 0;
}
case effSetSampleRate: {
_this->SetSampleRate(opt);
_this->Reset();
return 0;
}
case effSetBlockSize: {
_this->SetBlockSize(value);
_this->Reset();
return 0;
}
case effMainsChanged: {
if (!value) {
_this->OnActivate(false);
_this->Reset();
}
else {
_this->OnActivate(true);
}
return 0;
}
case effEditGetRect: {
if (ptr && _this->GetGUI()) {
*(ERect**) ptr = &(_this->mEditRect);
return 1;
}
ptr = 0;
return 0;
}
case effEditOpen:
{
//.........这里部分代码省略.........