コード例 #1
0
        /// <summary>
        /// Constructs a new instance based on the parameter type information.
        /// </summary>
        /// <param name="parameterInfo">Must not be null.</param>
        /// <remarks>The <see cref="VstParameterInfo.ParameterManager"/> property is set to <b>this</b> instance.</remarks>
        public VstParameterManager(VstParameterInfo parameterInfo)
        {
            Throw.IfArgumentIsNull(parameterInfo, nameof(parameterInfo));

            ParameterInfo = parameterInfo;
            ParameterInfo.ParameterManager = this;
        }
コード例 #2
0
ファイル: VstParameter.cs プロジェクト: whinkloss/vst.net
        /// <summary>
        /// Constructs a new instance based on the parameter meta info.
        /// </summary>
        /// <param name="parameterInfo">Must not be null.</param>
        public VstParameter(VstParameterInfo parameterInfo)
        {
            Throw.IfArgumentIsNull(parameterInfo, nameof(parameterInfo));

            Info = parameterInfo;

            if (Info.ParameterManager != null)
            {
                Info.ParameterManager.SubscribeTo(this);
            }

            // set default value
            Value = Info.DefaultValue;
        }
コード例 #3
0
        /// <summary>
        /// Attaches the normalization info to the <paramref name="paramInfo"/>.
        /// </summary>
        /// <param name="paramInfo">Must not be null.</param>
        /// <remarks>Making this call enables the Framework to transparently normalize the parameter value,
        /// untill the host retrieves the parameter properties (info).
        /// Not making this call will always provide the host with the raw parameter value.</remarks>
        public static void AttachTo(VstParameterInfo paramInfo)
        {
            Throw.IfArgumentIsNull(paramInfo, nameof(paramInfo));
            if (paramInfo.NormalizationInfo != null)
            {
                throw new InvalidOperationException(Properties.Resources.VstParameterNormalizationInfo_AlreadyAttached);
            }
            if (!paramInfo.IsMinMaxIntegerValid)
            {
                throw new ArgumentException(Properties.Resources.VstParameterNormalizationInfo_ParameterInfoInvalid, nameof(paramInfo));
            }

            paramInfo.NormalizationInfo             = new VstParameterNormalizationInfo();
            paramInfo.NormalizationInfo.ScaleFactor = paramInfo.MaxInteger - paramInfo.MinInteger;
            paramInfo.NormalizationInfo.NullOffset  = -paramInfo.MinInteger;
        }