Dsd Dop Output
Exact native DSD to DoP framing for an independently confirmed DoP route. Input is chronological interleaved bytes with the oldest bit in bit 7. One byte-frame can be held across writes; drain completes an incomplete final pair with the DSD idle byte 0x69 as its later byte, under the next marker. Position and latency use DSD byte-frames at the bit rate divided by eight.
Properties
Whether the output is bit-perfect, and how well that can be known; see BitPerfectState.
Frames between the host and the DAC: what is buffered plus what is in flight.
Frames that have actually played since the start or the last flush, in the output's own frame rate. Silence inserted while paused or underrun does not count. Audible position is startPosition + playedFrames / frameRate.
How many bytes a writer should write now: the room up to the target depth, a whole number of frames. A pull loop writes this much and sleeps when it is 0. It is a target, not a hard limit.
Functions
Discards everything buffered and resets playedFrames to 0. Use it for a seek, a stop, or a track the user picked; it keeps a deep buffer from costing responsiveness. On the direct USB output with DacConfig.cancelInFlightOnFlush (on by default), the output thread also asks the host controller to cancel the submitted transfers that carry music from before the flush, waits up to a second for them to be handed back (the stream fails if they are not), and sends silence until the ring refills. A transfer that completes before its cancellation takes effect still plays, and no time to silence is guaranteed. With the flag off, or on the managed output, audio already on the bus or in the platform's last buffer may still be heard.
Writes whole frames from the buffer's position and advances the position by the bytes taken. Direct buffers are read in place; a heap buffer is copied. Returns the bytes taken, which can be less than buffer.remaining() (the output is full: keep the rest and try again), and 0 for a partial frame. On success the return value equals the position delta. Accepted source frames may be held in a converter before playback; use playedFrames for playback position. Keep the remaining buffer after a failure. For INVALID_ARGUMENT, correct the layout or padding before retrying; do not silently truncate or mask samples.