Skip to content

Commit

Permalink
Fixed minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
EX3exp committed Oct 14, 2024
1 parent 932bf39 commit e704d09
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
5 changes: 4 additions & 1 deletion Mirivoice/Mirivoice.Core/Managers/AudioManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,12 @@ private void OnPlaybackStopped(object? sender, EventArgs e)
{
Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(() =>
{

Log.Information("Playback stopped.");
v.isPlaying = false;
if (audioPaths.Count == 0) // when stopped
{
v.isPlaying = false;

if (!_player.Paused)
{
v.EnableGlobalPlay = true;
Expand Down Expand Up @@ -457,6 +459,7 @@ public void StopAudio()
audioPaths.Clear();
v.MainWindowGetInput = true;
MainViewModelPlaying = false;
v.isPlaying = false;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ await Dispatcher.UIThread.InvokeAsync(async () =>
{
prosodyType = ProsodyType.Space;
}
results[index] = new MResultPrototype(word.Trim(), phoneme.Trim(), editable, prosodyType);
results[index] = new MResultPrototype(words[index].Trim(), phoneme.Trim(), editable, prosodyType);
}
else
{
Expand All @@ -267,11 +267,11 @@ await Dispatcher.UIThread.InvokeAsync(async () =>
{
Log.Error($"[Variated Sentence({words.Length})] - [Sentence length({variatedWords.Length})] mismatch");

results[index] = new MResultPrototype(word.Trim(), phoneme.Trim(), editable, ProsodyType.Undefined);
results[index] = new MResultPrototype(variatedWords[index].Trim(), phoneme.Trim(), editable, ProsodyType.Undefined);
}
else
{
results[index] = new MResultPrototype(word.Trim(), phoneme.Trim(), editable, ProsodyType.Undefined);
results[index] = new MResultPrototype(words[index].Trim(), phoneme.Trim(), editable, ProsodyType.Undefined);
}
}

Expand Down Expand Up @@ -329,8 +329,8 @@ public static MResultPrototype[] SetUpProsody(LineBoxView l, List<MResultPrototy

if (next is not null && IsPunctuation(next.Phoneme) && endPuncs.Contains(next.Phoneme))
{
Log.Debug($"Next is punctuation: {next.Phoneme}");
Log.Debug($"Current: {mResultPrototype.Phoneme}");
//Log.Debug($"Next is punctuation: {next.Phoneme}");
//Log.Debug($"Current: {mResultPrototype.Phoneme}");
mResultPrototype.ProsodyType = (int)ProsodyType.Eos;
}
if (i == results.Count - 1 && prev is not null && prev.ProsodyType != (int)ProsodyType.Eos)
Expand Down
13 changes: 9 additions & 4 deletions Mirivoice/Views/LineBoxView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ private async Task PhonemizeLine(bool ApplyToCurrentEdit = true)
v.OnPropertyChanged(nameof(v.SingleTextBoxEditorEnabled));

}
if (!lastPhonemizedText.Equals(textChanged))
{
IsCacheIsVaild = false;
}
if (viewModel.phonemizer is null)
{
Log.Error("Skip Phonemizing: phonemizer is null");
Expand All @@ -135,14 +139,15 @@ private async Task PhonemizeLine(bool ApplyToCurrentEdit = true)
{
Log.Warning("Skip Phonemizing: phonemizer is not null, but LineText is empty");
}
else if (IsCacheIsVaild)
{
Log.Information("Skip Phonemizing: Cache is valid");
}

else if (lastPhonemizedText.Equals(textChanged))
{
Log.Information("Skip Phonemizing: text is not changed");
}
else if (IsCacheIsVaild)
{
Log.Information("Skip Phonemizing: Cache is valid");
}
else
{
Log.Debug("Phonemizing: {0}", textChanged);
Expand Down

0 comments on commit e704d09

Please sign in to comment.