Пример #1
0
        /// <summary>
        /// Generate a new <see cref="MixRampCommand"/>.
        /// </summary>
        /// <param name="previousVolume">The previous volume.</param>
        /// <param name="volume">The new volume.</param>
        /// <param name="inputBufferIndex">The input buffer index.</param>
        /// <param name="outputBufferIndex">The output buffer index.</param>
        /// <param name="lastSampleIndex">The index in the <see cref="VoiceUpdateState.LastSamples"/> array to store the ramped sample.</param>
        /// <param name="state">The <see cref="VoiceUpdateState"/> to generate the command from.</param>
        /// <param name="nodeId">The node id associated to this command.</param>
        public void GenerateMixRamp(float previousVolume, float volume, uint inputBufferIndex, uint outputBufferIndex, int lastSampleIndex, Memory <VoiceUpdateState> state, int nodeId)
        {
            MixRampCommand command = new MixRampCommand(previousVolume, volume, inputBufferIndex, outputBufferIndex, lastSampleIndex, state, nodeId);

            command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command);

            AddCommand(command);
        }
        public uint Estimate(MixRampCommand command)
        {
            Debug.Assert(_sampleCount == 160 || _sampleCount == 240);

            if (_sampleCount == 160)
            {
                return((uint)1968.7f);
            }

            return((uint)2459.4f);
        }
Пример #3
0
        public uint Estimate(MixRampCommand command)
        {
            Debug.Assert(_sampleCount == 160 || _sampleCount == 240);

            if (_sampleCount == 160)
            {
                return((uint)1859.0f);
            }

            return((uint)2286.1f);
        }
Пример #4
0
 public uint Estimate(MixRampCommand command)
 {
     return((uint)(_sampleCount * 14.4f * 1.2f));
 }