The core thread now only copies raw samples into the buffer. The callback runs
all input through SoundTouch, and controls the tempo on its output buffer.
Reallocation locks out the callback, since WASAPI and XAudio2 don't wait for it.
SoundTouch holds about tempo * sequence length of input, so the tempo is limited
to what the buffer can hold, and input beyond that is dropped. On a reset the
held input is processed at the new speed and trimmed, instead of becoming a
backlog. Stale input after a long output stall is dropped.
Compute the tempo relative to the nominal rate, so it no longer has to integrate
its way there and can go inactive at speeds other than 100%. Smooth it with an
exponential moving average instead of a 256-entry history, which also reduces
overshoot after a reset. Resample mode nudges the tempo by up to 0.5% to
compensate for clock drift, instead of running open loop.
The writer moved the read position on overrun, and the reset counter was
modified from the audio thread. Each side also loaded the other's ring position
relaxed, so the reader could see stale samples on weakly ordered CPUs.
The fill threshold was ~3ms, so recovery immediately squashed a partial buffer
into the callback and flagged another underrun. The target also has to cover two
callbacks, otherwise the stretcher keeps the buffer below what a callback needs.
Mirror latch writes, add chip erase, return DATA polling status when a read
ends a page load, erase pages at load start so bytes may load in any order,
show ID/status for code reads without side effects, and pad images with FFh.
Allocate the code and block LUTs as one block on system initialize, covering
at least 8MB of RAM, and EXP1 only when a PIO device is enabled.
Reallocate when a state changes the RAM size or the PIO device changes.
Fixes it getting lost when restarting with a normal state, or getting
disconnected from the actual file when there is no media and we are just
running ps-exe.
Register an ID3D12InfoQueue1 message callback when the debug device is
enabled, so that validation messages end up in the log, similar to the
Vulkan debug messenger. Useful for users without a debugger attached, and
for the regression tester.
Also drop break-on-error/warning, breakpoints can be placed in the
callback instead.
When allocating behind the GPU, the full space up to the GPU position was
handed out. If a caller committed all of it (e.g. vertex batches that fill
the mapped space), the offset would equal the GPU position, which the
allocator interprets as the GPU having caught up, and subsequent
allocations would overwrite data still referenced by the current command
list. Reserve one byte, matching the Vulkan stream buffer.
Fixes corruption in Jumping Flash in the regression tester, where command
lists can span hundreds of frames due to presentation being skipped.