From 03f79cb0b9563c865a7e74605a81da63aa4feee2 Mon Sep 17 00:00:00 2001 From: yamachu Date: Tue, 5 Mar 2024 19:41:39 +0900 Subject: [PATCH 1/3] =?UTF-8?q?core=E3=81=AE=E3=82=B3=E3=83=94=E3=83=BC?= =?UTF-8?q?=E5=85=83=E3=82=92=E9=81=B8=E3=81=B9=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/cli/cli.csproj | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/examples/cli/cli.csproj b/examples/cli/cli.csproj index 38b8894..2606bb6 100644 --- a/examples/cli/cli.csproj +++ b/examples/cli/cli.csproj @@ -29,6 +29,10 @@ false --> + + voicevox_core + + @@ -72,14 +76,14 @@ see: https://learn.microsoft.com/en-us/dotnet/core/compatibility/deployment/8.0/rid-asset-list --> - - - + + + - - - + + + From 7ad48aaac068258d78aefbe173deb5edda082165 Mon Sep 17 00:00:00 2001 From: yamachu Date: Tue, 5 Mar 2024 19:41:58 +0900 Subject: [PATCH 2/3] =?UTF-8?q?resource=E3=82=82=E5=A0=B4=E6=89=80?= =?UTF-8?q?=E3=82=92=E5=A4=89=E3=81=88=E3=82=8B=E3=81=93=E3=81=A8=E3=81=8C?= =?UTF-8?q?=E5=87=BA=E6=9D=A5=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/cli/Program.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/cli/Program.cs b/examples/cli/Program.cs index 4e21da4..1ad5cf1 100644 --- a/examples/cli/Program.cs +++ b/examples/cli/Program.cs @@ -9,9 +9,9 @@ const string OutputWavName = "audio.wav"; const uint StyleId = 0; -static int RunTts(string text) +static int RunTts(string text, string? resourcePath = "voicevox_core") { - var openJTalkDictPath = "voicevox_core/open_jtalk_dic_utf_8-1.11"; + var openJTalkDictPath = $"{resourcePath}/open_jtalk_dic_utf_8-1.11"; Console.WriteLine("coreの初期化中"); @@ -35,7 +35,7 @@ static int RunTts(string text) var matcher = new Matcher(); matcher.AddIncludePatterns(new[] { "*.vvm" }); - foreach (var path in matcher.GetResultsInFullPath("./voicevox_core/model")) + foreach (var path in matcher.GetResultsInFullPath($"{resourcePath}/model")) { result = VoiceModel.New(path, out var voiceModel); if (result != ResultCode.RESULT_OK) @@ -82,10 +82,14 @@ static int RunTts(string text) { text }; + +var resourcePath = new Option("--resource", "リソースディレクトリパス"); +command.AddOption(resourcePath); command.SetHandler((context) => { var textValue = context.ParseResult.GetValueForArgument(text); - returnCode = RunTts(textValue); + var resourceValue = context.ParseResult.GetValueForOption(resourcePath); + returnCode = RunTts(textValue, resourceValue); }); returnCode = command.Invoke(args); From 812aa23d85dff5b8f66dfa9c8aa7ff0f17ac9344 Mon Sep 17 00:00:00 2001 From: yamachu Date: Tue, 5 Mar 2024 19:44:17 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E8=A8=98=E6=86=B6=E3=81=AB=E3=81=A8?= =?UTF-8?q?=E3=81=A9=E3=82=81=E3=81=A6=E3=81=8A=E3=81=8F=E3=81=9F=E3=82=81?= =?UTF-8?q?=E3=81=ABMakefile=E3=81=AB=E6=AE=8B=E3=81=97=E3=81=A6=E3=81=8A?= =?UTF-8?q?=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/cli/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/cli/Makefile b/examples/cli/Makefile index e408297..09de856 100644 --- a/examples/cli/Makefile +++ b/examples/cli/Makefile @@ -6,3 +6,7 @@ publish/aot/osx-arm64: validate/memory/osx-arm64: RESULT=result.txt validate/memory/osx-arm64: leaks --atExit -- ./bin/Release/net8.0/osx-arm64/publish/cli Hello > $(RESULT) + +run/.local: TEXT= +run/.local: + dotnet run "$(TEXT)" --resource=../../.local/voicevox_core -p CoreBasePath=../../.local/voicevox_core