OpenUtau icon indicating copy to clipboard operation
OpenUtau copied to clipboard

[Help wanted] Support asynchronous batch edits

Open yqzhishen opened this issue 7 months ago • 0 comments

Some batch edits like DiffSinger autopitch may execute really slowly and block the UI. This PR supports running batch edits asynchronously, with a dialog showing progress of the running batch edit.

Major changes:

  • Add a property IsAsync to OpenUtau.Core.Editing.BatchEdit to declare if the batch edit should be run asynchronously.
  • Add a method RunAsync() to OpenUtau.Core.Editing.BatchEdit to run the batch edit asynchronously, with a callback to set the progress and a cancellation token to check if the process is cancelled by user. This method has the same behaviour like Run() if not overridden by its implementation classes.
  • Adds a static method ShowProcessing() to OpenUtau.App.Views.MessageBox for running a task in the background and show a modal dialog for manipulating the progress.
  • Make OpenUtau.Core.Editing.NoteBatchEdit to run asynchronously.

Problem

I did not figure out how to visit the instance of the pianoroll window. But I need that because the progress dialog should have it as the parent window, so I temporarily changed OpenUtau.App.Views.MainWindow.pianoRollWindow to public. I know this is not the proper way, but how can I do this without violating the rule of member visibility?

yqzhishen avatar Dec 02 '23 12:12 yqzhishen