/// <summary> /// Create a new <see cref="UpsampleCommand"/>. /// </summary> /// <param name="bufferOffset">The offset of the mix buffer.</param> /// <param name="upsampler">The <see cref="UpsamplerState"/> associated.</param> /// <param name="inputCount">The total input count.</param> /// <param name="inputBufferOffset">The input buffer mix offset.</param> /// <param name="bufferCountPerSample">The buffer count per sample.</param> /// <param name="sampleCount">The source sample count.</param> /// <param name="sampleRate">The source sample rate.</param> /// <param name="nodeId">The node id associated to this command.</param> public void GenerateUpsample(uint bufferOffset, UpsamplerState upsampler, uint inputCount, Span <byte> inputBufferOffset, uint bufferCountPerSample, uint sampleCount, uint sampleRate, int nodeId) { UpsampleCommand command = new UpsampleCommand(bufferOffset, upsampler, inputCount, inputBufferOffset, bufferCountPerSample, sampleCount, sampleRate, nodeId); command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command); AddCommand(command); }
public override void CleanUp() { UpsamplerState?.Release(); UpsamplerState = null; base.CleanUp(); }
public UpsampleCommand(uint bufferOffset, UpsamplerState info, uint inputCount, Span <byte> inputBufferOffset, uint bufferCount, uint sampleCount, uint sampleRate, int nodeId) { Enabled = true; NodeId = nodeId; InputBufferIndex = 0; OutBuffer = info.OutputBuffer; BufferCount = bufferCount; InputSampleCount = sampleCount; InputSampleRate = sampleRate; info.SourceSampleCount = inputCount; info.InputBufferIndices = new ushort[inputCount]; for (int i = 0; i < inputCount; i++) { info.InputBufferIndices[i] = (ushort)(bufferOffset + inputBufferOffset[i]); } UpsamplerInfo = info; }