public override string ConvertData1ToString(double Data1)
 {
     if (Enum.IsDefined(typeof(MssParameterID), (int)Data1))
     {
         MssParamInfo paramInfo = this.paramViewer.GetParameterInfoCopy((MssParameterID)Data1);
         return(paramInfo.Name);
     }
     else
     {
         return("");
     }
 }
Beispiel #2
0
 protected void OnProgramActivated()
 {
     //Send the info for each parameter from MssParameters to the host.
     foreach (MssParameterID paramId in MssParameterID.GetValues(typeof(MssParameterID)))
     {
         if (MssParameters.PRESET_PARAM_ID_LIST.Contains(paramId) && mssParameters.GetActiveMappingExists() == false)
         {
             MssParameters_ValueChanged(paramId, 0);
             MssParameters_NameChanged(paramId, MssParameters.GetDefaultPresetName(paramId));
         }
         else
         {
             MssParamInfo mssParamInfo = this.mssParameters.GetParameterInfoCopy(paramId);
             MssParameters_ValueChanged(paramId, mssParamInfo.GetValue());
             MssParameters_NameChanged(paramId, mssParamInfo.Name);
         }
     }
 }
Beispiel #3
0
        /// <summary>
        ///     Generates an instance of VstParameterInfo using information about an MSS parameter.
        /// </summary>
        /// <param name="paramId">Specifies the MSS parameter to get information from</param>
        /// <returns></returns>
        protected VstParameterInfo MssToVstParameterInfo(MssParameterID paramId)
        {
            // retrieve the category for all variable parameters.
            VstParameterCategory paramCategory =
                this.pluginPrograms.GetParameterCategory(DEFAULT_PARAMETER_CATEGORY_NAME);

            // Variable parameter
            VstParameterInfo paramInfo = new VstParameterInfo();

            paramInfo.Category       = paramCategory;
            paramInfo.CanBeAutomated = true;

            if (MssParameters.PRESET_PARAM_ID_LIST.Contains(paramId))
            {
                paramInfo.Name         = MssParameters.GetDefaultPresetName(paramId);
                paramInfo.DefaultValue = 0;
            }
            else if (MssParameters.VARIABLE_PARAM_ID_LIST.Contains(paramId))
            {
                MssParamInfo mssParamInfo = this.mssParameters.GetParameterInfoCopy(paramId);
                paramInfo.Name         = GetParamNameFromString(mssParamInfo.Name);
                paramInfo.DefaultValue = (float)this.mssParameters.GetRelativeParamValue(paramId);
            }
            else
            {
                Debug.Assert(false);
            }

            paramInfo.Label          = "";
            paramInfo.ShortLabel     = "";
            paramInfo.MinInteger     = VST_PARAM_MIN_VALUE;
            paramInfo.MaxInteger     = VST_PARAM_MAX_VALUE;
            paramInfo.LargeStepFloat = ((float)(VST_PARAM_MAX_VALUE - VST_PARAM_MIN_VALUE)) / 8;
            paramInfo.SmallStepFloat = ((float)(VST_PARAM_MAX_VALUE - VST_PARAM_MIN_VALUE)) / 128;
            paramInfo.StepFloat      = 0.03125f;
            VstParameterNormalizationInfo.AttachTo(paramInfo);

            return(paramInfo);
        }
        protected void ParameterValueChanged(MssParameterID paramId, double newValue)
        {
            lock (MssComponentHub.criticalSectioinLock)
            {
                if (this.hostInfoOutput.SampleRateIsInitialized == false)
                {
                    return;
                }

                long watchOffestAtParamChanged = this.stopwatch.Elapsed.Ticks;

                MssParamInfo paramInfo = this.mssParameters.GetParameterInfoCopy(paramId);
                double       relValue  = CustomMathUtils.AbsToRelVal(paramInfo.MinValue, paramInfo.MaxValue, newValue);

                MssMsg paramMsg = new MssMsg(MssMsgType.Parameter,
                                             (int)paramId,
                                             MssMsgUtil.UNUSED_MSS_MSG_DATA,
                                             relValue);
                MssEvent paramEvent = new MssEvent();

                paramEvent.mssMsg = paramMsg;

                long   ticksSinceCycleEnd   = watchOffestAtParamChanged - this.watchOffestAtLastCycleEnd;
                double secondsSinceCycleEnd = ticksSinceCycleEnd / (double)TimeSpan.TicksPerSecond;
                long   samplesSinceCycleEnd = (long)Math.Round(secondsSinceCycleEnd * this.hostInfoOutput.SampleRate);

                //Sometimes the stopwatch may not be accurate enough to notice the difference
                //between the end of the last cycle and now. Setting samplesSinceCycleEnd to
                //1 will cause this event to happen at the very start of this processing cycle.
                if (samplesSinceCycleEnd == 0)
                {
                    samplesSinceCycleEnd = 1;
                }

                paramEvent.sampleTime = this.sampleTimeAtLastCycleEnd + samplesSinceCycleEnd;

                this.dryEventInput.ReceiveDryMssEvent(paramEvent);
            }
        }
        protected override void SetMappingDlgEntryFieldCustomProperties()
        {
            this.EntryField1Lbl.Visible = true;
            this.EntryField1Lbl.Text    = "Parameter Name:";
            this.EntryField1.Visible    = true;

            for (int i = 0; i < MssParameters.ALL_PARAMS_ID_LIST.Count; i++)
            {
                MssParameterID curId = MssParameters.ALL_PARAMS_ID_LIST[i];

                if (MssParameters.PRESET_PARAM_ID_LIST.Contains(curId) &&
                    this.mappingDlg.UseMappingEntryForDefaultValues == false)
                {
                    ((ComboBox)EntryField1).Items.Add(MssParameters.GetDefaultPresetName(curId));
                }
                else
                {
                    MssParamInfo curParamInfo = this.parameterViewer.GetParameterInfoCopy(curId);
                    ((ComboBox)EntryField1).Items.Add(curParamInfo.Name);
                }
            }

            ((ComboBox)EntryField1).SelectedIndex = 0;
        }