示例#1
0
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);
  }
}
示例#2
0
文件: Vega.cpp 项目: eriser/VegaVST
void Vega::CreateParams() {
  for (int i = 0; i < kNumParams; i++) {
    IParam* param = GetParam(i);
    const paramProperties& properties = paramProps[i];
    switch (i) {
      // Enum Parameters:
    case mOsc1Wave:
    case mOsc2Wave:
    case mOsc3Wave:
    case mLFOWave:
      param->InitEnum(properties.name,
        Oscillator::OSCILLATOR_MODE_SAW,
        Oscillator::kNumOscillatorModes);
      // For VST3:
      param->SetDisplayText(0, properties.name);
      break;
    case mFilterType:
      param->InitEnum(properties.name,
        Filter::FILTER_MODE_LOWPASS,
        Filter::kNumFilterModes);
      param->SetDisplayText(0, properties.name);
      break;
      // Integer Parameters (Using double notation)
    case mOsc1Oct:
    case mOsc2Oct:
    case mOsc3Oct:
    case mOsc1Pitch:
    case mOsc2Pitch:
    case mOsc3Pitch:
    case mOsc1Phase:
    case mOsc2Phase:
    case mOsc3Phase:
    case mBendRange:
    case mOsc1Voices:
    case mOsc2Voices:
    case mOsc3Voices:
    case mFilterSlope:
      param->InitInt(properties.name,
        (int)properties.defaultVal,
        (int)properties.minVal,
        (int)properties.maxVal);
      break;
      // Double Parameters:
    default:
      param->InitDouble(properties.name,
        properties.defaultVal,
        properties.minVal,
        properties.maxVal,
        parameterStep);
      break;
    }
  }
  GetParam(mVolAttack)->SetShape(3);
  GetParam(mVolDecay)->SetShape(3);
  GetParam(mVolSustain)->SetShape(2);
  GetParam(mVolRelease)->SetShape(3);
  GetParam(mFilterCutoff)->SetShape(2);
  GetParam(mFilterCtlCutoff)->SetShape(2);
  GetParam(mFilterAttack)->SetShape(3);
  GetParam(mFilterDecay)->SetShape(3);
  GetParam(mFilterSustain)->SetShape(2);
  GetParam(mFilterRelease)->SetShape(3);

  for (int i = 0; i < kNumParams; i++) {
    OnParamChange(i);
  }
}