Skip to content

Make realtime effect settings of duplicated track independent... - #4325

Closed
Paul-Licameli wants to merge 1 commit into
audacity:masterfrom
Paul-Licameli:Deep-copy-realtime-effect-states
Closed

Paul-Licameli wants to merge 1 commit into
audacity:masterfrom
Paul-Licameli:Deep-copy-realtime-effect-states

Conversation

@Paul-Licameli

@Paul-Licameli Paul-Licameli commented Feb 17, 2023 •

Copy link
Copy Markdown
Collaborator

... Note that RealtimeEffectList::Clone() was correct as originally written when it held states by unique_ptr, but then the change to shared_ptr introduced this problem.

Resolves: #4169

(short description of the changes and the motivation to make the changes)

  • I signed CLA
  • The title of the pull request describes an issue it addresses
  • If changes are extensive, then there is a sequence of easily reviewable commits
  • Each commit's message describes its purpose and effects
  • There are no behavior changes unnecessary for the stated purpose of the PR

Recommended:

  • Each commit compiles and runs on my machine without known undesirable changes of behavior

... Note that RealtimeEffectList::Clone() was correct as originally written
when it held states by unique_ptr, but then the change to shared_ptr introduced
this problem.
auto result = std::make_unique<RealtimeEffectList>();
for (auto &pState : mStates)
result->mStates.push_back(pState);
result->mStates.push_back(pState->Clone());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it breaks the undo/redo stack. I remember that shallow copy was used there for a reason. @dozzzzer can you please check?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good point.

Define what "break" means exactly, but there may be some other visible change of behavior. This code will also be visited when pushing undo items.

Undo items in memory may occupy more storage.

The state of sliders in dialogs, although not causing an undo push or pop when you change them directly, will be snap-shotted whenever the undo stack is pushed for other reasons, and restored to previous state when you undo.

I had raised the question whether this would be desired and intended undo/redo behavior or not. It was decided, not. But now, this change would make it so.

So there may be more work to pass more information about how Clone() is reached, and change its behavior only in the case you get there from the Duplicate editing command.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider this PR just draft, then. The good new is that the cause of the reported bug is known and easily fixable but for the other side effects of the fix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I remember the problem is that UI state is "pinned" to a specific RealtimeEffectState. So at some point UI modifies the state which is stored in the history, not the one used by the processor.

This might be no longer a problem, as we've made a lot of changes on top. We need to regress all effect families carefully, specifically when using Undo/Redo with UI open.

@Paul-Licameli
Paul-Licameli marked this pull request as draft February 17, 2023 17:39
@ianalarina ianalarina added this to the Audacity 3.3.1 milestone Apr 24, 2023
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.

The realtime effect settings of a duplicated track are not independent

4 participants