void ZKMORHP_StereoPanControl::SetValue(Float32 inValue) { SInt32 theRawValue = 0; Float32 theSpan; if(inValue == 0.5) { theRawValue = mCenterRawValue; } else if(inValue > 0.5) { theSpan = mFullRightRawValue - mCenterRawValue; inValue -= 0.5; inValue *= theSpan; inValue *= 2.0; theRawValue = static_cast<SInt32>(inValue); theRawValue += mCenterRawValue; } else { theSpan = mCenterRawValue - mFullLeftRawValue; inValue *= theSpan; inValue *= 2.0; theRawValue = static_cast<SInt32>(inValue); } SetRawValue(theRawValue); }
void TRegisterHandler::SetTextValue(const std::string& v) { if (reg.Scale == 1) SetRawValue(stoi(v)); else SetScaledValue(stod(v)); }
////////////////////////////////////////// // Class KeyValue implementation // KeyValue::KeyValue(KeyboardControl *pKeyCtrl, char *groupName) : nameValue( NULL ) { minValue = pKeyCtrl->GetFloat(groupName,"Min",0.0f); maxValue = pKeyCtrl->GetFloat(groupName,"Max",1.0f); delta = pKeyCtrl->GetFloat(groupName,"Delta",0.1f); rawValue = pKeyCtrl->GetFloat(groupName,"Init",0.0f); scale = pKeyCtrl->GetFloat(groupName,"Scale",1.0f); if( scale == 0.0f ) scale = 1.0f; // prevent divzero bias = pKeyCtrl->GetFloat(groupName,"Bias",0.0f); minRawValue = ( minValue - bias ) / scale; maxRawValue = ( maxValue - bias ) / scale; SetRawValue( rawValue ); char buffer[256]; strcpy(buffer,pKeyCtrl->GetString(groupName,"KeyIncrease","1")); keyIncrease = buffer[0]; strcpy(buffer,pKeyCtrl->GetString(groupName,"KeyDecrease","Q")); keyDecrease = buffer[0]; nameValue = new char[strlen(groupName)+1]; strcpy(nameValue,groupName); }
void KeyValue::Decrement() { rawValue -= delta; SetRawValue( rawValue ); }
void KeyValue::Increment() { rawValue += delta; SetRawValue( rawValue ); }
void ZKMORHP_LevelControl::SetDBValue(Float32 inDBValue) { SInt32 theNewRawValue = mVolumeCurve.ConvertDBToRaw(inDBValue); SetRawValue(theNewRawValue); }
void SetValueD(struct matrix *m, const int *indices, const double value) { assert(m->type_of_entry == DOUBLE); SetRawValue(m, (byte *)indices, (void *)&value); }
void SetValueF(struct matrix *m, const int *indices, const float value) { assert(m->type_of_entry == FLOAT); SetRawValue(m, (byte *)indices, (void *)&value); }
void TRegisterHandler::SetScaledValue(double v) { SetRawValue(round(v / reg.Scale)); }