Skip to content

Add appendable zero-copy PCM chunk streams - #2

Draft
linuxificator wants to merge 13 commits into
mainfrom
feature/pcm-chunk-stream
Draft

Add appendable zero-copy PCM chunk streams#2
linuxificator wants to merge 13 commits into
mainfrom
feature/pcm-chunk-stream

Conversation

@linuxificator

@linuxificator linuxificator commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Prepare AMY PCM playback for realtime producers such as an SD-card task without changing the existing ROM/memory/file PCM behavior.

Design:

  • caller-owned fixed descriptor ring; no allocation/copy in the audio render path
  • single-producer/single-consumer ownership with FREE/READY/PLAYING/DONE/CANCELLED states
  • producer may append chunks while playback is active
  • DONE/CANCELLED explicitly tells a ping-pong producer when the underlying memory is safe to overwrite
  • an empty unfinished stream waits and can resume when data is appended; finish() turns an empty queue into end-of-stream
  • contiguous pcm_load() and existing file/ROM PCM remain on their original path
  • one active oscillator per stream; polyphony uses separate stream instances/presets
  • sequential streams reject PCM loop modes and do not use the random-access fit stretcher

Tests cover ring ownership, live ping-pong reuse, underrun/resume, stop/cancellation, stream-vs-contiguous preset behavior, and the existing contiguous pcm_load() API.

Build integration includes root Makefile/setup.py plus explicit Godot and Daisy source lists. Arduino builds compile src/** automatically.

CI note: the fork carries upstream's C/C++ matrix. This branch also runs make ctest before make test, so the standalone PCM ownership regression is exercised once GitHub Actions is enabled for the fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant