Esempio n. 1
0
        /// <summary>
        /// Create a new <see cref="PcmInt16DataSourceCommandVersion1"/>.
        /// </summary>
        /// <param name="voiceState">The <see cref="VoiceState"/> to generate the command from.</param>
        /// <param name="state">The <see cref="VoiceUpdateState"/> to generate the command from.</param>
        /// <param name="outputBufferIndex">The output buffer index to use.</param>
        /// <param name="channelIndex">The target channel index.</param>
        /// <param name="nodeId">The node id associated to this command.</param>
        public void GeneratePcmInt16DataSourceVersion1(ref VoiceState voiceState, Memory <VoiceUpdateState> state, ushort outputBufferIndex, ushort channelIndex, int nodeId)
        {
            PcmInt16DataSourceCommandVersion1 command = new PcmInt16DataSourceCommandVersion1(ref voiceState, state, outputBufferIndex, channelIndex, nodeId);

            command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command);

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

            float costPerSample = 710.143f;
            float baseCost      = 7853.286f;

            if (_sampleCount == 160)
            {
                costPerSample = 427.52f;
                baseCost      = 6329.442f;
            }

            return((uint)(baseCost + (costPerSample * (((command.SampleRate / 200.0f) / _sampleCount) * (command.Pitch * 0.000030518f)))));
        }
Esempio n. 3
0
        public uint Estimate(PcmInt16DataSourceCommandVersion1 command)
        {
            Debug.Assert(_sampleCount == 160 || _sampleCount == 240);

            float costPerSample = 1195.5f;
            float baseCost      = 7797.0f;

            if (_sampleCount == 160)
            {
                costPerSample = 749.27f;
                baseCost      = 6138.9f;
            }

            return((uint)(baseCost + (costPerSample * (((command.SampleRate / 200.0f) / _sampleCount) * (command.Pitch * 0.000030518f)))));
        }
Esempio n. 4
0
 public uint Estimate(PcmInt16DataSourceCommandVersion1 command)
 {
     return((uint)(command.Pitch * 0.25f * 1.2f));
 }