Repository navigation
AU: re-initialize when a restored ClassInfo arrives; rtrb 0.3.5 - #24
Merged
Merged
Conversation
Logic Pro initializes an AudioUnit and restores its saved ClassInfo afterwards. VST3 and CLAP re-run initialize() inside their state setters, but the AU wrapper only deserialized the parameters, so a plug-in that reads its state in initialize() (latency mode, engine choice) kept the defaults for the whole session. set_class_info is not serialised against render, so it now only flags the unit; the next Reset (serialised, main thread) runs the initialize body again, including the latency update and its notification. A failed re-initialization leaves the unit uninitialized, like a failed Initialize.
Reset alone was too late: Logic restores ClassInfo at project load but calls Reset only around a bounce, so ordinary playback kept the state read before the restore (the first bounce too). set_class_info now re-initializes immediately behind a gate that render takes for each slice: a render that finds the gate held by the restore outputs silence instead of touching the plug-in, and a restore that finds a render in flight waits up to 250 ms before leaving the work to the next Reset.
rtrb 0.2.3 has a double free / use-after-free in ReadChunk::commit when an element's Drop panics. The standalone backend only uses RingBuffer::new, push and pop, which 0.3 keeps.
auval, and Logic's validation which runs it, sets MaximumFramesPerSlice on the main thread and checks its listener right after the call returns: "Changing max frames property did not fire off a property changed notification". Since e49332f every notification waited for the 100 Hz run-loop timer. SetProperty now drains pending notifications before it returns when it runs on the main thread; other threads keep the timer. The wrapper borrow ends before the drain, so a listener that disposes the AU leaves nothing pointing into it.
master serialises AU lifecycle and render with processing_gate (AUD-2067) and notifies set_property listeners on the calling thread (bd819ab), which supersedes 565340d's main-thread-only drain. The ClassInfo re-initialization from f0742d3/2e7fe863 now runs under processing_gate instead of its own plugin_gate: set_class_info takes the gate (waiting out an in-flight render) and re-initializes; re-entered on the gate-holding thread it defers to the next Reset. restored_class_info_reinitializes_the_plugin fails without the re-initialization and passes with it; 159 lib tests pass.
Collaborator
Author
|
Resolved the conflict with master. master's processing_gate (AUD-2067) and calling-thread set_property notifications (bd819ab) supersede this branch's plugin_gate and 565340d's main-thread-only drain. The ClassInfo re-initialization now runs under processing_gate: set_class_info takes the gate, which waits out a render in flight. Re-entered on the gate-holding thread, it defers to the next Reset. restored_class_info_reinitializes_the_plugin was checked red/green; 159 lib tests and the full CI matrix pass. Merging with a merge commit so de-leak-rt's v0.2.0 pin 565340d stays in master's history. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Logic initializes an AU and then restores its ClassInfo. The restored state arrived after initialization, so a non-automatable choice made at load time, such as de-leak's Low latency mode, was not applied after reopening a project.
set_class_infonow re-initializes the plug-in right away, behind a render gate (plugin_gate: idle / rendering / reinit). Render outputs silence while the gate is held. A restore waits up to 250 ms for an in-flight render, then falls back to re-initializing on the next Reset (f0742d3).Pinned in de-leak-rt as
7e839ec5(Intrect-io/de-leak-rt#55). Checked in Logic Pro: Low applies after reopening, and real-time and offline bounces are bit-identical. REAPER and Live: no change.