-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO fix minor bugs about slider undo&redo
- Loading branch information
Showing
7 changed files
with
276 additions
and
196 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
using Avalonia; | ||
using Mirivoice.Mirivoice.Core.Format; | ||
using Mirivoice.ViewModels; | ||
using Serilog; | ||
|
||
namespace Mirivoice.Commands | ||
{ | ||
public enum ExpVITS2 | ||
{ | ||
Speed = 0, | ||
Noise1 = 1, | ||
Noise2 = 2, | ||
} | ||
|
||
public class VITS2SetExpCommand : ICommand | ||
{ | ||
int undoMem; | ||
int redoMem; | ||
|
||
readonly ExpressionEditViewModelVITS2 viewModel; | ||
readonly ExpVITS2 mode; | ||
public VITS2SetExpCommand(ExpressionEditViewModelVITS2 viewModel, ExpVITS2 mode) | ||
{ | ||
//Log.Debug("LineEditCommand created"); | ||
this.mode = mode; | ||
this.viewModel = viewModel; | ||
switch (mode) | ||
{ | ||
case ExpVITS2.Speed: | ||
undoMem = viewModel.VITS2Speed; | ||
break; | ||
case ExpVITS2.Noise1: | ||
undoMem = viewModel.VITS2Noise1; | ||
break; | ||
case ExpVITS2.Noise2: | ||
undoMem = viewModel.VITS2Noise2; | ||
break; | ||
default: | ||
Log.Error("VITS2 Exp editor -- Invalid mode"); | ||
break; | ||
} | ||
} | ||
|
||
|
||
bool isFirstExec = true; | ||
public void Execute(bool isRedoing) | ||
{ | ||
if (isRedoing) | ||
{ | ||
switch (mode) | ||
{ | ||
case ExpVITS2.Speed: | ||
viewModel.VITS2Speed = redoMem; | ||
break; | ||
case ExpVITS2.Noise1: | ||
viewModel.VITS2Noise1 = redoMem; | ||
break; | ||
case ExpVITS2.Noise2: | ||
viewModel.VITS2Noise2 = redoMem; | ||
break; | ||
default: | ||
Log.Error("VITS2 Exp editor -- Invalid mode"); | ||
break; | ||
} | ||
} | ||
else | ||
{ | ||
if (!isFirstExec) | ||
{ | ||
switch (mode) | ||
{ | ||
case ExpVITS2.Speed: | ||
undoMem = viewModel.VITS2Speed; | ||
break; | ||
case ExpVITS2.Noise1: | ||
undoMem = viewModel.VITS2Noise1; | ||
break; | ||
case ExpVITS2.Noise2: | ||
undoMem = viewModel.VITS2Noise2; | ||
break; | ||
default: | ||
Log.Error("VITS2 Exp editor -- Invalid mode"); | ||
break; | ||
} | ||
} | ||
isFirstExec = false; | ||
} | ||
} | ||
|
||
public void UnExecute() | ||
{ | ||
switch (mode) | ||
{ | ||
case ExpVITS2.Speed: | ||
redoMem = viewModel.VITS2Speed; | ||
viewModel.VITS2Speed = undoMem; | ||
break; | ||
case ExpVITS2.Noise1: | ||
redoMem = viewModel.VITS2Noise1; | ||
viewModel.VITS2Noise1 = undoMem; | ||
break; | ||
case ExpVITS2.Noise2: | ||
redoMem = viewModel.VITS2Noise2; | ||
viewModel.VITS2Noise2 = undoMem; | ||
break; | ||
default: | ||
Log.Error("VITS2 Exp editor -- Invalid mode"); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Oops, something went wrong.