Skip to content

ossia: hand the control values to the host through triple buffers - #210

Open
jcelerier wants to merge 1 commit into
mainfrom
feature/mixer
Open

jcelerier wants to merge 1 commit into
mainfrom
feature/mixer

Conversation

@jcelerier

Copy link
Copy Markdown
Member

Part of the ossia score mixer work (ossia/score feature/mixer).

The ossia binding handed control values to the host through unbounded queues that the host drained down to their last element. Each tick's enqueue copied the whole tuple of values, allocating on the audio thread whenever a value holds memory (e.g. a std::vector<float> output), and grew without bound while nothing read it.

They are now ossia::triple_buffers (ins_buffer, outs_buffer):

  • The node copies the values field by field into a slot that was written before, so values that hold memory keep their capacity. Once every slot has been written, publishing does not allocate.
  • The host reads the latest value in place, which is all it ever used.
  • notify_ui moves to controls_queue and gates the inputs as well as the outputs: when the host installs no reader, nothing is copied.

Needs ossia/libossia feature/mixer, which gives triple_buffer its in-place write and read and gives the trivially copyable case the same interface, so the binding also builds with AVND_USE_TUPLET_TUPLE.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HKbSZft9tvQ2sm9KeSchMX

The host only reads the latest values; a queue grew while nobody read it
and allocated on every tick. The values are now copied field by field into
a buffer that was written before, which does not allocate once warm, and
not at all when the host does not listen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HKbSZft9tvQ2sm9KeSchMX

This branch has not been deployed

No deployments
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