1
0
mirror of https://github.com/ndarilek/tts-rs.git synced 2024-11-25 03:19:36 +00:00
Go to file
Michael Connor Buchan f39f86aa13 FFI: Pass pointer to uninit Features struct in tts_supported_features()
This is done because the ABI for returning struct values isn't well
defined.
2022-07-23 13:41:39 +01:00
.github/workflows Branch not needed. 2022-03-10 14:35:46 -06:00
examples Constrain version so example builds. 2022-06-14 13:57:53 -05:00
src FFI: Pass pointer to uninit Features struct in tts_supported_features() 2022-07-23 13:41:39 +01:00
.gitignore Ignore DLL files. 2021-03-11 13:41:26 -06:00
build.rs Merge remote-tracking branch 'upstream/master' into c-ffi 2022-07-22 21:42:59 +01:00
Cargo.toml Merge remote-tracking branch 'upstream/master' into c-ffi 2022-07-22 21:42:59 +01:00
cbindgen.toml FFI: Add #ifdef for Android and don't generate declarations for Java 2020-12-31 15:15:22 +00:00
Makefile.toml Merge branch 'master' into c-ffi 2021-09-28 09:33:58 +01:00
README.md Bump version, and use automatically-provided feature provided by optional tolk dependency. 2021-01-21 10:49:11 -06:00

TTS-RS

This library provides a high-level Text-To-Speech (TTS) interface supporting various backends. Currently supported backends are:

  • Windows
    • Screen readers/SAPI via Tolk (requires tolk Cargo feature)
    • WinRT
  • Linux via Speech Dispatcher
  • MacOS/iOS
    • AppKit on MacOS 10.13 and below
    • AVFoundation on MacOS 10.14 and above, and iOS
  • Android
  • WebAssembly

Android Setup

On most platforms, this library is plug-and-play. Because of JNI's complexity, Android setup is a bit more involved. In general, look to the Android example for guidance. Here are some rough steps to get going:

  • Set up Cargo.toml as the example does. Be sure to depend on ndk-glue.
  • Place Bridge.java appropriately in your app. This is needed to support various Android TTS callbacks.
  • Create a main activity similar to MainActivity.kt. In particular, you need to derive android.app.NativeActivity, and you need a System.loadLibrary(...) call appropriate for your app. System.loadLibrary(...) is needed to trigger JNI_OnLoad.
    • Even though you've loaded the library in your main activity, add a metadata tag to your activity in AndroidManifest.xml referencing it. Yes, this is redundant but necessary.
  • Set if your various build.gradle scripts to reference the plugins, dependencies, etc. from the example. In particular, you'll want to set up cargo-ndk-android-gradle and either depend on androidx.annotation or otherwise configure your app to keep the class rs.tts.Bridge.

And I think that should about do it. Good luck!