-
Notifications
You must be signed in to change notification settings - Fork 7
New tts #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
New tts #31
Changes from all commits
0193037
1d18c7d
f98e0a0
3450309
eaf589c
ebda1ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,8 @@ public VoiceMaskNameChangeWindow() | |
| OnNameChange?.Invoke(NameSelector.Text); | ||
| }; | ||
|
|
||
| ReloadVoices(); // Art-TTS | ||
|
|
||
| SpeechVerbSelector.OnItemSelected += args => | ||
| { | ||
| OnVerbChange?.Invoke((string?) args.Button.GetItemMetadata(args.Id)); | ||
|
|
@@ -69,7 +71,7 @@ private void AddVerb(string name, string? verb) | |
| SpeechVerbSelector.SelectId(id); | ||
| } | ||
|
|
||
| public void UpdateState(string name, string? verb, bool active, bool accentHide) | ||
| public void UpdateState(string name, string voice, string? verb, bool active, bool accentHide) // Art-TTS | ||
| { | ||
| NameSelector.Text = name; | ||
| _verb = verb; | ||
|
|
@@ -84,5 +86,10 @@ public void UpdateState(string name, string? verb, bool active, bool accentHide) | |
| break; | ||
| } | ||
| } | ||
| // Art-TTS Start | ||
| var voiceIdx = _voices.FindIndex(v => v.ID == voice); | ||
| if (voiceIdx != -1) | ||
| VoiceSelector.Select(voiceIdx); | ||
| // Art-TTS End | ||
|
Comment on lines
+89
to
+93
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Поиск объявления поля _voices в файлах VoiceMaskNameChangeWindow
fd -e cs -e xaml 'VoiceMaskNameChangeWindow' --exec grep -l "_voices" {} \;
rg -n "_voices" --type cs -C 3Repository: ss14-art/open-space Length of output: 3171 🏁 Script executed: wc -l Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.csRepository: ss14-art/open-space Length of output: 124 🏁 Script executed: cat -n Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs | head -50Repository: ss14-art/open-space Length of output: 1879 🏁 Script executed: rg -n "private.*_voices|_voices\s*=" "Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs"Repository: ss14-art/open-space Length of output: 45 🏁 Script executed: cat -n Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs | tail -50Repository: ss14-art/open-space Length of output: 1834 🏁 Script executed: rg -n "ReloadVoices\|class VoiceMaskNameChangeWindow" "Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs"Repository: ss14-art/open-space Length of output: 45 🏁 Script executed: fd -type f -name "*.cs" "Content.Client/VoiceMask/"Repository: ss14-art/open-space Length of output: 233 🏁 Script executed: rg -l "VoiceMaskNameChangeWindow" "Content.Client/VoiceMask/"Repository: ss14-art/open-space Length of output: 177 🏁 Script executed: cat Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs | head -100Repository: ss14-art/open-space Length of output: 1831 🏁 Script executed: rg -n "_voices|ReloadVoices" "Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs"Repository: ss14-art/open-space Length of output: 45 🏁 Script executed: rg -n "private.*ReloadVoices\|public.*ReloadVoices" "Content.Client/"Repository: ss14-art/open-space Length of output: 45 🏁 Script executed: grep -n "ReloadVoices" "Content.Client/_Art/TTS/VoiceMaskNameChangeWindow.xaml.cs"Repository: ss14-art/open-space Length of output: 97 Поле Класс 🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| using Content.Shared.Audio; | ||
|
|
||
| namespace Content.Client.Audio; | ||
|
|
||
| public sealed partial class ContentAudioSystem : SharedContentAudioSystem | ||
| { | ||
| public const float TtsMultiplier = 3f; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,71 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using System.Linq; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Client._Art.TTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Client.Lobby; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // using Content.Corvax.Interfaces.Shared; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared._Art.TTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared.Preferences; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace Content.Client.Lobby.UI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public sealed partial class HumanoidProfileEditor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private List<TTSVoicePrototype> _voiceList = new(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private void InitializeVoice() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _voiceList = _prototypeManager | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .EnumeratePrototypes<TTSVoicePrototype>() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .OrderBy(o => Loc.GetString(o.Name)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .OrderBy(o => ((o.Gender == "male") ? 0b01 : 0) + ((o.Gender == "female") ? 0b10 : 0)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .ToList(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| VoiceButton.OnItemSelected += args => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| VoiceButton.SelectId(args.Id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SetVoice(_voiceList[args.Id].ID); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| VoicePlayButton.OnPressed += _ => PlayPreviewTTS(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+14
to
+29
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Если этот метод вызывается больше одного раза, 💡 Предлагаемое исправление+ private bool _voiceHandlersHooked;
+
private void InitializeVoice()
{
_voiceList = _prototypeManager
.EnumeratePrototypes<TTSVoicePrototype>()
.OrderBy(o => Loc.GetString(o.Name))
.OrderBy(o => ((o.Gender == "male") ? 0b01 : 0) + ((o.Gender == "female") ? 0b10 : 0))
.ToList();
- VoiceButton.OnItemSelected += args =>
+ if (_voiceHandlersHooked)
+ return;
+
+ VoiceButton.OnItemSelected += args =>
{
VoiceButton.SelectId(args.Id);
SetVoice(_voiceList[args.Id].ID);
};
VoicePlayButton.OnPressed += _ => PlayPreviewTTS();
+ _voiceHandlersHooked = true;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private void UpdateTTSVoicesControls() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (Profile is null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| VoiceButton.Clear(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var firstVoiceChoiceId = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (var i = 0; i < _voiceList.Count; i++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var voice = _voiceList[i]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var name = Loc.GetString(voice.Name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| VoiceButton.AddItem(name, i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (firstVoiceChoiceId == 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| firstVoiceChoiceId = i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var voiceChoiceId = _voiceList.FindIndex(x => x.ID == Profile.Voice); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!VoiceButton.TrySelectId(voiceChoiceId) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| VoiceButton.TrySelectId(firstVoiceChoiceId)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SetVoice(_voiceList[firstVoiceChoiceId].ID); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private void PlayPreviewTTS() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (Profile is null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _entManager.System<TTSSystem>().RequestPreviewTTS(Profile.Voice); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private void SetVoice(string newVoice) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Profile = Profile?.WithVoice(newVoice); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| IsDirty = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Локализуйте новые UI-строки через
Loc.На Line 11 и Line 19 добавлены хардкод-строки, что ломает единый i18n-поток для интерфейса настроек.
💡 Предлагаемый фикс
Also applies to: 19-19
🤖 Prompt for AI Agents