Exemplo n.º 1
0
        /// <summary>
        /// Generate a new <see cref="LimiterCommandVersion2"/>.
        /// </summary>
        /// <param name="bufferOffset">The target buffer offset.</param>
        /// <param name="parameter">The limiter parameter.</param>
        /// <param name="state">The limiter state.</param>
        /// <param name="effectResultState">The DSP effect result state.</param>
        /// <param name="isEnabled">Set to true if the effect should be active.</param>
        /// <param name="workBuffer">The work buffer to use for processing.</param>
        /// <param name="nodeId">The node id associated to this command.</param>
        public void GenerateLimiterEffectVersion2(uint bufferOffset, LimiterParameter parameter, Memory <LimiterState> state, Memory <EffectResultState> effectResultState, bool isEnabled, ulong workBuffer, int nodeId)
        {
            if (parameter.IsChannelCountValid())
            {
                LimiterCommandVersion2 command = new LimiterCommandVersion2(bufferOffset, parameter, state, effectResultState, isEnabled, workBuffer, nodeId);

                command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command);

                AddCommand(command);
            }
        }
Exemplo n.º 2
0
        public uint Estimate(LimiterCommandVersion2 command)
        {
            Debug.Assert(_sampleCount == 160 || _sampleCount == 240);

            if (!command.Parameter.StatisticsEnabled || !command.IsEffectEnabled)
            {
                return(EstimateLimiterCommandCommon(command.Parameter, command.IsEffectEnabled));
            }

            if (_sampleCount == 160)
            {
                switch (command.Parameter.ChannelCount)
                {
                case 1:
                    return((uint)23309.0f);

                case 2:
                    return((uint)29954.0f);

                case 4:
                    return((uint)35807.0f);

                case 6:
                    return((uint)58340.0f);

                default:
                    throw new NotImplementedException($"{command.Parameter.ChannelCount}");
                }
            }

            switch (command.Parameter.ChannelCount)
            {
            case 1:
                return((uint)33526.0f);

            case 2:
                return((uint)43549.0f);

            case 4:
                return((uint)52190.0f);

            case 6:
                return((uint)85527.0f);

            default:
                throw new NotImplementedException($"{command.Parameter.ChannelCount}");
            }
        }
Exemplo n.º 3
0
 public uint Estimate(LimiterCommandVersion2 command)
 {
     return(0);
 }