Android Question TTS LIBRARY ERROR DURING INITIALIZATION

MaxFus

Member
I’m trying to use TTS library

I always have an error during TTS initialization

This is the routine that traps the error

After the following code :

language=1

TTS1.Initialize("TTS1")



Private Sub TTS1_Ready (Success As Boolean)
If Success Then
TTS1.SpeechRate = 0.8
TTS1.Pitch = 0.7
Select Case language
Case 1
TTS1.SetLanguage("it","IT")
Case 2
TTS1.SetLanguage("fr","FR")
Case 3
TTS1.SetLanguage("en","EN")
Case 4
TTS1.SetLanguage("es","ES")

End Select

Else
Msgbox("Error initializing TTS engine.", "")
End If
End Sub




This is may manifest file

'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
''' PERMISSIONS : https://developer.android.com/reference/android/Manifest.permission
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
SetApplicationAttribute(android:usesCleartextTraffic, "true")
SetActivityAttribute (Main, android:screenOrientation, "portrait")
SetActivityAttribute (Page2, android:screenOrientation, "portrait")
SetActivityAttribute(Selezione_Tempo,android:theme,@android:style/Theme.Dialog)
'End of default text.




Any IDEA about the fault ?
Regards
 

MaxFus

Member
1. Please use [code]code here...[/code] tags when posting code.
2. Please post the error message.
I will try to be as precise as possible as per your request
I ’m trying to use TTS library

I always have an error during TTS initialization

This is the routine that traps the error

After the following code :

B4X:
language=1

TTS1.Initialize("TTS1")


after this the following subroutine is called
as told in the documentation
The Ready event will be raised when the text to speech engine is ready.
EventName - The Sub that will handle the Ready event.

B4X:
Private Sub TTS1_Ready (Success As Boolean)
If Success Then
TTS1.SpeechRate = 0.8
TTS1.Pitch = 0.7
Select Case language
Case 1
TTS1.SetLanguage("it","IT")
Case 2
TTS1.SetLanguage("fr","FR")
Case 3
TTS1.SetLanguage("en","EN")
Case 4
TTS1.SetLanguage("es","ES")

End Select

Else
Msgbox("Error initializing TTS engine.", "") '''' ====>  the code goes through here
End If
End Sub





This is may manifest file
B4X:
[/TD]
[/TR]
[/TABLE]
[TABLE]
[TR]
[TD]'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: [URL]https://www.b4x.com/forum/showthread.php?p=78136[/URL]
''' PERMISSIONS : [URL]https://developer.android.com/reference/android/Manifest.permission[/URL]
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
SetApplicationAttribute(android:usesCleartextTraffic, "true")
SetActivityAttribute (Main, android:screenOrientation, "portrait")
SetActivityAttribute (Page2, android:screenOrientation, "portrait")
SetActivityAttribute(Selezione_Tempo,android:theme,@android:style/Theme.Dialog)
'End of default text.
[TABLE]
[TR]
[TD]/[code][/TD]
[/TR]
[/TABLE]





Any IDEA about the fault ?
THERE is no specific message that beacuse the answer of TTS Initialize is boolean (go/nogo)
What I can see is that during debug the code goes through here:
[B]Msgbox("Error initializing TTS engine.", "")[/B]
Regards[/TD]
[/TR]
[/TABLE]
 
Upvote 0

MaxFus

Member
I don't understand anything from this post.
I admit that when I see code with Msgbox I can't really read the other parts of the code.

You also didn't post the error message.
my dear Erel,
I'm sorry for your brusque behavior towards me
Not what I expected
1) About Msgbox I know it's deprecate but I didn't expect this to become a block for our communication
2) the TTTS.initialize routine does not give any error code and therefore I cannot communicate something that I do not know
3) however I solved the problem. In fact, the problem exists only in debugging on the PC but on the phone ALL OK
 
Upvote 0
Top