Skip to content

Commit

Permalink
Fixed phonemized texts not updating properly
Browse files Browse the repository at this point in the history
  • Loading branch information
EX3exp committed Oct 5, 2024
1 parent f3d581f commit d08fa53
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ protected override string Variate(string sentence)
{
next = words[i + 1];
}
//Log.Debug($"prev: {prev}, curr: {words[i]}, next: {next}");

phonemes.Add(KoreanPhonemizerUtil.Variate(prev, words[i], next));
prev = words[i];

Expand All @@ -203,7 +203,7 @@ protected override string Variate(string sentence)
{
next = null;
}

//Log.Debug($"prev: {prev}, curr: {words[i]}, next: {next}");
continue;
}
//Log.Debug("Phonemes: {phonemes}", phonemes);
Expand Down
19 changes: 13 additions & 6 deletions Mirivoice/Views/SingleLineEditorView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,22 @@ private async void LineTextChanging(object sender, TextChangingEventArgs e)
private void LineLostFocus(object sender, RoutedEventArgs e)
{
l.viewModel.LineText = viewModel.mTextBoxEditor.CurrentScript;
Log.Information("SingleLineTBox Lost Focus");
//Log.Information("SingleLineTBox Lost Focus");
//Log.Debug($"lastPhonemizedText={l.lastPhonemizedText} // LineText={l.viewModel.LineText}");
if (l.lastPhonemizedText != l.viewModel.LineText)
{
//Log.Debug("lastPhonemizedText != l.viewModel.LineText");
l.DeActivatePhonemizer = false;
ShouldPhonemizeWhenOutFocused = true;

}

if (ShouldPhonemizeWhenOutFocused)
{
//Log.Debug("ShouldPhonemizeWhenOutFocused");
l.ShouldPhonemize = true;
Task.Run(() => l.viewModel.phonemizer.PhonemizeAsync(viewModel.mTextBoxEditor.CurrentScript, l));
ShouldPhonemizeWhenOutFocused = false;
}

if (FirstUpdate)
Expand All @@ -65,11 +76,7 @@ private void LineLostFocus(object sender, RoutedEventArgs e)
Task.Run(() => l.viewModel.phonemizer.PhonemizeAsync(viewModel.mTextBoxEditor.CurrentScript, l));
return;
}
if (ShouldPhonemizeWhenOutFocused)
{
l.ShouldPhonemize = true;
ShouldPhonemizeWhenOutFocused = false;
}


if (! l.DeActivatePhonemizer || l.MResultsCollection.Count == 0 && !string.IsNullOrEmpty(l.viewModel.LineText))
{
Expand Down

0 comments on commit d08fa53

Please sign in to comment.