├── .gitattributes ├── .github └── workflows │ ├── build.yml │ └── codeql-analysis.yml ├── .gitignore ├── LICENCE.rtf ├── LICENCE └── NAudioLicense.txt ├── LICENSE ├── README.md ├── SAPIForVOICEVOX.sln ├── SAPIForVOICEVOX ├── EnglishToKana │ ├── EnglishKanaDictionary.cs │ ├── Licence.txt │ └── eng2kanaDict.txt ├── Exception │ ├── VoiceNotificationException.cs │ ├── VoiceVoxConnectionException.cs │ ├── VoiceVoxEngineException.cs │ └── VoiceVoxNotFoundException.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── SAPIForVOICEVOX.csproj ├── VoiceVoxTTSEngine.cs ├── packages.config ├── エンジンエラーです.wav ├── ボイスボックスが見つかりません.wav └── ボイスボックスと通信ができません.wav ├── SAPIGetStaticValueLib ├── SAPIGetStaticValueLib.vcxproj ├── SAPIGetStaticValueLib.vcxproj.filters ├── Source.def ├── dllmain.cpp ├── framework.h ├── pch.cpp └── pch.h ├── SFVvCommon ├── Common.cs ├── Properties │ └── AssemblyInfo.cs ├── SFVvCommon.csproj ├── SapiStyle.cs ├── StyleBase.cs ├── StyleComparer.cs └── VoicevoxStyle.cs ├── Setting ├── App.config ├── App.xaml ├── App.xaml.cs ├── Converter │ ├── DoubleStringConverter.cs │ ├── ParameterValueModeToBool.cs │ └── SynthesisSettingModeToBool.cs ├── Model │ ├── GeneralSetting.cs │ ├── ParameterValueMode.cs │ ├── SynthesisParameter.cs │ └── SynthesisSettingMode.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Setting.csproj ├── View │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── VersionInfoWindow.xaml │ ├── VersionInfoWindow.xaml.cs │ ├── voicevoxParameterSlider.xaml │ └── voicevoxParameterSlider.xaml.cs ├── ViewModel │ └── ViewModel.cs ├── app.manifest └── icon │ ├── License.txt │ └── settings.ico ├── Setup └── Setup.vdproj ├── Setup64 └── Setup64.vdproj ├── SetupCustomActions ├── CustomActions.cs ├── Properties │ └── AssemblyInfo.cs └── SetupCustomActions.csproj ├── StyleRegistrationTool ├── App.config ├── App.xaml ├── App.xaml.cs ├── Licence │ └── WindowsAPICodePackLicence.txt ├── Model │ └── NameAndPort.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── StyleRegistrationTool.csproj ├── View │ ├── ChangePortWindow.xaml │ ├── ChangePortWindow.xaml.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── WaitingCircle.xaml │ └── WaitingCircle.xaml.cs ├── ViewModel │ └── MainViewModel.cs ├── app.manifest ├── icon │ ├── License.txt │ └── users-alt.ico └── packages.config └── tools └── change_version.csx /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build and Create Installer 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | tags: 7 | - "*" 8 | pull_request: 9 | branches: [ master ] 10 | workflow_dispatch: 11 | 12 | env: 13 | # Path to the solution file relative to the root of the project. 14 | SOLUTION_FILE_PATH: SAPIForVOICEVOX.sln 15 | 16 | # Configuration type to build. 17 | # You can convert this to a build matrix if you need coverage of multiple configuration types. 18 | # https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix 19 | BUILD_CONFIGURATION: Release 20 | 21 | artifactName: SAPIForVOICEVOXsetup 22 | 23 | permissions: 24 | contents: read 25 | 26 | jobs: 27 | build: 28 | runs-on: windows-2019 29 | strategy: 30 | fail-fast: false 31 | matrix: 32 | include: 33 | - platform: x86 34 | installerProjectPath: Setup\Setup.vdproj 35 | installerOutDir: Setup\Release 36 | bitLength: 32 37 | 38 | - platform: x64 39 | installerProjectPath: Setup64\Setup64.vdproj 40 | installerOutDir: Setup64\Release 41 | bitLength: 64 42 | 43 | steps: 44 | - uses: actions/checkout@v4 45 | 46 | - name: Setup .NET 47 | uses: actions/setup-dotnet@v4 48 | with: 49 | dotnet-version: 6.0.x 50 | 51 | - name: Install dotnet script 52 | run: dotnet tool install -g dotnet-script 53 | 54 | - name: Change Version 55 | if: startsWith(github.ref, 'refs/tags/') 56 | working-directory: ${{env.GITHUB_WORKSPACE}} 57 | run: dotnet script .\tools\change_version.csx -- .\ ${{github.ref_name}} 58 | 59 | - name: Add devenv to PATH 60 | uses: compnerd/gha-setup-vsdevenv@main 61 | 62 | - name: Restore NuGet packages 63 | working-directory: ${{env.GITHUB_WORKSPACE}} 64 | run: nuget restore ${{env.SOLUTION_FILE_PATH}} 65 | 66 | - name: Build 67 | working-directory: ${{env.GITHUB_WORKSPACE}} 68 | run: devenv.com ${{env.SOLUTION_FILE_PATH}} /build "${{env.BUILD_CONFIGURATION}}|${{matrix.platform}}" 69 | 70 | # エラー抑止のため必要 71 | - name: Run DisableOutOfProcBuild 72 | shell: cmd 73 | working-directory: ${{env.DevEnvDir}}CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild 74 | run: DisableOutOfProcBuild.exe 75 | 76 | - name: Create Installer 77 | working-directory: ${{env.GITHUB_WORKSPACE}} 78 | run: devenv.com ${{env.SOLUTION_FILE_PATH}} /project ${{matrix.installerProjectPath}} /build "${{env.BUILD_CONFIGURATION}}|${{matrix.platform}}" 79 | 80 | - name: Upload artifact 81 | uses: actions/upload-artifact@v4 82 | with: 83 | name: ${{env.artifactName}}${{matrix.bitLength}} 84 | path: ${{matrix.installerOutDir}} 85 | 86 | upload-to-release: 87 | needs: [build] 88 | if: startsWith(github.ref, 'refs/tags/') 89 | runs-on: windows-latest 90 | steps: 91 | - name: Download and extract artifact 92 | uses: actions/download-artifact@v4 93 | with: 94 | path: artifacts/ 95 | 96 | - name: Rearchive artifacts 97 | run: | 98 | mkdir release 99 | 100 | - name: Compress Installer 101 | shell: pwsh 102 | run: | 103 | Compress-Archive -Path artifacts/${{env.artifactName}}32 -DestinationPath release/${{env.artifactName}}32.zip 104 | Compress-Archive -Path artifacts/${{env.artifactName}}64 -DestinationPath release/${{env.artifactName}}64.zip 105 | 106 | - name: Upload to Release 107 | uses: softprops/action-gh-release@v2 108 | with: 109 | token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} 110 | draft: true 111 | body: | 112 | 下の、Assetsからダウンロードできます。 113 | 32bit版と64bit版があります。使用するアプリケーションに合わせて選択してください。 114 | 両方インストールすることができます。 115 | 末尾32が32bit版。末尾64が64bit版です。 116 | files: release/*.zip 117 | 118 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '22 16 * * 2' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: windows-2019 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'csharp' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 37 | # Learn more: 38 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 39 | 40 | steps: 41 | - name: Checkout repository 42 | uses: actions/checkout@v2 43 | 44 | # Initializes the CodeQL tools for scanning. 45 | - name: Initialize CodeQL 46 | uses: github/codeql-action/init@v2 47 | with: 48 | languages: ${{ matrix.language }} 49 | # If you wish to specify custom queries, you can do so here or in a config file. 50 | # By default, queries listed here will override any specified in a config file. 51 | # Prefix the list here with "+" to use these queries and those in the config file. 52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 53 | 54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 55 | # If this step fails, then you should remove it and run the build manually (see below) 56 | - name: Autobuild 57 | uses: github/codeql-action/autobuild@v2 58 | 59 | # ℹ️ Command-line programs to run using the OS shell. 60 | # 📚 https://git.io/JvXDl 61 | 62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 63 | # and modify them (or add more) to build your code if your project 64 | # uses a compiled language 65 | 66 | #- run: | 67 | # make bootstrap 68 | # make release 69 | 70 | - name: Perform CodeQL Analysis 71 | uses: github/codeql-action/analyze@v2 72 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd 364 | /download.txt 365 | /download2.txt 366 | /ReleaseDownloadCount.bat 367 | /ShowDownloadCount.bat 368 | -------------------------------------------------------------------------------- /LICENCE/NAudioLicense.txt: -------------------------------------------------------------------------------- 1 | Microsoft Public License (Ms-PL) 2 | 3 | This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. 4 | 5 | 1. Definitions 6 | 7 | The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. 8 | 9 | A "contribution" is the original software, or any additions or changes to the software. 10 | 11 | A "contributor" is any person that distributes its contribution under this license. 12 | 13 | "Licensed patents" are a contributor's patent claims that read directly on its contribution. 14 | 15 | 2. Grant of Rights 16 | 17 | (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. 18 | 19 | (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. 20 | 21 | 3. Conditions and Limitations 22 | 23 | (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. 24 | 25 | (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. 26 | 27 | (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. 28 | 29 | (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. 30 | 31 | (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 shigobu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SAPI For VOICEVOX 2 | Windows標準の音声合成機能の音声としてVOICEVOXが追加ができます。 3 | ![コンパネ音声合成](https://user-images.githubusercontent.com/32050537/131860902-7aedbd45-453a-4425-a33c-7cb4a2f2dcf1.png) 4 | SAPI5対応のアプリケーションから使用することができます。 5 | 現在、古い方の音声合成機能に対応しています。コントロールパネル→音声認識→音声合成 で表示される音声認識のプロパティ画面の音声の選択ドロップダウンに追加されます。 6 | 新しい方の、設定アプリ→時刻と言語→音声認識→音声→音声を選択するドロップダウンには表示されません。 7 | したがって、新しい方の音声合成機能しか対応していないアプリには対応していません。 8 | 9 | コントロールパネルはOSのbit数と同じで64bitアプリなので、64bit版の情報が表示され、32bit版の情報は表示されません。 10 | 32bit版のみをインストールすると、コントロールパネルには表示されませんが、棒読みちゃん等の32bitアプリには表示されます。 11 | 12 | 32bit版は、棒読みちゃんでテストしています。 13 | 64bit版は、やります!アンコちゃんでテストしています。 14 | 15 | ## 最新版のダウンロード 16 | 17 | 右側にある Releases をクリックするか、[ここ](https://github.com/shigobu/SAPIForVOICEVOX/releases/latest)をクリックしてリリースページに行きダウンロードしてください。 18 | 19 | ## 使用方法 20 | setup.exeを起動し、インストールしてください。 21 | 32bit版と64bit版が存在します。使用したいアプリケーションに応じて選択してください。 22 | 両方インストールすることもできます。その場合、同じ場所にインストールしないでください。 23 | インストール場所の初期値は「c:\SAPIForVOICEVOX(32or64)」になっています。 24 | 「C:\Program Files (x86)」へインストールしないでください。何故か正常にインストールできません。 25 | Cドライブ以外にインストールすると動作しない可能性があります。他にも正常にインストールできない場所があるかもしれません。棒読みちゃん等で「クラスが登録されていません」というエラーが発生した場合、インストール場所を初期値にして再インストールしてください。 26 | 27 | 利用には、「Visual C++ 再頒布可能パッケージ」の2019が必要です。 28 | インストールされていない場合、以下のリンクからダウンロードしインストールしてください。32bit版は「x86」、64bit版は「x64」をそれぞれインストールしてください。 29 | [Visual C++ 再頒布可能パッケージのダウンロード](https://docs.microsoft.com/ja-jp/cpp/windows/latest-supported-vc-redist?view=msvc-170) 30 | 31 | VOICEVOX本体が必要です。[VOICEVOX公式ホームページ](https://voicevox.hiroshiba.jp/) 32 | VOICEVOXエンジンの自動起動機能は実装していないので、あらかじめVOICEVOXを起動しておいてください。 33 | 34 | Windows Defender にウイルスとして検知されてしまうと報告をうけています。 35 | 当ソフトには、ウイルスは含まれていませんので、誤検知です。 36 | ソースコードを公開しているので、そこから判断していただくと幸いです。 37 | ちなみに、ウイルスバスターでは、「脅威無し」の判定でした。 38 | 39 | ### アンインストール 40 | アンインストールは、Windowsの「設定」→「アプリ」→「アプリと機能」からアンインストールができます。 41 | アンインストールを実行しても、設定を保存したxmlファイルが削除されずに残ります。 42 | 不要な場合は、手動で削除をしてください。 43 | 44 | ## VOICEVOX派生アプリのキャラクター登録(バージョン 2.0.0以降) 45 | スタイル登録ツールの「ポート変更機能」を使用して、VOICEVOX派生アプリのキャラクターを登録できます。VOICEVOXエディタのマルチエンジン機能に追加できるものであれば、使えるはずです。動作確認を取れているアプリは、ポート番号を登録しているので、リストから選択するだけでキャラクターの読み込みができます。 46 | 47 | ### 動作確認の取れているアプリ。 48 | - VOICEVOX Nemo 49 | - COEIROINK (v.1.x.x系統) 50 | - LMROID 51 | - SHAREVOX 52 | - ITVOICE 53 | - COEIROINK v2(bridge使用) 54 | - AivisSpeech 55 | 56 | ### スタイル登録ツールのポートの変更方法 57 | スタイル登録ツールのポート変更ボタンを押します。ポート変更ボタンの場所は、以下の通りです。 58 | 59 | インストールの最後に自動で起動したとき 60 | ![初回インストール時](https://user-images.githubusercontent.com/32050537/162579401-4dd625dc-9d74-40b0-84c3-e693b3843775.png) 61 | 62 | スタートメニューから起動したときの起動画面 63 | ![起動時のボイボ起動確認画面](https://user-images.githubusercontent.com/32050537/162579409-f7988097-0a30-469e-90c2-5359795b8ddc.png) 64 | 65 | メイン画面 66 | ![スタイル登録ツールv2](https://user-images.githubusercontent.com/32050537/162579415-916ad399-e4bb-4e35-a44b-74621d8cd048.png) 67 | 68 | ポート変更ボタンを押すと、ポートの変更画面が出ます。アプリ名とポート番号を入力し、OKボタン押してください。 69 | プリセットから、動作確認の取れているアプリを選択することができます。 70 | 71 | ![ポート変更画面](https://github.com/shigobu/SAPIForVOICEVOX/assets/32050537/9cad4d86-b9ae-4b2a-91a2-90bb2ea83267) 72 | 73 | ### COEIROINK V2 について 74 | COEIROINKは、V2になってからAPIが変更され、VOICEVOXと異なるものになりました。COEIROINK V2は非対応です。 75 | 非公式に、VOICEVOXのマルチエンジン機能でCOEIROINKv2を呼び出すプラグインを「Nanashi.」さんが作成されています。 76 | [COEIROINK v2 bridge](https://github.com/sevenc-nanashi/coeiroink-v2-bridge) 77 | このプラグイン経由で使えるようになるかもしれません。ポートは、vvppファイルの拡張子をzipに変更し展開後、「engine_manifest.json」をメモ帳等のテキストエディタで開き、「port」の欄を確認してください。 78 | 79 | ## キャラクター追加方法 80 | 新キャラが追加された場合、「スタイル登録ツール」を使用して登録することで使えるようになります。 81 | 起動中のVOICEVOXからキャラクター情報を取得するので、SAPI For VOICEVOXの更新をする必要はありません。 82 | 「スタイル登録ツール」は、スタートメニューのすべてのアプリにあります。 83 | 84 | ## スタイル登録ツール 85 | 1.2.0から、スタイル登録ツールを追加しました。インストールの最後に自動で起動します。 86 | ![スタイル登録ツール](https://user-images.githubusercontent.com/32050537/141030521-7442f17c-08b7-4b95-a4ff-2424c4212e9b.png) 87 | 左のリストがVOICEVOXから取得したキャラクター情報です。右のリストがSAPIのリストです。 88 | 「追加」ボタンを押すと、VOICEVOX側リストで選択されている項目がSAPI側リストへ追加されます。 89 | 「削除」ボタンを押すと、SAPI側リストで選択されている項目が削除されます。 90 | 「すべて追加」「すべて削除」は選択の有無に関わらず、すべて追加または削除されます。 91 | 「OK」ボタンを押すことで、SAPI側リストの内容が登録されます。「OK」ボタンを押すまで登録は実行されません。 92 | キャラ・スタイル情報は、32bit版と64bit版でそれぞれ別に登録されます。 93 | 94 | 設定画面同様に、スタートメニューの全てのアプリに追加されます。 95 | 96 | ## 設定画面 97 | バージョン1.1.0から設定画面を追加しました。 98 | インストールすると、スタートメニューの全てのアプリに追加されます。 99 | ![スクリーンショット 2021-11-19 212701](https://user-images.githubusercontent.com/32050537/142622829-65588d2e-6f7b-4506-922d-9ac3d85151b8.png) 100 | ![設定画面・調声](https://user-images.githubusercontent.com/32050537/133757251-033eb099-99e8-48f8-b4d7-f74580e1d142.png) 101 | 102 | この画面で、音声のパラメータ等を調節できます。 103 | 設定内容は、32bit版と64bit版でそれぞれ別に保存されます。 104 | 105 | ### エンジンエラーの通知 106 | 読み上げる文によっては、エンジンエラーになる場合があります。 107 | 読み上げ途中でエンジンエラーになった場合、その文は読み上げられずに代わりに「エンジンエラーです。」と音声が流れます。その後も文が続く場合で、正常に読み上げができた場合は読み上げが続きます。 108 | エラー音声を流したくない場合は、「エンジンエラーを通知する。」チェックボックスをオフにしてください。そうすることで、エンジンエラーをスキップすることができます。 109 | 110 | エンジンエラーを通知する例 111 | 読み上げ文字列 112 | 「こけこっこ。あっ。こけこっこ。」 113 | 読み上げ音声 114 | 「こけこっこ。エンジンエラーです。こけこっこ。」 115 | 116 | エンジンエラーを通知しない例 117 | 読み上げ文字列 118 | 「こけこっこ。あっ。こけこっこ。」 119 | 読み上げ音声 120 | 「こけこっこ。こけこっこ。」 121 | 122 | ### N Airで使用するときの設定 123 | **N Airで使用する場合、「SAPIイベントを使用する」のチェックをオフにして使用してください。** 124 | 通常は、オンのままで問題無いはずです。 125 | 126 | ## 英語辞書について 127 | バージョン1.1.1から英語辞書を搭載しました。 128 | 辞書の大元は、 129 | The CMU Pronouncing Dictionary(http://www.speech.cs.cmu.edu/cgi-bin/cmudict) 130 | を使用しています。 131 | これを、「モリカトロン開発ブログ」の「英語をカタカナ表記に変換してみる(https://tech.morikatron.ai/entry/2020/05/25/100000 )」 132 | という記事に載っているコードを使用し、発音記号からカタカナへ変換しています。 133 | 134 | 実際にどのように置換されるかは、[shigobu/EnglishKanaDictionary](https://github.com/shigobu/EnglishKanaDictionary)のテストアプリで確認するのが簡単かと思います。 135 | 136 | ## エラー音声 137 | エラー音声には、VOICEVOXの「四国めたん」の音声を使用しています。 138 | エラー発生時には、予めVOICEVOXを使用し保存していたwavファイルを再生して、通知を行っています。 139 | 140 | ## よくある質問 141 | - 「クラスが登録されていません」 というエラーが表示されて、読み上げされない 142 | 143 | インストール場所によっては、正常にインストールが完了しない場合があります。インストール場所をデフォルトにして再インストールを行ってください。 144 | 145 | - Windows Defender にウイルスとして検知されてしまう 146 | 147 | 当ソフトには、ウイルスは含まれていませんので、誤検知です。 148 | ソースコードを公開しているので、そこから判断していただくと幸いです。 149 | ちなみに、ウイルスバスターでは、「脅威無し」の判定でした。 150 | 151 | ## ライセンス 152 | このアプリのライセンスは、「MIT License」です。 153 | 154 | また、VOICEVOX本体及び各音声ライブラリの利用規約にも従ってください。 155 | [VOICEVOX利用規約](https://voicevox.hiroshiba.jp/term) 156 | [ずんだもん、四国めたん音源利用規約](https://zunko.jp/con_ongen_kiyaku.html) 157 | [春日部つむぎ利用規約](https://tsukushinyoki10.wixsite.com/ktsumugiofficial/%E5%88%A9%E7%94%A8%E8%A6%8F%E7%B4%84) 158 | [波音リツ利用規約](http://canon-voice.com/kiyaku.html) 159 | [雨晴はう利用規約](https://amehau.com/?page_id=225) 160 | 161 | ## 開発環境 162 | Microsoft Visual Studio Community 2019 163 | C#・C++ 164 | 165 | ## ビルド方法 166 | ソリューションを開き、ビルドを実行します。 167 | ~~自動でCOMとして登録されます。SAPIに必要なレジストリの登録も自動で実行されます。~~ 168 | インストーラプロジェクトを追加したので、ビルド時にレジストリ登録する機能はオフにしました。 169 | インストーラプロジェクトは自動でビルドされません。ソリューションエクスプローラーからSetupを右クリックしてビルドを選択し、ビルドしてください。 170 | 同じく、Setupを右クリックしてインストールを選択すると、インストールができます。 171 | 172 | インストーラのビルドには、「Microsoft Visual Studio Installer Projects」の拡張機能が必要です。 173 | Visual Studioの「ツール」→「拡張機能」からインストールしてください。 174 | 175 | 依存ライブラリは、NuGetで取得します。 176 | 参照できない場合は、「NuGetパッケージの復元」を実行してください。 177 | 178 | ### 自動ビルド 179 | このプロジェクトは、Actionsを使用してビルドの自動化を行っています。 180 | フォークしたリポジトリでビルドを行う場合は、Actionsを有効にして「Actions」の「Build and Create Installer」を実行してください。「devenv.com」を使用している関係で、ビルドに10分程度かかります。ビルドで生成されたものは、「Artifacts」からダウンロードできます。 181 | 182 | ## フォルダ構成 183 | SAPIForVOICEVOX:本体 184 | SAPIGetStaticValueLib:必要な定数を取得するc++のライブラリ 185 | SFVvCommon:C#で使用する共通ライブラリ 186 | Setting:設定アプリ 187 | Setup:32bitインストーラ 188 | Setup64:64bitインストーラ 189 | SetupCustomActions:インストーラのカスタムアクション 190 | StyleRegistrationTool:スタイル登録ツール 191 | 192 | -------------------------------------------------------------------------------- /SAPIForVOICEVOX.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31205.134 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SAPIForVOICEVOX", "SAPIForVOICEVOX\SAPIForVOICEVOX.csproj", "{0FF58D47-C1C9-4873-8B1A-86D5123EF3FD}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SAPIGetStaticValueLib", "SAPIGetStaticValueLib\SAPIGetStaticValueLib.vcxproj", "{571D7116-6705-4B1E-A20C-F51CFDFEA956}" 9 | EndProject 10 | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Setup32", "Setup\Setup.vdproj", "{813DDFEA-F8D1-4A87-A138-5BF1559B1E79}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SetupCustomActions", "SetupCustomActions\SetupCustomActions.csproj", "{1D19776F-BC51-4CA9-BACD-130ED51DE554}" 13 | EndProject 14 | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Setup64", "Setup64\Setup64.vdproj", "{01C624EA-FC8B-416C-B64C-F59CCF923D50}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Setting", "Setting\Setting.csproj", "{91B73544-CF6A-4453-9AA8-9949D474E2B4}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StyleRegistrationTool", "StyleRegistrationTool\StyleRegistrationTool.csproj", "{9FB0F305-CE4F-4D33-B968-6F861ECDBA8F}" 19 | EndProject 20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SFVvCommon", "SFVvCommon\SFVvCommon.csproj", "{43723CD5-50FE-4BE9-B8B7-7B08E3F2156C}" 21 | EndProject 22 | Global 23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 24 | Debug|x64 = Debug|x64 25 | Debug|x86 = Debug|x86 26 | Release|x64 = Release|x64 27 | Release|x86 = Release|x86 28 | EndGlobalSection 29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 30 | {0FF58D47-C1C9-4873-8B1A-86D5123EF3FD}.Debug|x64.ActiveCfg = Debug|x64 31 | {0FF58D47-C1C9-4873-8B1A-86D5123EF3FD}.Debug|x64.Build.0 = Debug|x64 32 | {0FF58D47-C1C9-4873-8B1A-86D5123EF3FD}.Debug|x86.ActiveCfg = Debug|x86 33 | {0FF58D47-C1C9-4873-8B1A-86D5123EF3FD}.Debug|x86.Build.0 = Debug|x86 34 | {0FF58D47-C1C9-4873-8B1A-86D5123EF3FD}.Release|x64.ActiveCfg = Release|x64 35 | {0FF58D47-C1C9-4873-8B1A-86D5123EF3FD}.Release|x64.Build.0 = Release|x64 36 | {0FF58D47-C1C9-4873-8B1A-86D5123EF3FD}.Release|x86.ActiveCfg = Release|x86 37 | {0FF58D47-C1C9-4873-8B1A-86D5123EF3FD}.Release|x86.Build.0 = Release|x86 38 | {571D7116-6705-4B1E-A20C-F51CFDFEA956}.Debug|x64.ActiveCfg = Debug|x64 39 | {571D7116-6705-4B1E-A20C-F51CFDFEA956}.Debug|x64.Build.0 = Debug|x64 40 | {571D7116-6705-4B1E-A20C-F51CFDFEA956}.Debug|x86.ActiveCfg = Debug|Win32 41 | {571D7116-6705-4B1E-A20C-F51CFDFEA956}.Debug|x86.Build.0 = Debug|Win32 42 | {571D7116-6705-4B1E-A20C-F51CFDFEA956}.Release|x64.ActiveCfg = Release|x64 43 | {571D7116-6705-4B1E-A20C-F51CFDFEA956}.Release|x64.Build.0 = Release|x64 44 | {571D7116-6705-4B1E-A20C-F51CFDFEA956}.Release|x86.ActiveCfg = Release|Win32 45 | {571D7116-6705-4B1E-A20C-F51CFDFEA956}.Release|x86.Build.0 = Release|Win32 46 | {813DDFEA-F8D1-4A87-A138-5BF1559B1E79}.Debug|x64.ActiveCfg = Debug 47 | {813DDFEA-F8D1-4A87-A138-5BF1559B1E79}.Debug|x86.ActiveCfg = Debug 48 | {813DDFEA-F8D1-4A87-A138-5BF1559B1E79}.Release|x64.ActiveCfg = Release 49 | {813DDFEA-F8D1-4A87-A138-5BF1559B1E79}.Release|x86.ActiveCfg = Release 50 | {1D19776F-BC51-4CA9-BACD-130ED51DE554}.Debug|x64.ActiveCfg = Debug|Any CPU 51 | {1D19776F-BC51-4CA9-BACD-130ED51DE554}.Debug|x64.Build.0 = Debug|Any CPU 52 | {1D19776F-BC51-4CA9-BACD-130ED51DE554}.Debug|x86.ActiveCfg = Debug|Any CPU 53 | {1D19776F-BC51-4CA9-BACD-130ED51DE554}.Debug|x86.Build.0 = Debug|Any CPU 54 | {1D19776F-BC51-4CA9-BACD-130ED51DE554}.Release|x64.ActiveCfg = Release|Any CPU 55 | {1D19776F-BC51-4CA9-BACD-130ED51DE554}.Release|x64.Build.0 = Release|Any CPU 56 | {1D19776F-BC51-4CA9-BACD-130ED51DE554}.Release|x86.ActiveCfg = Release|Any CPU 57 | {1D19776F-BC51-4CA9-BACD-130ED51DE554}.Release|x86.Build.0 = Release|Any CPU 58 | {01C624EA-FC8B-416C-B64C-F59CCF923D50}.Debug|x64.ActiveCfg = Debug 59 | {01C624EA-FC8B-416C-B64C-F59CCF923D50}.Debug|x86.ActiveCfg = Debug 60 | {01C624EA-FC8B-416C-B64C-F59CCF923D50}.Release|x64.ActiveCfg = Release 61 | {01C624EA-FC8B-416C-B64C-F59CCF923D50}.Release|x86.ActiveCfg = Release 62 | {91B73544-CF6A-4453-9AA8-9949D474E2B4}.Debug|x64.ActiveCfg = Debug|x64 63 | {91B73544-CF6A-4453-9AA8-9949D474E2B4}.Debug|x64.Build.0 = Debug|x64 64 | {91B73544-CF6A-4453-9AA8-9949D474E2B4}.Debug|x86.ActiveCfg = Debug|x86 65 | {91B73544-CF6A-4453-9AA8-9949D474E2B4}.Debug|x86.Build.0 = Debug|x86 66 | {91B73544-CF6A-4453-9AA8-9949D474E2B4}.Release|x64.ActiveCfg = Release|x64 67 | {91B73544-CF6A-4453-9AA8-9949D474E2B4}.Release|x64.Build.0 = Release|x64 68 | {91B73544-CF6A-4453-9AA8-9949D474E2B4}.Release|x86.ActiveCfg = Release|x86 69 | {91B73544-CF6A-4453-9AA8-9949D474E2B4}.Release|x86.Build.0 = Release|x86 70 | {9FB0F305-CE4F-4D33-B968-6F861ECDBA8F}.Debug|x64.ActiveCfg = Debug|x64 71 | {9FB0F305-CE4F-4D33-B968-6F861ECDBA8F}.Debug|x64.Build.0 = Debug|x64 72 | {9FB0F305-CE4F-4D33-B968-6F861ECDBA8F}.Debug|x86.ActiveCfg = Debug|x86 73 | {9FB0F305-CE4F-4D33-B968-6F861ECDBA8F}.Debug|x86.Build.0 = Debug|x86 74 | {9FB0F305-CE4F-4D33-B968-6F861ECDBA8F}.Release|x64.ActiveCfg = Release|x64 75 | {9FB0F305-CE4F-4D33-B968-6F861ECDBA8F}.Release|x64.Build.0 = Release|x64 76 | {9FB0F305-CE4F-4D33-B968-6F861ECDBA8F}.Release|x86.ActiveCfg = Release|x86 77 | {9FB0F305-CE4F-4D33-B968-6F861ECDBA8F}.Release|x86.Build.0 = Release|x86 78 | {43723CD5-50FE-4BE9-B8B7-7B08E3F2156C}.Debug|x64.ActiveCfg = Debug|Any CPU 79 | {43723CD5-50FE-4BE9-B8B7-7B08E3F2156C}.Debug|x64.Build.0 = Debug|Any CPU 80 | {43723CD5-50FE-4BE9-B8B7-7B08E3F2156C}.Debug|x86.ActiveCfg = Debug|Any CPU 81 | {43723CD5-50FE-4BE9-B8B7-7B08E3F2156C}.Debug|x86.Build.0 = Debug|Any CPU 82 | {43723CD5-50FE-4BE9-B8B7-7B08E3F2156C}.Release|x64.ActiveCfg = Release|Any CPU 83 | {43723CD5-50FE-4BE9-B8B7-7B08E3F2156C}.Release|x64.Build.0 = Release|Any CPU 84 | {43723CD5-50FE-4BE9-B8B7-7B08E3F2156C}.Release|x86.ActiveCfg = Release|Any CPU 85 | {43723CD5-50FE-4BE9-B8B7-7B08E3F2156C}.Release|x86.Build.0 = Release|Any CPU 86 | EndGlobalSection 87 | GlobalSection(SolutionProperties) = preSolution 88 | HideSolutionNode = FALSE 89 | EndGlobalSection 90 | GlobalSection(ExtensibilityGlobals) = postSolution 91 | SolutionGuid = {91199FAA-211A-463D-BDF8-09D198C98E74} 92 | EndGlobalSection 93 | EndGlobal 94 | -------------------------------------------------------------------------------- /SAPIForVOICEVOX/EnglishToKana/EnglishKanaDictionary.cs: -------------------------------------------------------------------------------- 1 | using RomajiToHiraganaLibrary; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text.RegularExpressions; 6 | 7 | namespace SAPIForVOICEVOX 8 | { 9 | /// 10 | /// 英単語を含む文字列を英単語の読みと対応するカナに変換する関数を提供します。 11 | /// 12 | public class EnglishKanaDictionary : Dictionary 13 | { 14 | /// 15 | /// 区切り文字列 16 | /// 17 | const string delimiterString = " "; 18 | 19 | /// 20 | /// 区切り文字の配列 21 | /// 22 | readonly string[] delimiterStringArr = { delimiterString }; 23 | 24 | /// 25 | /// 英語カナ辞書を初期化します。 26 | /// 27 | public EnglishKanaDictionary() : base(120000) 28 | { 29 | //改行で分割し、行ごとのデータにする。 30 | string[] newLineString = { "\r\n" }; 31 | string[] lines = Properties.Resources.eng2kanaDict.Split(newLineString, StringSplitOptions.RemoveEmptyEntries); 32 | foreach (var line in lines) 33 | { 34 | //英語とカナを分割 35 | string[] engKana = line.Split(delimiterStringArr, StringSplitOptions.RemoveEmptyEntries); 36 | if (engKana.Length < 2) 37 | { 38 | continue; 39 | } 40 | //内部辞書に追加 41 | string eng = engKana[0]; 42 | string kana = engKana[1]; 43 | this.Add(eng, kana); 44 | } 45 | } 46 | 47 | /// 48 | /// 指定の英単語の読みに対応するカナを取得します。 49 | /// 50 | /// 英単語 51 | /// カナ 52 | public new string this[string key] 53 | { 54 | get 55 | { 56 | return base[key]; 57 | } 58 | private set 59 | { 60 | base[key] = value; 61 | } 62 | } 63 | 64 | /// 65 | /// 指定の文字列に含まれている英単語を対応する読みのカナへ置換した文字列を返します。 66 | /// 67 | /// 68 | /// 69 | public string ReplaceEnglishToKana(string sourceString) 70 | { 71 | //英単語の抽出 72 | Regex regex = new Regex(@"[a-zA-Z']+", RegexOptions.IgnoreCase); 73 | IEnumerable matchCollection = regex.Matches(sourceString).Cast(); 74 | //Matchから文字列を取得。文字数が大きい順で並び替え。 75 | IEnumerable englishWords = matchCollection.Select(match => match.Value.ToLowerInvariant()).OrderByDescending(x => x.Length); 76 | 77 | string returnString = sourceString; 78 | foreach (var english in englishWords) 79 | { 80 | string kana; 81 | if (this.ContainsKey(english)) 82 | { 83 | kana = this[english]; 84 | } 85 | else 86 | { 87 | //辞書に含まれていない場合、2つの単語を結合されているとみなして、検索 88 | string temp = TwoWordEngToKana(english); 89 | if (temp == null) 90 | { 91 | continue; 92 | } 93 | kana = temp; 94 | } 95 | returnString = returnString.ToLowerInvariant().Replace(english, kana); 96 | } 97 | 98 | //ローマ字辞書を全て走査し置換を行うため、最後に行う。 99 | returnString = RomajiToHiragana.Convert(returnString); 100 | 101 | return returnString; 102 | } 103 | 104 | /// 105 | /// 2つの単語を結合した英単語の対応する読みのカナを返します。 106 | /// 107 | /// 英単語 108 | /// 109 | private string TwoWordEngToKana(string word) 110 | { 111 | //6文字未満はスキップ 112 | if (word.Length < 6) 113 | { 114 | return null; 115 | } 116 | 117 | for (int i = 0; i < word.Length - 1; i++) 118 | { 119 | string eng1 = word.Substring(0, i + 1); 120 | string eng2 = word.Substring(i + 1); 121 | //対応するカナが無い場合、継続。 122 | if (!this.ContainsKey(eng1)) 123 | { 124 | continue; 125 | } 126 | if (!this.ContainsKey(eng2)) 127 | { 128 | continue; 129 | } 130 | return this[eng1] + this[eng2]; 131 | } 132 | //見つからなかった場合nullを返す。 133 | return null; 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /SAPIForVOICEVOX/EnglishToKana/Licence.txt: -------------------------------------------------------------------------------- 1 | 英語→かな辞書の大本は、 2 | The CMU Pronouncing Dictionary(http://www.speech.cs.cmu.edu/cgi-bin/cmudict) 3 | を使用しています。 4 | これを、「モリカトロン開発ブログ」の「英語をカタカナ表記に変換してみる(https://tech.morikatron.ai/entry/2020/05/25/100000)」 5 | という記事に載っているコードを使用し、発音記号からカタカナへ変換しています。 6 | 7 | The CMU Pronouncing Dictionary 8 | Licence 9 | 10 | Copyright (c) 2015, Alexander Rudnicky 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | 16 | * Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 19 | * Redistributions in binary form must reproduce the above copyright notice, 20 | this list of conditions and the following disclaimer in the documentation 21 | and/or other materials provided with the distribution. 22 | 23 | * Neither the name of dictTools nor the names of its 24 | contributors may be used to endorse or promote products derived from 25 | this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 28 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 31 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 34 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 35 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /SAPIForVOICEVOX/Exception/VoiceNotificationException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SAPIForVOICEVOX 4 | { 5 | /// 6 | /// 例外を音声で通知する、例外クラス。 7 | /// 8 | [Serializable] 9 | public class VoiceNotificationException : Exception 10 | { 11 | public VoiceNotificationException() 12 | { 13 | } 14 | 15 | public VoiceNotificationException(string message) : this(message, null) 16 | { 17 | } 18 | 19 | public VoiceNotificationException(string message, Exception innerException) : base(message, innerException) 20 | { 21 | } 22 | 23 | /// 24 | /// エラー音声を取得、設定します。 25 | /// 26 | public byte[] ErrorVoice { get; protected set; } = null; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SAPIForVOICEVOX/Exception/VoiceVoxConnectionException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace SAPIForVOICEVOX 5 | { 6 | /// 7 | /// ボイスボックスと通信ができない場合に投げられます。 8 | /// 9 | [Serializable] 10 | public class VoiceVoxConnectionException : VoiceNotificationException 11 | { 12 | const string message = "ボイスボックスと通信ができません"; 13 | 14 | public VoiceVoxConnectionException() : this(null) { } 15 | 16 | public VoiceVoxConnectionException(Exception innerException) : base(message, innerException) 17 | { 18 | Stream stream = Properties.Resources.ボイスボックスと通信ができません; 19 | ErrorVoice = new byte[stream.Length]; 20 | stream.Read(ErrorVoice, 0, (int)stream.Length); 21 | } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SAPIForVOICEVOX/Exception/VoiceVoxEngineException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace SAPIForVOICEVOX 5 | { 6 | /// 7 | /// VOICEVOXのエンジンに関するエラーを表します。 8 | /// 9 | [Serializable] 10 | public class VoiceVoxEngineException : VoiceNotificationException 11 | { 12 | const string message = "エンジンエラーです"; 13 | 14 | public VoiceVoxEngineException() : this(null) { } 15 | 16 | public VoiceVoxEngineException(Exception innerException) : base(message, innerException) 17 | { 18 | Stream stream = Properties.Resources.エンジンエラーです; 19 | ErrorVoice = new byte[stream.Length]; 20 | stream.Read(ErrorVoice, 0, (int)stream.Length); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SAPIForVOICEVOX/Exception/VoiceVoxNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace SAPIForVOICEVOX 5 | { 6 | /// 7 | /// ボイスボックスが起動中プロセス一覧から見つからなかった場合に投げられます。 8 | /// 9 | [Serializable] 10 | public class VoiceVoxNotFoundException : VoiceNotificationException 11 | { 12 | const string message = "VOICEVOXが見つかりません"; 13 | 14 | public VoiceVoxNotFoundException() : this(null) { } 15 | 16 | public VoiceVoxNotFoundException(Exception innerException) : base(message, innerException) 17 | { 18 | Stream stream = Properties.Resources.ボイスボックスが見つかりません; 19 | ErrorVoice = new byte[stream.Length]; 20 | stream.Read(ErrorVoice, 0, (int)stream.Length); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SAPIForVOICEVOX/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 5 | // 制御されます。アセンブリに関連付けられている情報を変更するには、 6 | // これらの属性値を変更してください。 7 | [assembly: AssemblyTitle("SAPIForVOICEVOX")] 8 | [assembly: AssemblyDescription("VOICEVOXをSAPIから見えるようにするアドイン的な何か")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("SAPIForVOICEVOX")] 12 | [assembly: AssemblyCopyright("Copyright © shigobu 2021")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから 17 | // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 18 | // その型の ComVisible 属性を true に設定してください。 19 | [assembly: ComVisible(true)] 20 | 21 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります 22 | [assembly: Guid("0ff58d47-c1c9-4873-8b1a-86d5123ef3fd")] 23 | 24 | // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: 25 | // 26 | // メジャー バージョン 27 | // マイナー バージョン 28 | // ビルド番号 29 | // リビジョン 30 | // 31 | // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます 32 | // 既定値にすることができます: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("99.99.999.0")] 35 | [assembly: AssemblyFileVersion("99.99.999.0")] 36 | -------------------------------------------------------------------------------- /SAPIForVOICEVOX/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SAPIForVOICEVOX.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 17 | /// 18 | // このクラスは StronglyTypedResourceBuilder クラスが ResGen 19 | // または Visual Studio のようなツールを使用して自動生成されました。 20 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に 21 | // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SAPIForVOICEVOX.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします 51 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// a ア 65 | ///a's エイズ 66 | ///a. エイ 67 | ///a.'s エイズ 68 | ///a.d. エイディー 69 | ///a.m. エイエム 70 | ///a.s エイズ 71 | ///a42128 エイフォーチューワンチュウェイト 72 | ///aa エイエイ 73 | ///aaa トリパレイ 74 | ///aaai トリパレイヤイ 75 | ///aaberg アバーグ 76 | ///aachen アケン 77 | ///aachener アケナー 78 | ///aah ア 79 | ///aaker アカー 80 | ///aaliyah アリア 81 | ///aalseth アルセス 82 | ///aamodt アモト 83 | ///aancor アンコー 84 | ///aardema アーデマ 85 | ///aardvark アードバーク 86 | ///aardvarks アードバークス 87 | ///aargh アーグ 88 | ///aarhus アフース 89 | ///aaron エロン 90 | ///aaron's エロンズ 91 | ///aarons エロンズ 92 | ///aaronson エロンソン 93 | ///aaronson's エロンソンズ 94 | ///aarti アーティー 95 | ///aase アス 96 | ///aasen アセン 97 | ///ab アブ 98 | ///aba エイビエイ 99 | ///ababa アババ 100 | ///abacha アバカ 101 | ///aback アバク 102 | ///abaco アバコ [残りの文字列は切り詰められました]"; に類似しているローカライズされた文字列を検索します。 103 | /// 104 | internal static string eng2kanaDict { 105 | get { 106 | return ResourceManager.GetString("eng2kanaDict", resourceCulture); 107 | } 108 | } 109 | 110 | /// 111 | /// System.IO.MemoryStream に類似した型 System.IO.UnmanagedMemoryStream のローカライズされたリソースを検索します。 112 | /// 113 | internal static System.IO.UnmanagedMemoryStream エンジンエラーです { 114 | get { 115 | return ResourceManager.GetStream("エンジンエラーです", resourceCulture); 116 | } 117 | } 118 | 119 | /// 120 | /// System.IO.MemoryStream に類似した型 System.IO.UnmanagedMemoryStream のローカライズされたリソースを検索します。 121 | /// 122 | internal static System.IO.UnmanagedMemoryStream ボイスボックスが見つかりません { 123 | get { 124 | return ResourceManager.GetStream("ボイスボックスが見つかりません", resourceCulture); 125 | } 126 | } 127 | 128 | /// 129 | /// System.IO.MemoryStream に類似した型 System.IO.UnmanagedMemoryStream のローカライズされたリソースを検索します。 130 | /// 131 | internal static System.IO.UnmanagedMemoryStream ボイスボックスと通信ができません { 132 | get { 133 | return ResourceManager.GetStream("ボイスボックスと通信ができません", resourceCulture); 134 | } 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /SAPIForVOICEVOX/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\EnglishToKana\eng2kanaDict.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 123 | 124 | 125 | ..\エンジンエラーです.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 126 | 127 | 128 | ..\ボイスボックスが見つかりません.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 129 | 130 | 131 | ..\ボイスボックスと通信ができません.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 132 | 133 | -------------------------------------------------------------------------------- /SAPIForVOICEVOX/SAPIForVOICEVOX.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {0FF58D47-C1C9-4873-8B1A-86D5123EF3FD} 8 | Library 9 | Properties 10 | SAPIForVOICEVOX 11 | SAPIForVOICEVOX 12 | v4.7.1 13 | 512 14 | true 15 | 16 | 17 | true 18 | bin\x86\Debug\ 19 | DEBUG;TRACE 20 | false 21 | full 22 | x86 23 | 7.3 24 | prompt 25 | true 26 | 27 | 28 | bin\x86\Release\ 29 | TRACE 30 | true 31 | pdbonly 32 | x86 33 | 7.3 34 | prompt 35 | false 36 | true 37 | 38 | 39 | true 40 | bin\x64\Debug\ 41 | DEBUG;TRACE 42 | true 43 | full 44 | x64 45 | 7.3 46 | prompt 47 | 48 | 49 | bin\x64\Release\ 50 | TRACE;x64 51 | true 52 | true 53 | pdbonly 54 | x64 55 | 7.3 56 | prompt 57 | 58 | 59 | 60 | ..\packages\NAudio.1.10.0\lib\net35\NAudio.dll 61 | 62 | 63 | ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll 64 | 65 | 66 | ..\packages\RomajiToHiraganaLibrary.1.0.3\lib\net47\RomajiToHiraganaLibrary.dll 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | True 83 | True 84 | Resources.resx 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | {EB2114C0-CB02-467A-AE4D-2ED171F05E6A} 96 | 10 97 | 0 98 | 0 99 | tlbimp 100 | False 101 | True 102 | 103 | 104 | 105 | 106 | ResXFileCodeGenerator 107 | Resources.Designer.cs 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | {91b73544-cf6a-4453-9aa8-9949d474e2b4} 120 | Setting 121 | 122 | 123 | {43723cd5-50fe-4be9-b8b7-7b08e3f2156c} 124 | SFVvCommon 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /SAPIForVOICEVOX/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SAPIForVOICEVOX/エンジンエラーです.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigobu/SAPIForVOICEVOX/c35da21227fdbb010788694ca6df565508afa141/SAPIForVOICEVOX/エンジンエラーです.wav -------------------------------------------------------------------------------- /SAPIForVOICEVOX/ボイスボックスが見つかりません.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigobu/SAPIForVOICEVOX/c35da21227fdbb010788694ca6df565508afa141/SAPIForVOICEVOX/ボイスボックスが見つかりません.wav -------------------------------------------------------------------------------- /SAPIForVOICEVOX/ボイスボックスと通信ができません.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigobu/SAPIForVOICEVOX/c35da21227fdbb010788694ca6df565508afa141/SAPIForVOICEVOX/ボイスボックスと通信ができません.wav -------------------------------------------------------------------------------- /SAPIGetStaticValueLib/SAPIGetStaticValueLib.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {571d7116-6705-4b1e-a20c-f51cfdfea956} 25 | SAPIGetStaticValueLib 26 | 10.0 27 | 28 | 29 | 30 | DynamicLibrary 31 | true 32 | v142 33 | Unicode 34 | 35 | 36 | DynamicLibrary 37 | false 38 | v142 39 | true 40 | Unicode 41 | 42 | 43 | DynamicLibrary 44 | true 45 | v142 46 | Unicode 47 | 48 | 49 | DynamicLibrary 50 | false 51 | v142 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | $(SolutionDir)SAPIForVOICEVOX\bin\x86\$(Configuration)\ 76 | $(ProjectDir)bin\$(Configuration)\ 77 | 78 | 79 | false 80 | $(SolutionDir)SAPIForVOICEVOX\bin\x86\$(Configuration)\ 81 | $(ProjectDir)bin\$(Configuration)\ 82 | 83 | 84 | true 85 | $(SolutionDir)SAPIForVOICEVOX\bin\x64\$(Configuration)\ 86 | $(ProjectDir)bin\$(Configuration)\ 87 | 88 | 89 | false 90 | $(SolutionDir)SAPIForVOICEVOX\bin\x64\$(Configuration)\ 91 | $(ProjectDir)bin\$(Configuration)\ 92 | 93 | 94 | 95 | Level3 96 | true 97 | WIN32;_DEBUG;SAPIGETSTATICVALUELIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 98 | true 99 | Use 100 | pch.h 101 | 102 | 103 | Windows 104 | true 105 | false 106 | Source.def 107 | 108 | 109 | 110 | 111 | Level3 112 | true 113 | true 114 | true 115 | WIN32;NDEBUG;SAPIGETSTATICVALUELIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 116 | true 117 | Use 118 | pch.h 119 | 120 | 121 | Windows 122 | true 123 | true 124 | true 125 | false 126 | Source.def 127 | 128 | 129 | 130 | 131 | Level3 132 | true 133 | _DEBUG;SAPIGETSTATICVALUELIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 134 | true 135 | Use 136 | pch.h 137 | 138 | 139 | Windows 140 | true 141 | false 142 | Source.def 143 | 144 | 145 | 146 | 147 | Level3 148 | true 149 | true 150 | true 151 | NDEBUG;SAPIGETSTATICVALUELIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 152 | true 153 | Use 154 | pch.h 155 | 156 | 157 | Windows 158 | true 159 | true 160 | true 161 | false 162 | Source.def 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | Create 173 | Create 174 | Create 175 | Create 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /SAPIGetStaticValueLib/SAPIGetStaticValueLib.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | ヘッダー ファイル 20 | 21 | 22 | ヘッダー ファイル 23 | 24 | 25 | 26 | 27 | ソース ファイル 28 | 29 | 30 | ソース ファイル 31 | 32 | 33 | 34 | 35 | ソース ファイル 36 | 37 | 38 | -------------------------------------------------------------------------------- /SAPIGetStaticValueLib/Source.def: -------------------------------------------------------------------------------- 1 | LIBRARY SAPIGetStaticValueLib 2 | 3 | EXPORTS 4 | GetSPDFIDWaveFormatEx 5 | GetSPDFIDText 6 | -------------------------------------------------------------------------------- /SAPIGetStaticValueLib/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : DLL アプリケーションのエントリ ポイントを定義します。 2 | #include "pch.h" 3 | #include 4 | 5 | BOOL APIENTRY DllMain( HMODULE hModule, 6 | DWORD ul_reason_for_call, 7 | LPVOID lpReserved 8 | ) 9 | { 10 | switch (ul_reason_for_call) 11 | { 12 | case DLL_PROCESS_ATTACH: 13 | case DLL_THREAD_ATTACH: 14 | case DLL_THREAD_DETACH: 15 | case DLL_PROCESS_DETACH: 16 | break; 17 | } 18 | return TRUE; 19 | } 20 | 21 | GUID __stdcall GetSPDFIDWaveFormatEx() { 22 | return SPDFID_WaveFormatEx; 23 | } 24 | 25 | GUID __stdcall GetSPDFIDText() { 26 | return SPDFID_Text; 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /SAPIGetStaticValueLib/framework.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN // Windows ヘッダーからほとんど使用されていない部分を除外する 4 | // Windows ヘッダー ファイル 5 | #include 6 | 7 | GUID __stdcall GetSPDFIDWaveFormatEx(); 8 | GUID __stdcall GetSPDFIDText(); 9 | -------------------------------------------------------------------------------- /SAPIGetStaticValueLib/pch.cpp: -------------------------------------------------------------------------------- 1 | // pch.cpp: プリコンパイル済みヘッダーに対応するソース ファイル 2 | 3 | #include "pch.h" 4 | 5 | // プリコンパイル済みヘッダーを使用している場合、コンパイルを成功させるにはこのソース ファイルが必要です。 6 | -------------------------------------------------------------------------------- /SAPIGetStaticValueLib/pch.h: -------------------------------------------------------------------------------- 1 | // pch.h: プリコンパイル済みヘッダー ファイルです。 2 | // 次のファイルは、その後のビルドのビルド パフォーマンスを向上させるため 1 回だけコンパイルされます。 3 | // コード補完や多くのコード参照機能などの IntelliSense パフォーマンスにも影響します。 4 | // ただし、ここに一覧表示されているファイルは、ビルド間でいずれかが更新されると、すべてが再コンパイルされます。 5 | // 頻繁に更新するファイルをここに追加しないでください。追加すると、パフォーマンス上の利点がなくなります。 6 | 7 | #ifndef PCH_H 8 | #define PCH_H 9 | 10 | // プリコンパイルするヘッダーをここに追加します 11 | #include "framework.h" 12 | 13 | #endif //PCH_H 14 | -------------------------------------------------------------------------------- /SFVvCommon/Common.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Win32; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Reflection; 7 | 8 | namespace SFVvCommon 9 | { 10 | public class Common 11 | { 12 | #region guid 13 | 14 | public const string guidString = "7A1BB9C4-DF39-4E01-A8DC-20DC1A0C03C6"; 15 | /// 16 | /// TTSエンジンのcomで使用されるCLSID 17 | /// 18 | public static Guid CLSID { get; } = new Guid(guidString); 19 | 20 | /// 21 | /// レジストリ用Guid書式指定子 22 | /// 23 | /// B書式指定子は中かっこ"{"で囲われる 24 | public static string RegClsidFormatString { get; } = "B"; 25 | 26 | #endregion 27 | 28 | #region レジストリ 29 | 30 | public const string tokensRegKey = @"SOFTWARE\Microsoft\Speech\Voices\Tokens\"; 31 | public const string regSpeakerNumber = "SpeakerNumber"; 32 | public const string regClsid = "CLSID"; 33 | public const string regName = "Name"; 34 | public const string regStyleName = "StyleName"; 35 | public const string regPort = "Port"; 36 | public const string regAttributes = "Attributes"; 37 | public const string regAppName = "AppName"; 38 | 39 | 40 | /// 41 | /// Windowsのレジストリから、SAPIForVOICEVOXのスピーカー情報を削除します。 42 | /// 43 | public static void ClearStyleFromWindowsRegistry() 44 | { 45 | //SAPIForVOICEVOXのトークンを表すキーの列挙 46 | using (RegistryKey regTokensKey = Registry.LocalMachine.OpenSubKey(tokensRegKey, true)) 47 | { 48 | string[] tokenNames = regTokensKey.GetSubKeyNames(); 49 | foreach (string tokenName in tokenNames) 50 | { 51 | using (RegistryKey tokenKey = regTokensKey.OpenSubKey(tokenName)) 52 | { 53 | string clsid = (string)tokenKey.GetValue(regClsid); 54 | if (clsid == CLSID.ToString(RegClsidFormatString)) 55 | { 56 | regTokensKey.DeleteSubKeyTree(tokenName); 57 | } 58 | } 59 | } 60 | } 61 | } 62 | 63 | #endregion 64 | 65 | const string GeneralSettingXMLFileName = "GeneralSetting.xml"; 66 | const string BatchParameterSettingXMLFileName = "BatchParameter.xml"; 67 | const string SpeakerParameterSettingXMLFileName = "SpeakerParameter.xml"; 68 | const string StyleRegistrationSettingXMLFileName = "StyleRegistration.xml"; 69 | 70 | /// 71 | /// スタイルの並び替えを行います。 72 | /// 73 | /// スタイル配列 74 | /// 並び替えされた配列 75 | public static IEnumerable SortStyle(IEnumerable styles) 76 | { 77 | return styles.OrderBy(x => x.Port).ThenBy(x => x.Name, new StyleComparer()).ThenBy(x => x.ID); 78 | } 79 | 80 | /// 81 | /// 現在のバージョンを取得します。 82 | /// 83 | /// 84 | public static Version GetCurrentVersion() 85 | { 86 | Assembly assembly = GetThisAssembly(); 87 | AssemblyName asmName = assembly.GetName(); 88 | return asmName.Version; 89 | } 90 | 91 | /// 92 | /// 現在実行中のコードを含むアセンブリを返します。 93 | /// 94 | /// 95 | static public Assembly GetThisAssembly() 96 | { 97 | return Assembly.GetExecutingAssembly(); 98 | } 99 | 100 | /// 101 | /// 実行中のコードを格納しているアセンブリのある場所を返します。 102 | /// 103 | /// 104 | static public string GetThisAppDirectory() 105 | { 106 | string appPath = GetThisAssembly().Location; 107 | return Path.GetDirectoryName(appPath); 108 | } 109 | 110 | /// 111 | /// 全般設定ファイルの名前を取得します。 112 | /// 113 | /// 全般設定ファイル名 114 | static public string GetGeneralSettingFileName() 115 | { 116 | string directoryName = GetThisAppDirectory(); 117 | return Path.Combine(directoryName, GeneralSettingXMLFileName); 118 | } 119 | 120 | /// 121 | /// 調声設定ファイル名を取得します。 122 | /// 123 | /// 調声設定ファイル名 124 | static public string GetBatchParameterSettingFileName() 125 | { 126 | string directoryName = GetThisAppDirectory(); 127 | return Path.Combine(directoryName, BatchParameterSettingXMLFileName); 128 | } 129 | 130 | /// 131 | /// キャラ調声設定ファイル名を取得します。 132 | /// 133 | /// 134 | static public string GetSpeakerParameterSettingFileName() 135 | { 136 | string directoryName = GetThisAppDirectory(); 137 | return Path.Combine(directoryName, SpeakerParameterSettingXMLFileName); 138 | } 139 | 140 | /// 141 | /// スタイル登録設定ファイル名を取得します。 142 | /// 143 | /// 144 | static public string GetStyleRegistrationSettingFileName() 145 | { 146 | string directoryName = GetThisAppDirectory(); 147 | return Path.Combine(directoryName, StyleRegistrationSettingXMLFileName); 148 | } 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /SFVvCommon/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 5 | // 制御されます。アセンブリに関連付けられている情報を変更するには、 6 | // これらの属性値を変更してください。 7 | [assembly: AssemblyTitle("SFVvCommon")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("SFVvCommon")] 12 | [assembly: AssemblyCopyright("Copyright © 2021")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから 17 | // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 18 | // その型の ComVisible 属性を true に設定してください。 19 | [assembly: ComVisible(false)] 20 | 21 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります 22 | [assembly: Guid("43723cd5-50fe-4be9-b8b7-7b08e3f2156c")] 23 | 24 | // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: 25 | // 26 | // メジャー バージョン 27 | // マイナー バージョン 28 | // ビルド番号 29 | // リビジョン 30 | // 31 | // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます 32 | // 既定値にすることができます: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("99.99.999.0")] 35 | [assembly: AssemblyFileVersion("99.99.999.0")] 36 | -------------------------------------------------------------------------------- /SFVvCommon/SFVvCommon.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {43723CD5-50FE-4BE9-B8B7-7B08E3F2156C} 8 | Library 9 | Properties 10 | SFVvCommon 11 | SFVvCommon 12 | v4.7.1 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /SFVvCommon/SapiStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SFVvCommon 5 | { 6 | /// 7 | /// SAPI用のスタイル。レジストリ登録に必要なものを保持します。 8 | /// 9 | public class SapiStyle : StyleBase 10 | { 11 | public SapiStyle() : base() 12 | { 13 | CLSID = Common.CLSID; 14 | } 15 | 16 | /// 17 | /// SAPIスタイルを初期化します。 18 | /// 19 | /// 話者名 20 | /// スタイル名 21 | /// ID 22 | /// SAPIエンジンのクラスID 23 | public SapiStyle(string appName, string name, string styleName, int iD, int port, Guid clsid) : base(appName, name, styleName, iD, port) 24 | { 25 | CLSID = clsid; 26 | } 27 | 28 | /// 29 | /// VOICEVOXスタイルとクラスIDを指定して、SAPIスタイルを初期化します。 30 | /// 31 | /// VOICEVOXスタイル 32 | /// SAPIエンジンのクラスID 33 | public SapiStyle(VoicevoxStyle voicevoxStyle, Guid clsid) : this(voicevoxStyle.AppName, voicevoxStyle.Name, voicevoxStyle.StyleName, voicevoxStyle.ID, voicevoxStyle.Port, clsid) 34 | { 35 | } 36 | 37 | /// 38 | /// sapiに表示される名前 39 | /// 40 | public string SpaiName 41 | { 42 | get 43 | { 44 | return AppName + " " + Name + " " + StyleName; 45 | } 46 | } 47 | 48 | /// 49 | /// SAPIForVOICEVOXモジュールのGuid 50 | /// 51 | public Guid CLSID { get; set; } 52 | 53 | public override bool Equals(object obj) 54 | { 55 | return obj is SapiStyle style && 56 | base.Equals(obj) && 57 | CLSID.Equals(style.CLSID); 58 | } 59 | 60 | public override int GetHashCode() 61 | { 62 | int hashCode = 2093058940; 63 | hashCode = hashCode * -1521134295 + base.GetHashCode(); 64 | hashCode = hashCode * -1521134295 + CLSID.GetHashCode(); 65 | return hashCode; 66 | } 67 | 68 | public static bool operator ==(SapiStyle left, SapiStyle right) 69 | { 70 | return EqualityComparer.Default.Equals(left, right); 71 | } 72 | 73 | public static bool operator !=(SapiStyle left, SapiStyle right) 74 | { 75 | return !(left == right); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /SFVvCommon/StyleBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SFVvCommon 5 | { 6 | /// 7 | /// スタイル情報を保持する親クラス。 8 | /// 9 | public class StyleBase 10 | { 11 | public StyleBase() 12 | { 13 | AppName = "VOICEVOX"; 14 | Name = ""; 15 | StyleName = ""; 16 | ID = 0; 17 | Port = 0; 18 | } 19 | 20 | public StyleBase(string appName, string name, string styleName, int iD, int port) 21 | { 22 | AppName = appName ?? throw new ArgumentNullException(nameof(appName)); 23 | Name = name ?? throw new ArgumentNullException(nameof(name)); 24 | StyleName = styleName ?? throw new ArgumentNullException(nameof(styleName)); 25 | ID = iD; 26 | Port = port; 27 | } 28 | 29 | /// 30 | /// アプリ名 31 | /// 32 | public string AppName { get; set; } 33 | 34 | /// 35 | /// 話者名 36 | /// 37 | public string Name { get; set; } 38 | 39 | /// 40 | /// スタイル 41 | /// 42 | public string StyleName { get; set; } 43 | 44 | /// 45 | /// ID 46 | /// 47 | public int ID { get; set; } 48 | 49 | /// 50 | /// ポート番号 51 | /// 52 | public int Port { get; set; } 53 | 54 | public override bool Equals(object obj) 55 | { 56 | return obj is StyleBase style && 57 | AppName == style.AppName && 58 | Name == style.Name && 59 | StyleName == style.StyleName && 60 | ID == style.ID && 61 | Port == style.Port; 62 | } 63 | 64 | public override int GetHashCode() 65 | { 66 | int hashCode = 830617096; 67 | hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(AppName); 68 | hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Name); 69 | hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(StyleName); 70 | hashCode = hashCode * -1521134295 + ID.GetHashCode(); 71 | hashCode = hashCode * -1521134295 + Port.GetHashCode(); 72 | return hashCode; 73 | } 74 | 75 | public static bool operator ==(StyleBase left, StyleBase right) 76 | { 77 | return EqualityComparer.Default.Equals(left, right); 78 | } 79 | 80 | public static bool operator !=(StyleBase left, StyleBase right) 81 | { 82 | return !(left == right); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /SFVvCommon/StyleComparer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SFVvCommon 5 | { 6 | /// 7 | /// スタイルの並び替え情報を記したクラス。 8 | /// nameOrderの順に並び替える用にする。 9 | /// nameOrderに含まれていない場合は、nameOrderより後に標準の順番で並ぶ。 10 | /// 11 | public class StyleComparer : IComparer 12 | { 13 | private readonly string[] nameOrder = { "四国めたん", "ずんだもん", "春日部つむぎ", "雨晴はう", "波音リツ", "玄野武宏", "白上虎太郎", "青山龍星", "冥鳴ひまり", "九州そら", "もち子さん", "剣崎雌雄" }; 14 | /// 15 | /// 大小関係を調べて、対応した値を返します。 16 | /// 17 | /// 18 | /// 19 | /// xがyより小さいときはマイナスの数、大きいときはプラスの数、同じときは0を返す 20 | public int Compare(string x, string y) 21 | { 22 | //nullが最も小さいとする 23 | if (x == null && y == null) 24 | { 25 | return 0; 26 | } 27 | if (x == null) 28 | { 29 | return -1; 30 | } 31 | if (y == null) 32 | { 33 | return 1; 34 | } 35 | 36 | //同じ場合は0 37 | if (x == y) 38 | { 39 | return 0; 40 | } 41 | 42 | //nameOrderの何番目か判定して、引き算。 43 | int xIndex = Array.IndexOf(nameOrder, x); 44 | int yIndex = Array.IndexOf(nameOrder, y); 45 | if (xIndex < 0 && yIndex < 0) 46 | { 47 | return string.Compare(x, y); 48 | } 49 | if (xIndex < 0) 50 | { 51 | return 1; 52 | } 53 | if (yIndex < 0) 54 | { 55 | return -1; 56 | } 57 | return xIndex - yIndex; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /SFVvCommon/VoicevoxStyle.cs: -------------------------------------------------------------------------------- 1 | namespace SFVvCommon 2 | { 3 | /// 4 | /// VOICEVOX側のスタイル情報を表します。 5 | /// 6 | public class VoicevoxStyle : StyleBase 7 | { 8 | /// 9 | /// スタイル情報を初期化します。 10 | /// 11 | /// 12 | /// 13 | /// 14 | public VoicevoxStyle(string appName, string name, string styleName, int iD, int port) : base(appName, name, styleName, iD, port) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Setting/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Setting/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Setting/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Setting 4 | { 5 | /// 6 | /// App.xaml の相互作用ロジック 7 | /// 8 | public partial class App : Application 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Setting/Converter/DoubleStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace Setting 6 | { 7 | /// 8 | /// 浮動小数点を文字列に変換するコンバーター。一桁版 9 | /// 10 | [ValueConversion(typeof(double), typeof(string))] 11 | class DoubleStringConverter : IValueConverter 12 | { 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | if (!(value is double doubleValue)) 16 | { 17 | return ""; 18 | } 19 | return doubleValue.ToString("F2"); 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | return 0.0; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Setting/Converter/ParameterValueModeToBool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace Setting 6 | { 7 | class ParameterValueModeToBool : IValueConverter 8 | { 9 | // ConverterParameterをEnumに変換するメソッド 10 | private ParameterValueMode ConvertFromConverterParameter(object parameter) 11 | { 12 | string parameterString = parameter as string; 13 | return (ParameterValueMode)Enum.Parse(typeof(ParameterValueMode), parameterString); 14 | } 15 | 16 | #region IValueConverter メンバー 17 | // Enum → bool 18 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | // XAMLに定義されたConverterParameterをEnumに変換する 21 | ParameterValueMode parameterValue = ConvertFromConverterParameter(parameter); 22 | 23 | // ConverterParameterとバインディングソースの値が等しいか? 24 | return parameterValue.Equals(value); 25 | } 26 | 27 | // bool → Enum 28 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 29 | { 30 | // true→falseの変化は無視する 31 | // ※こうすることで、選択されたラジオボタンだけをデータに反映させる 32 | if (!(bool)value) 33 | return System.Windows.DependencyProperty.UnsetValue; 34 | 35 | // ConverterParameterをEnumに変換して返す 36 | return ConvertFromConverterParameter(parameter); 37 | } 38 | #endregion 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Setting/Converter/SynthesisSettingModeToBool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace Setting 6 | { 7 | class SynthesisSettingModeToBool : IValueConverter 8 | { 9 | // ConverterParameterをEnumに変換するメソッド 10 | private SynthesisSettingMode ConvertFromConverterParameter(object parameter) 11 | { 12 | string parameterString = parameter as string; 13 | return (SynthesisSettingMode)Enum.Parse(typeof(SynthesisSettingMode), parameterString); 14 | } 15 | 16 | #region IValueConverter メンバー 17 | // Enum → bool 18 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | // XAMLに定義されたConverterParameterをEnumに変換する 21 | SynthesisSettingMode parameterValue = ConvertFromConverterParameter(parameter); 22 | 23 | // ConverterParameterとバインディングソースの値が等しいか? 24 | return parameterValue.Equals(value); 25 | } 26 | 27 | // bool → Enum 28 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 29 | { 30 | // true→falseの変化は無視する 31 | // ※こうすることで、選択されたラジオボタンだけをデータに反映させる 32 | if (!(bool)value) 33 | return System.Windows.DependencyProperty.UnsetValue; 34 | 35 | // ConverterParameterをEnumに変換して返す 36 | return ConvertFromConverterParameter(parameter); 37 | } 38 | #endregion 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Setting/Model/GeneralSetting.cs: -------------------------------------------------------------------------------- 1 | namespace Setting 2 | { 3 | /// 4 | /// 全般設定を定義します。 5 | /// 6 | public class GeneralSetting 7 | { 8 | /// 9 | /// 句点で分割するかどうか。 10 | /// 11 | public bool? isSplitKuten = true; 12 | 13 | /// 14 | /// 読点で分割するかどうか。 15 | /// 16 | public bool? isSplitTouten = false; 17 | 18 | /// 19 | /// 改行で分割するかどうか。 20 | /// 21 | public bool? isSplitNewLine = false; 22 | 23 | /// 24 | /// 調声設定モード 25 | /// 26 | public SynthesisSettingMode synthesisSettingMode = SynthesisSettingMode.Batch; 27 | 28 | /// 29 | /// エンジンエラーを通知するかどうか 30 | /// 31 | public bool? shouldNotifyEngineError = true; 32 | 33 | /// 34 | /// SAPIイベントを使うかどうか 35 | /// 36 | public bool? useSspiEvent = true; 37 | 38 | /// 39 | /// 疑問文を自動調声するかどうか 40 | /// 41 | public bool? useInterrogativeAutoAdjustment = false; 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Setting/Model/ParameterValueMode.cs: -------------------------------------------------------------------------------- 1 | namespace Setting 2 | { 3 | /// 4 | /// SAPIの値を使用するか、設定アプリの値を使用するかを表します。 5 | /// 6 | public enum ParameterValueMode 7 | { 8 | /// 9 | /// SAPIの値を使用します。 10 | /// 11 | SAPI, 12 | /// 13 | /// 設定アプリの値を使用します。 14 | /// 15 | SettingApp 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Setting/Model/SynthesisParameter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Runtime.CompilerServices; 4 | 5 | namespace Setting 6 | { 7 | /// 8 | /// VOICEVOXに必要なパラメータを定義します。 9 | /// 10 | public class SynthesisParameter : INotifyPropertyChanged 11 | { 12 | #region INotifyPropertyChangedの実装 13 | public event PropertyChangedEventHandler PropertyChanged; 14 | 15 | public void RaisePropertyChanged([CallerMemberName] string propertyName = null) 16 | => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 17 | 18 | #endregion 19 | 20 | #region Equals 21 | public override bool Equals(object obj) 22 | { 23 | return obj is SynthesisParameter parameter && 24 | ValueMode == parameter.ValueMode && 25 | Volume == parameter.Volume && 26 | Speed == parameter.Speed && 27 | Pitch == parameter.Pitch && 28 | PrePhonemeLength == parameter.PrePhonemeLength && 29 | PostPhonemeLength == parameter.PostPhonemeLength && 30 | Intonation == parameter.Intonation; 31 | } 32 | 33 | public override int GetHashCode() 34 | { 35 | int hashCode = 1557109181; 36 | hashCode = hashCode * -1521134295 + ValueMode.GetHashCode(); 37 | hashCode = hashCode * -1521134295 + Volume.GetHashCode(); 38 | hashCode = hashCode * -1521134295 + Speed.GetHashCode(); 39 | hashCode = hashCode * -1521134295 + Pitch.GetHashCode(); 40 | hashCode = hashCode * -1521134295 + PrePhonemeLength.GetHashCode(); 41 | hashCode = hashCode * -1521134295 + PostPhonemeLength.GetHashCode(); 42 | hashCode = hashCode * -1521134295 + Intonation.GetHashCode(); 43 | return hashCode; 44 | } 45 | 46 | #endregion 47 | 48 | private ParameterValueMode _ValueMode = ParameterValueMode.SAPI; 49 | /// 50 | /// SAPIの値を使用するか、設定アプリの値を使用するかを取得、設定します。 51 | /// 52 | public ParameterValueMode ValueMode 53 | { 54 | get => _ValueMode; 55 | set 56 | { 57 | if (_ValueMode == value) return; 58 | _ValueMode = value; 59 | RaisePropertyChanged(); 60 | } 61 | } 62 | 63 | private double _Volume = 1; 64 | /// 65 | /// 音量を取得、設定します。 66 | /// 67 | public double Volume 68 | { 69 | get => _Volume; 70 | set 71 | { 72 | if (_Volume == value) return; 73 | _Volume = value; 74 | RaisePropertyChanged(); 75 | } 76 | } 77 | 78 | private double _Speed = 1; 79 | /// 80 | /// 話速を取得、設定します。 81 | /// 82 | public double Speed 83 | { 84 | get => _Speed; 85 | set 86 | { 87 | if (_Speed == value) return; 88 | _Speed = value; 89 | RaisePropertyChanged(); 90 | } 91 | } 92 | 93 | private double _Pitch = 0; 94 | /// 95 | /// 音高を取得、設定します。 96 | /// 97 | public double Pitch 98 | { 99 | get => _Pitch; 100 | set 101 | { 102 | if (_Pitch == value) return; 103 | _Pitch = value; 104 | RaisePropertyChanged(); 105 | } 106 | } 107 | 108 | private double _Intonation = 1; 109 | /// 110 | /// 抑揚を取得、設定します。 111 | /// 112 | public double Intonation 113 | { 114 | get => _Intonation; 115 | set 116 | { 117 | if (_Intonation == value) return; 118 | _Intonation = value; 119 | RaisePropertyChanged(); 120 | } 121 | } 122 | 123 | private double _PrePhonemeLength = 0.1; 124 | /// 125 | /// 開始無音を取得、設定します。 126 | /// 127 | public double PrePhonemeLength 128 | { 129 | get => _PrePhonemeLength; 130 | set 131 | { 132 | if (_PrePhonemeLength == value) return; 133 | _PrePhonemeLength = value; 134 | RaisePropertyChanged(); 135 | } 136 | } 137 | 138 | private double _PostPhonemeLength = 0.1; 139 | /// 140 | /// 終了無音を取得、設定します。 141 | /// 142 | public double PostPhonemeLength 143 | { 144 | get => _PostPhonemeLength; 145 | set 146 | { 147 | if (_PostPhonemeLength == value) return; 148 | _PostPhonemeLength = value; 149 | RaisePropertyChanged(); 150 | } 151 | } 152 | 153 | private int _Port = 50021; 154 | /// 155 | /// ポートを取得、設定します。 156 | /// 157 | public int Port 158 | { 159 | get => _Port; 160 | set 161 | { 162 | if (_Port == value) return; 163 | _Port = value; 164 | RaisePropertyChanged(); 165 | } 166 | } 167 | 168 | private int _ID = 0; 169 | /// 170 | /// 話者IDを取得、設定します。 171 | /// 172 | public int ID 173 | { 174 | get => _ID; 175 | set 176 | { 177 | if (_ID == value) return; 178 | _ID = value; 179 | RaisePropertyChanged(); 180 | } 181 | } 182 | 183 | /// 184 | /// 設定ファイルのバージョンを所得、設定します。 185 | /// 186 | public string Version { get; set; } = new Version(1, 0, 0).ToString(); 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /Setting/Model/SynthesisSettingMode.cs: -------------------------------------------------------------------------------- 1 | namespace Setting 2 | { 3 | /// 4 | /// 調声モード 5 | /// 6 | public enum SynthesisSettingMode 7 | { 8 | /// 9 | /// 一括 10 | /// 11 | Batch, 12 | /// 13 | /// キャラクター毎 14 | /// 15 | EachCharacter 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Setting/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | 5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 6 | // アセンブリに関連付けられている情報を変更するには、 7 | // これらの属性値を変更してください。 8 | [assembly: AssemblyTitle("Setting")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Setting")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから 18 | // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 19 | // その型の ComVisible 属性を true に設定してください。 20 | [assembly: ComVisible(false)] 21 | 22 | //ローカライズ可能なアプリケーションのビルドを開始するには、 23 | //.csproj ファイルの CultureYouAreCodingWith を 24 | // 内部で設定します。たとえば、 25 | //ソース ファイルで英語を使用している場合、 を en-US に設定します。次に、 26 | //下の NeutralResourceLanguage 属性のコメントを解除します。下の行の "en-US" を 27 | //プロジェクト ファイルの UICulture 設定と一致するよう更新します。 28 | 29 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 30 | 31 | 32 | [assembly: ThemeInfo( 33 | ResourceDictionaryLocation.None, //テーマ固有のリソース ディクショナリが置かれている場所 34 | //(リソースがページ、 35 | // またはアプリケーション リソース ディクショナリに見つからない場合に使用されます) 36 | ResourceDictionaryLocation.SourceAssembly //汎用リソース ディクショナリが置かれている場所 37 | //(リソースがページ、 38 | //アプリケーション、またはいずれのテーマ固有のリソース ディクショナリにも見つからない場合に使用されます) 39 | )] 40 | 41 | 42 | // アセンブリのバージョン情報は次の 4 つの値で構成されています: 43 | // 44 | // メジャー バージョン 45 | // マイナー バージョン 46 | // ビルド番号 47 | // リビジョン 48 | // 49 | // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます 50 | // 既定値にすることができます: 51 | // [assembly: AssemblyVersion("1.0.*")] 52 | [assembly: AssemblyVersion("99.99.999.0")] 53 | [assembly: AssemblyFileVersion("99.99.999.0")] 54 | -------------------------------------------------------------------------------- /Setting/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、正しくない動作の原因になったり、 7 | // コードが再生成されるときに失われたりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | 12 | namespace Setting.Properties 13 | { 14 | /// 15 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 16 | /// 17 | // このクラスは StronglyTypedResourceBuilder クラスによって ResGen 18 | // または Visual Studio のようなツールを使用して自動生成されました。 19 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に 20 | // ResGen を実行し直すか、または VS プロジェクトをリビルドします。 21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 24 | internal class Resources 25 | { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() 33 | { 34 | } 35 | 36 | /// 37 | /// このクラスで使用されるキャッシュされた ResourceManager インスタンスを返します。 38 | /// 39 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 40 | internal static global::System.Resources.ResourceManager ResourceManager 41 | { 42 | get 43 | { 44 | if ((resourceMan == null)) 45 | { 46 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Setting.Properties.Resources", typeof(Resources).Assembly); 47 | resourceMan = temp; 48 | } 49 | return resourceMan; 50 | } 51 | } 52 | 53 | /// 54 | /// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします 55 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 56 | /// 57 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 58 | internal static global::System.Globalization.CultureInfo Culture 59 | { 60 | get 61 | { 62 | return resourceCulture; 63 | } 64 | set 65 | { 66 | resourceCulture = value; 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Setting/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Setting/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | 12 | namespace Setting.Properties 13 | { 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 17 | { 18 | 19 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 20 | 21 | public static Settings Default 22 | { 23 | get 24 | { 25 | return defaultInstance; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Setting/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Setting/Setting.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {91B73544-CF6A-4453-9AA8-9949D474E2B4} 8 | WinExe 9 | Setting 10 | Setting 11 | v4.7.1 12 | 512 13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 4 15 | true 16 | true 17 | 18 | 19 | true 20 | bin\x64\Debug\ 21 | TRACE;DEBUG;x64 22 | full 23 | x64 24 | 7.3 25 | prompt 26 | true 27 | 28 | 29 | bin\x64\Release\ 30 | TRACE;x64 31 | true 32 | pdbonly 33 | x64 34 | 7.3 35 | prompt 36 | true 37 | 38 | 39 | true 40 | bin\x86\Debug\ 41 | DEBUG;TRACE 42 | full 43 | x86 44 | 7.3 45 | prompt 46 | true 47 | 48 | 49 | bin\x86\Release\ 50 | TRACE 51 | true 52 | pdbonly 53 | x86 54 | 7.3 55 | prompt 56 | true 57 | 58 | 59 | app.manifest 60 | 61 | 62 | icon\settings.ico 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 4.0 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | MSBuild:Compile 83 | Designer 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | VersionInfoWindow.xaml 94 | 95 | 96 | voicevoxParameterSlider.xaml 97 | 98 | 99 | MSBuild:Compile 100 | Designer 101 | 102 | 103 | App.xaml 104 | Code 105 | 106 | 107 | 108 | MainWindow.xaml 109 | Code 110 | 111 | 112 | Designer 113 | MSBuild:Compile 114 | 115 | 116 | Designer 117 | MSBuild:Compile 118 | 119 | 120 | 121 | 122 | Code 123 | 124 | 125 | True 126 | True 127 | Resources.resx 128 | 129 | 130 | True 131 | Settings.settings 132 | True 133 | 134 | 135 | ResXFileCodeGenerator 136 | Resources.Designer.cs 137 | 138 | 139 | 140 | SettingsSingleFileGenerator 141 | Settings.Designer.cs 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | {43723cd5-50fe-4be9-b8b7-7b08e3f2156c} 153 | SFVvCommon 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /Setting/View/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /StyleRegistrationTool/View/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using SFVvCommon; 2 | using StyleRegistrationTool.ViewModel; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Collections.ObjectModel; 6 | using System.Linq; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | 10 | namespace StyleRegistrationTool 11 | { 12 | /// 13 | /// MainWindow.xaml の相互作用ロジック 14 | /// 15 | public partial class MainWindow : Window 16 | { 17 | MainViewModel viewModel; 18 | 19 | public MainWindow() 20 | { 21 | InitializeComponent(); 22 | 23 | #if x64 24 | string bitStr = "64bit版"; 25 | #else 26 | string bitStr = "32bit版"; 27 | #endif 28 | this.Title += bitStr; 29 | 30 | viewModel = new MainViewModel(this); 31 | this.DataContext = viewModel; 32 | this.Loaded += viewModel.MainWindow_Loaded; 33 | } 34 | 35 | /// 36 | /// ウィンドウハンドルを取得します。 37 | /// 38 | public IntPtr Handle 39 | { 40 | get 41 | { 42 | var helper = new System.Windows.Interop.WindowInteropHelper(this); 43 | return helper.Handle; 44 | } 45 | } 46 | 47 | private void VoicevoxStyleList_SelectionChanged(object sender, SelectionChangedEventArgs e) 48 | { 49 | viewModel.VoicevoxStyle_SelectedItems = VoicevoxStyleList.SelectedItems.Cast(); 50 | } 51 | 52 | private void SapiStyleList_SelectionChanged(object sender, SelectionChangedEventArgs e) 53 | { 54 | viewModel.SapiStyle_SelectedItems = SapiStyleList.SelectedItems.Cast(); 55 | } 56 | 57 | private void GridViewColumnHeader_Click(object sender, RoutedEventArgs e) 58 | { 59 | GridViewColumnHeader columnHeader = (GridViewColumnHeader)sender; 60 | string columnTag = columnHeader.Tag.ToString(); 61 | string columnHeaderString = columnHeader.Content.ToString(); 62 | 63 | bool isAscending = true; 64 | if (columnHeaderString.Contains("▼")) 65 | { 66 | isAscending = false; 67 | } 68 | 69 | IEnumerable sortedList; 70 | switch (columnTag) 71 | { 72 | case nameof(SapiStyle.AppName): 73 | sortedList = isAscending ? viewModel.SapiStyles.OrderBy(x => x.AppName) : viewModel.SapiStyles.OrderByDescending(x => x.AppName); 74 | break; 75 | case nameof(SapiStyle.Name): 76 | sortedList = isAscending ? viewModel.SapiStyles.OrderBy(x => x.Name, new StyleComparer()) : viewModel.SapiStyles.OrderByDescending(x => x.Name, new StyleComparer()); 77 | break; 78 | case nameof(SapiStyle.StyleName): 79 | sortedList = isAscending ? viewModel.SapiStyles.OrderBy(x => x.StyleName) : viewModel.SapiStyles.OrderByDescending(x => x.StyleName); 80 | break; 81 | case nameof(SapiStyle.ID): 82 | sortedList = isAscending ? viewModel.SapiStyles.OrderBy(x => x.ID) : viewModel.SapiStyles.OrderByDescending(x => x.ID); 83 | break; 84 | case nameof(SapiStyle.Port): 85 | sortedList = isAscending ? viewModel.SapiStyles.OrderBy(x => x.Port) : viewModel.SapiStyles.OrderByDescending(x => x.Port); 86 | break; 87 | default: 88 | return; 89 | } 90 | 91 | if (columnHeaderString.Contains("▼")) 92 | { 93 | columnHeaderString = columnHeaderString.Replace("▼", "▲"); 94 | } 95 | else if (columnHeaderString.Contains("▲")) 96 | { 97 | columnHeaderString = columnHeaderString.Replace("▲", "▼"); 98 | } 99 | else 100 | { 101 | if (isAscending) 102 | { 103 | columnHeaderString += "▼"; 104 | } 105 | else 106 | { 107 | columnHeaderString += "▲"; 108 | } 109 | columnHeader.Width += 10; 110 | } 111 | columnHeader.Content = columnHeaderString; 112 | //自分以外のヘッダーから▼マークを削除 113 | List columnHeaders = new List() { AppNameHeader, NameHeader, StyleNameHeader, IDHeader, PortHeader }; 114 | columnHeaders.Remove(columnHeader); 115 | foreach (var item in columnHeaders) 116 | { 117 | string headerString = item.Content.ToString(); 118 | headerString = headerString.Replace("▲", ""); 119 | headerString = headerString.Replace("▼", ""); 120 | item.Content = headerString; 121 | } 122 | 123 | viewModel.SapiStyles = new ObservableCollection(sortedList); 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /StyleRegistrationTool/View/WaitingCircle.xaml: -------------------------------------------------------------------------------- 1 |  5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /StyleRegistrationTool/View/WaitingCircle.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | using System.Windows.Media.Animation; 6 | using System.Windows.Shapes; 7 | 8 | namespace StyleRegistrationTool.View 9 | { 10 | /// 11 | /// WaitingCircle.xaml の相互作用ロジック 12 | /// 13 | public partial class WaitingCircle : UserControl 14 | { 15 | //https://araramistudio.jimdo.com/2016/11/24/wpf%E3%81%A7waitingcircle%E3%82%B3%E3%83%B3%E3%83%88%E3%83%AD%E3%83%BC%E3%83%AB%E3%82%92%E4%BD%9C%E3%82%8B/ 16 | //から引用 17 | 18 | public static readonly DependencyProperty CircleColorProperty = 19 | DependencyProperty.Register( 20 | "CircleColor", // プロパティ名を指定 21 | typeof(Color), // プロパティの型を指定 22 | typeof(WaitingCircle), // プロパティを所有する型を指定 23 | new UIPropertyMetadata(Color.FromRgb(90, 117, 153), 24 | (d, e) => { (d as WaitingCircle).OnCircleColorPropertyChanged(e); })); 25 | public Color CircleColor 26 | { 27 | get { return (Color)GetValue(CircleColorProperty); } 28 | set { SetValue(CircleColorProperty, value); } 29 | } 30 | 31 | 32 | public WaitingCircle() 33 | { 34 | InitializeComponent(); 35 | 36 | double cx = 50.0; 37 | double cy = 50.0; 38 | double r = 45.0; 39 | int cnt = 14; 40 | double deg = 360.0 / (double)cnt; 41 | double degS = deg * 0.2; 42 | for (int i = 0; i < cnt; ++i) 43 | { 44 | var si1 = Math.Sin((270.0 - (double)i * deg) / 180.0 * Math.PI); 45 | var co1 = Math.Cos((270.0 - (double)i * deg) / 180.0 * Math.PI); 46 | var si2 = Math.Sin((270.0 - (double)(i + 1) * deg + degS) / 180.0 * Math.PI); 47 | var co2 = Math.Cos((270.0 - (double)(i + 1) * deg + degS) / 180.0 * Math.PI); 48 | var x1 = r * co1 + cx; 49 | var y1 = r * si1 + cy; 50 | var x2 = r * co2 + cx; 51 | var y2 = r * si2 + cy; 52 | 53 | var path = new Path(); 54 | path.Data = Geometry.Parse(string.Format("M {0},{1} A {2},{2} 0 0 0 {3},{4}", x1, y1, r, x2, y2)); 55 | path.Stroke = new SolidColorBrush(Color.FromArgb((byte)(255 - (i * 256 / cnt)), CircleColor.R, CircleColor.G, CircleColor.B)); 56 | path.StrokeThickness = 10.0; 57 | MainCanvas.Children.Add(path); 58 | } 59 | 60 | var kf = new DoubleAnimationUsingKeyFrames(); 61 | kf.RepeatBehavior = RepeatBehavior.Forever; 62 | for (int i = 0; i < cnt; ++i) 63 | { 64 | kf.KeyFrames.Add(new DiscreteDoubleKeyFrame() 65 | { 66 | KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(i * 80)), 67 | Value = i * deg 68 | }); 69 | } 70 | MainTrans.BeginAnimation(RotateTransform.AngleProperty, kf); 71 | } 72 | 73 | public void OnCircleColorPropertyChanged(DependencyPropertyChangedEventArgs e) 74 | { 75 | if (null == MainCanvas) return; 76 | if (null == MainCanvas.Children) return; 77 | 78 | foreach (var child in MainCanvas.Children) 79 | { 80 | var shp = child as Shape; 81 | var sb = shp.Stroke as SolidColorBrush; 82 | var a = sb.Color.A; 83 | shp.Stroke = new SolidColorBrush(Color.FromArgb(a, CircleColor.R, CircleColor.G, CircleColor.B)); 84 | } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /StyleRegistrationTool/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 54 | 62 | 63 | 64 | 65 | 66 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /StyleRegistrationTool/icon/users-alt.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shigobu/SAPIForVOICEVOX/c35da21227fdbb010788694ca6df565508afa141/StyleRegistrationTool/icon/users-alt.ico -------------------------------------------------------------------------------- /StyleRegistrationTool/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tools/change_version.csx: -------------------------------------------------------------------------------- 1 | #r "System.Console" 2 | #r "System.Runtime" 3 | 4 | using System.IO; 5 | using System.Text.RegularExpressions; 6 | 7 | public int main() 8 | { 9 | if (Args.Count != 2) 10 | { 11 | Console.WriteLine("Invalid argument."); 12 | Console.WriteLine("[0] search directory"); 13 | Console.WriteLine("[1] version"); 14 | return -1; 15 | } 16 | string searchDirectory = Args[0]; 17 | string varsionStr = Args[1]; 18 | 19 | //フォルダの存在確認 20 | if (!Directory.Exists(searchDirectory)) 21 | { 22 | Console.WriteLine("検索フォルダがありません。"); 23 | return -1; 24 | } 25 | 26 | //バージョン文字列の確認 27 | if (!Version.TryParse(varsionStr, out Version temp)) 28 | { 29 | Console.WriteLine("バージョン文字列が不正です。"); 30 | return -1; 31 | } 32 | 33 | //AssemblyInfo.csのバージョン文字列置換 34 | string[] csFiles = Directory.GetFiles(searchDirectory, "AssemblyInfo.cs", SearchOption.AllDirectories).ToArray(); 35 | foreach (var file in csFiles) 36 | { 37 | ReplaceVersion(file, varsionStr); 38 | } 39 | 40 | //インストーラのバージョン置換。同時にProductCodeとPackageCodeの更新も必要 41 | string[] vdprojFiles = Directory.GetFiles(searchDirectory, "*.vdproj", SearchOption.AllDirectories).ToArray(); 42 | foreach (var file in vdprojFiles) 43 | { 44 | ReplaceVersion(file, varsionStr); 45 | SetNewProductCode(file); 46 | } 47 | 48 | Console.WriteLine("成功"); 49 | return 0; 50 | } 51 | 52 | /// 53 | /// バージョンを置換します。 54 | /// 55 | /// ファイル名 56 | /// バージョンを表す文字列 57 | public void ReplaceVersion(string fileName, string version) 58 | { 59 | string fileData = ""; 60 | using (StreamReader reader = new StreamReader(fileName, Encoding.UTF8)) 61 | { 62 | fileData = reader.ReadToEnd(); 63 | } 64 | 65 | fileData = fileData.Replace("99.99.999", version); 66 | 67 | using (StreamWriter writer = new StreamWriter(fileName, false, Encoding.UTF8)) 68 | { 69 | writer.Write(fileData); 70 | } 71 | } 72 | 73 | /// 74 | /// vdprojファイルのProductCodeとPackageCodeを新しいものに更新します。 75 | /// 76 | /// 更新対象のファイル名 77 | public void SetNewProductCode(string fileName) 78 | { 79 | string fileData = ""; 80 | using (StreamReader reader = new StreamReader(fileName, Encoding.UTF8)) 81 | { 82 | fileData = reader.ReadToEnd(); 83 | } 84 | 85 | fileData = SetNewCode(fileData, "ProductCode"); 86 | fileData = SetNewCode(fileData, "PackageCode"); 87 | 88 | using (StreamWriter writer = new StreamWriter(fileName, false, Encoding.UTF8)) 89 | { 90 | writer.Write(fileData); 91 | } 92 | } 93 | 94 | /// 95 | /// 指定のコードを更新します。 96 | /// 97 | /// vdprojファイルの中身 98 | /// 対象のコード名 99 | /// コードが更新された文字列 100 | public string SetNewCode(string input, string codeName) 101 | { 102 | //コード名をダブルコーテーションで囲う 103 | string code = "\"" + codeName + "\""; 104 | string matchPattern = code + " = \"8:{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}}\""; 105 | string replacePattern = code + " = \"8:" + Guid.NewGuid().ToString("B").ToUpper() + "\""; //B書式指定子は、ハイフン区切りの中かっこ囲み 106 | return Regex.Replace(input, matchPattern, replacePattern); 107 | } 108 | 109 | return main(); 110 | --------------------------------------------------------------------------------