Skip to content

TODO: Make sound file updates thread-safe across all generators #1250

Description

@PrincePundir123

Description:-

In the generated C and C++ code, soundfile updates are not fully thread-safe yet.
Some parts still have TODOs for a safe state switch.
Because of that, in real-time audio threads, updates can sometimes cause glitches, random behavior, or occasional crashes.

Impact:-

This problem affects multiple backends, not just one.
It can make generated audio code unstable when the host is changing settings, reloading, or reconfiguring, and may lead to sync-related bugs.

Affected Locations/ Files;-

cpp_code_container.cpp
c_code_container.cpp
code_container.hh

Proposed fix:-

1=> Add a real thread-safe switch for soundfile state updates (replace TODO parts).
2=> Use the same safe approach in both C and C++ generated code.
3=> Add tests for fast/repeated updates and concurrent update cases.
4=> Make sure audio performance stays the same in normal realtime compute loops.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions