Support Android TTS#7497
Open
Shivansps wants to merge 8 commits into
Open
Conversation
notimaginative
requested changes
Jun 4, 2026
notimaginative
approved these changes
Jun 6, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is another part of the work split from the Android PR. Since this is non critical and does not depend on any changes to the build process or SDL version, it can be reviewed and merged at any time.
Testing was done on the android builds.
How this works:
To launch a SDL app in Android you need to make you own activity class that extend the SDL java class, were you set all the paramenters needed.
You can add anything more to this class to do whatever you want, and from the C++ side it is possible to use SDL + JNI (included in the NDK) to call static methods on the java side.
So for the TTS to work the java side handles all calls to the TTS service, then brings an "api" that can be used from C++. The java side looks something like this for the GameActivity that starts the game and the TTS itselft is handled on a separated class.
More details on how that works on the java side can be look at here:
https://github.com/Shivansps/Fso_Android_Wrapper/tree/main/app/src/main/java/com/shivansps/fsowrapper
(GameActivity.java and /tts/TTSManager.java)
If the GameActivity class is somehow missing some or all methods, the init will fail and it will be printed in the log the expected method name and signature, so there is no need to look at external code to make your own version if desired.
Note: the pointer "JNIEnv*" is handled by SDL and must not be freed. Thats not a memory leak.