TomHarte / CLK

A latency-hating emulator of: the Acorn Electron and Archimedes, Amstrad CPC, Apple II/II+/IIe and early Macintosh, Atari 2600 and ST, ColecoVision, Enterprise 64/128, Commodore Vic-20 and Amiga, MSX 1/2, Oric 1/Atmos, early PC compatibles, Sega Master System, Sinclair ZX80/81 and ZX Spectrum.
MIT License
911 stars 50 forks source link

Improve SampleSource infrastructure. #1328

Closed TomHarte closed 5 months ago

TomHarte commented 5 months ago

This is front running some of the stuff that will make the MockingBoard feasible, but isn't strictly tied to that goal.

Primarily:

  1. introduce separate types for mono and stereo samples;
  2. what are currently sample sources become buffer sources, because they deal in whole buffers. The concept of a sample source is introduced, which is something which provides a single sample at a time;
  3. skip_samples and get_samples are combined into apply_samples which takes any one of three semantic options as a template argument — store, mix or ignore — with 'mix' being an addition for in-place accumulation of audio buffers that are within a compound source; and
  4. compound sources can avoid initialising buffers with a zero-fill, sometimes. Whereas previously they couldn't.