4

In Android, you create a TextToSpeech instance like this:

tts = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
            @Override
            public void onInit(int i) {
                if (i == TextToSpeech.SUCCESS) {
                begin();
                }
                else {
                    Log.i(TAG, "init failed");
                }
            }
        }, "com.google.android.tts");

Notice that the desired speech engine is specified as the last argument.

There are multiple possible speech engines that can exist on a device (Samsung, PICO, Google, and more).

Question: How can we know whether or not this this TextToSpeech instance was successful in assigning the specified Engine to itself?

I don't see any way of doing this in the documentation:

onInit() only carries SUCCESS or FAIL, and there seems to be no method to query the (private) "myEngine" variable of the TextToSpeech instance.

Jonas
  • 121,568
  • 97
  • 310
  • 388
Nerdy Bunz
  • 6,040
  • 10
  • 41
  • 100

0 Answers0