Skip to content

Conversation

@igubanov
Copy link
Contributor

@igubanov igubanov commented Oct 21, 2023

tts engines offer various voices, this change introduces the option to choose which voice to use

@igubanov igubanov requested a review from Danily07 November 28, 2023 21:22

public void UpdateVoice(IList<string> voices)
{
var currentVoice = voices.Contains(CurrentVoice) ? CurrentVoice : voices.First();
Copy link
Collaborator

Choose a reason for hiding this comment

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

unused variable?


public string[] GetVoices() => _voices;

public void SetVoice(string voice) => _voice = _voices.First(x => x.Equals(voice, StringComparison.OrdinalIgnoreCase));
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a bug, exception occurred when TTS with voice is selected, then user switch to another TTS. Need to set TtsConfiguration.CurrentVoice after(before) this update.

public TtsConfiguration TtsSettings { get; set; }

// NOTE: wfp doesnt update combobox source for non-static propertions or properties from non-singletone class 💀, I cant find another workaround
public static ObservableCollection<string> AvailableVoices { get; } = new();
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is some problem with VM instances... I will investigate it further and come back with update

Copy link
Collaborator

Choose a reason for hiding this comment

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

I got it. VM has scoped lifetime, but TtsFactory receives another VM instance (out of main scope), so UpdateVoice is called also on that wrong instance. Generally speaking, it the consequence of incorrect dependency (factory shouldn't update external component).
Let's get back to implementation with AvailableVoices in TTSConfiguration :) But with updating outside Factory (in ProcessingService). It's still not the best option though, but I have further plans for more global refactoring in that part VM <--> ProcessingService

@Danily07
Copy link
Collaborator

Hi, sorry for such long delay with answer. Now I got back to development and left some comments

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.

2 participants