Skip to content
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

ulTextLenを使用して、テキストの抽出処理を追加 #95

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions SAPIForVOICEVOX/VoiceVoxTTSEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,19 @@ public void Speak(uint dwSpeakFlags, ref Guid rguidFormatId, ref WAVEFORMATEX pW
goto SetNextData;
}

//XMLタグの抽出
Regex regex = new Regex(@"<.+?>", RegexOptions.IgnoreCase);
string sentenceExcludedXMLTag = regex.Replace(currentTextList.pTextStart, "");
if (string.IsNullOrWhiteSpace(sentenceExcludedXMLTag))
{
goto SetNextData;
}
//指定の範囲抽出
string text = currentTextList.pTextStart;
text = text.Substring(0, (int)currentTextList.ulTextLen);

//分割
string[] splitedString;
if (charSeparators.Count() == 0)
{
splitedString = new string[] { sentenceExcludedXMLTag };
splitedString = new string[] { text };
}
else
{
splitedString = sentenceExcludedXMLTag.Split(charSeparators.ToArray(), StringSplitOptions.RemoveEmptyEntries);
splitedString = text.Split(charSeparators.ToArray(), StringSplitOptions.RemoveEmptyEntries);
}

foreach (string str in splitedString)
Expand Down