-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
53 changed files
with
2,522 additions
and
868 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
build\ | ||
.vs\ | ||
# Visual Studio | ||
*.vcxproj.* | ||
/build/ | ||
/packages/ | ||
/src/main/jni/onecorenative/Generated Files | ||
/src/main/jni/onecorenative/Release | ||
/src/main/jni/onecorenative/x64 | ||
/src/main/resources/x64/* | ||
/src/main/resources/x86/* | ||
|
||
# DLLs are committed | ||
!/src/main/resources/x64/sapinative.dll | ||
!/src/main/resources/x64/onecorenative.dll | ||
!/src/main/resources/x86/sapinative.dll | ||
!/src/main/resources/x86/onecorenative.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,68 @@ | ||
# Daisy Pipeline 2 TTS Adapter - Microsoft SAPI and OneCore voices | ||
|
||
This adapter provides Text-to-speech capabilities to the DAISY pipeline 2 using Microsoft SAPI and (under developement) OneCore voices on Windows hosts. | ||
This adapter provides Text-to-speech capabilities to the DAISY pipeline 2 using Microsoft SAPI and (under development) OneCore voices on Windows hosts. | ||
|
||
## Building the adapter | ||
|
||
This adapter is made of Windows DLLs that use the Java Native Interface to be exposed to the pipeline, and a java-side connector between those DLLs and the pipeline framework. | ||
|
||
Stable release versions of the dlls are provided with the adapter, so the project can be build "as-is" using maven with the command `maven clean install`. | ||
Stable release versions of the DLLs are provided with the adapter, so the project can be built "as-is" using maven with the command `maven clean install`. | ||
|
||
If you want or need to update the dlls, you can rebuild the dlls before building the adapter following the instructions in the next section. | ||
If you want or need to update the DLLs, you can rebuild the DLLs before building the adapter by following the instructions in the next section. | ||
|
||
## Rebuilding the "sapinative" dlls | ||
## Rebuilding the "Sapinative" dlls | ||
|
||
To build the adapter's dlls, we recommend to install [Visual studio 2019 or newer](https://visualstudio.microsoft.com/fr/vs/community/) (VS2019 community is currently used), with development tools for C++/Desktop application, including windows 10 SDK | ||
(you might need to check if you have those option installed under the menu "Tools/Get tools and functionnalities") | ||
To build the adapter's DLLs, we recommend installing [Visual Studio Community](https://visualstudio.microsoft.com/fr/vs/community/), with the following tools and functionalities also installed: | ||
- Development tools for C++/Desktop applications, | ||
- Windows 10 SDK. | ||
The project DLLs are currently built using Visual Studio Community 2022, version 17.3.3. | ||
If you already have Visual Studio Community or Enterprise edition installed, please check that those functionalities are already part of your installation, by going under the `Tools/Get tools and functionalities` section of the application menu. | ||
|
||
Or if you don't want to use visual studio (untested) and want to build from the command line, you will need: | ||
If you don't want to use visual studio and want to build from the command line, you will need: | ||
- the [MSBuild toolset](https://visualstudio.microsoft.com/fr/downloads/?q=build+tools) | ||
- When requested, select the "desktop development with C++" workload | ||
- the [Windows 10 SDK (tested with 10.0.19041)](https://go.microsoft.com/fwlink/?linkid=2120843) | ||
More informations are provided by Microsoft in [their documentation](https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170) for buliding such project from the command line. | ||
More information are provided by Microsoft in [their documentation](https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170) to build projects and solutions from the command line. | ||
|
||
The following environment variable also need to be set for the code to build | ||
The following environment variables also need to be set for the code to build | ||
- JAVA_HOME needs to point to a [java 11 JDK](https://adoptium.net/?variant=openjdk11&jvmVariant=hotspot) | ||
- If you installed MSBuild, add its Bin folder to your PATH environment variable | ||
|
||
### With visual studio | ||
### With Visual Studio Community | ||
|
||
Using visual studio 2019, the projects and solution should be ready for build. | ||
In Visual Studio, first select the "Release" configuration and then build the DLLs for x86 and x64 platform: | ||
Using Visual Studio Community, the solution should be ready for build. | ||
In Visual Studio, select the "Release" configuration and then build the DLLs for "x86" and "x64" platforms by respectively: | ||
- Select the "x86" platform and launch the build with the menu action "Build/Build the solution" | ||
- Select the "x64" platform and launch the build with the menu action "Build/Build the solution" | ||
|
||
If the build was successful, this should have updated the DLLs under `src/main/resources/(x86|x64)/sapinative.dll` | ||
If the build was successful, the DLLs under `src/main/resources/(x86|x64)/` will be updated. | ||
|
||
Alternatively, you can also open the developer command line with the menu "Tools/Command line/Developer command line" and launch the following commands: | ||
Alternatively, you can also open the developer command line with the menu `Tools/Command line/Developer command line` and launch the following commands: | ||
``` | ||
msbuild sapinative.sln -p:Configuration=Release -p:Platform="x86" | ||
msbuild sapinative.sln -p:Configuration=Release -p:Platform="x64" | ||
``` | ||
|
||
### With MSBuild (with or without visual studio) | ||
### With MSBuild (with or without Visual Studio) | ||
|
||
Build with MSBuild separate installation has not yet be tested, so your mileage may vary. | ||
|
||
From a command line interpreter positionned at the root of the repository, you should be able to launch the following commands to update the dlls (with MSBuild accessible from your PATH): | ||
Build with MSBuild separate installation has not yet been fully tested, so your mileage may vary. | ||
|
||
With the `msbuild.exe` parent directory registered in your PATH environment variable, open a command line interpreter and position it at the root of the repository. | ||
Then launch the following commands to update the DLLs: | ||
``` | ||
msbuild.exe sapinative.sln -p:Configuration=Release -p:Platform="x86" | ||
msbuild.exe sapinative.sln -p:Configuration=Release -p:Platform="x64" | ||
``` | ||
|
||
### Activating the dll unit tests | ||
### Activating the DLL unit tests | ||
|
||
By default, the dll unit tests are deactivated to allow the build to proceed of non-windows build servers. | ||
By default, the DLL unit tests are deactivated to allow the build to proceed on non-windows build servers. | ||
If you want to reactivate the tests, open the test/java/ignore file and uncomment the first line | ||
|
||
## Possible issues or warnings | ||
|
||
### Exception raised after unit tests are passed | ||
|
||
On some occasion when building the maven project with SAPINative tests activated, you might encountered an jni exception that does block the unit tests. | ||
The circumstances that make the unit tests raising this exception when unloading the DLL has not yet been identified, the exception not being raised consistently in builds attempts. | ||
From our best knowledge, this issue has not yet impacted any production scenario as it might occure when the pipeline is exiting and disposing the sapinative bridge library. | ||
On some occasions when building the maven project with SAPINative tests activated, you might encounter a jni exception that blocks the unit tests. | ||
The circumstances that make the unit tests raise this exception when unloading the DLLs have not yet been identified, as the exception is not raised consistently in build attempts. | ||
To our best knowledge, this issue has not yet impacted any production scenario as it might occur when the pipeline is exiting and disposing of the "Sapinative" bridge library. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...adapters/tts-adapter-sapinative/src/main/java/org/daisy/pipeline/tts/onecore/Onecore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.daisy.pipeline.tts.onecore; | ||
|
||
public class Onecore { | ||
|
||
public static native long openConnection(); | ||
|
||
public static native int closeConnection(long connection); | ||
|
||
public static native int speak(long connection, String voiceVendor, String voiceName, String text); | ||
/* in bytes*/ | ||
public static native int getStreamSize(long connection); | ||
|
||
/* returns the new offset */ | ||
public static native int readStream(long connection, byte[] dest, int offset); | ||
|
||
public static native String[] getVoiceVendors(); | ||
|
||
public static native String[] getVoiceNames(); | ||
|
||
public static native String[] getVoiceLocales(); | ||
|
||
public static native String[] getVoiceGenders(); | ||
|
||
public static native String[] getVoiceAges(); | ||
|
||
public static native String[] getBookmarkNames(long connection); | ||
|
||
/* in milliseconds */ | ||
public static native long[] getBookmarkPositions(long connection); | ||
|
||
public static native int initialize(); | ||
|
||
public static native int dispose(); | ||
|
||
} |
Oops, something went wrong.