/// <summary> /// Create a new <see cref="DeviceSinkCommand"/>. /// </summary> /// <param name="bufferOffset">The offset of the mix buffer.</param> /// <param name="sink">The <see cref="BaseSink"/> of the device sink.</param> /// <param name="sessionId">The current audio renderer session id.</param> /// <param name="buffer">The mix buffer in use.</param> /// <param name="nodeId">The node id associated to this command.</param> public void GenerateDeviceSink(uint bufferOffset, DeviceSink sink, int sessionId, Memory <float> buffer, int nodeId) { DeviceSinkCommand command = new DeviceSinkCommand(bufferOffset, sink, sessionId, buffer, nodeId); command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command); AddCommand(command); }
public DeviceSinkCommand(uint bufferOffset, DeviceSink sink, int sessionId, Memory <float> buffers, int nodeId) { Enabled = true; NodeId = nodeId; DeviceName = Encoding.ASCII.GetString(sink.Parameter.DeviceName).TrimEnd('\0'); SessionId = sessionId; InputCount = sink.Parameter.InputCount; InputBufferIndices = new ushort[InputCount]; for (int i = 0; i < InputCount; i++) { InputBufferIndices[i] = (ushort)(bufferOffset + sink.Parameter.Input[i]); } if (sink.UpsamplerState != null) { Buffers = sink.UpsamplerState.OutputBuffer; } else { Buffers = buffers; } }