I made an Italian Sicilian translator to translator, there are many wave files with phrases in Sicilian, for each selected match the phrase translation and audio files, I hope that when I press the button and tell me by saying the phrase in Italian, the translator I find the sentence and it makes me listen to the translation in Sicilian. the code I posted was an example of my program, I wanted to make sure that we shorten the code.
I am interested in this code
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("traduttore")
p.SetScreenOrientation(1)
VR.Initialize ("VR")
tts1.Initialize("tts1")
sp1.Add("abbeverare")
sp1.Add("accendere")
sp1.Add("addormentato")
sp1.Add("annegare")
sp1.Add("albero")
ens sub
Sub sp1_ItemClick (Position As Int, Value As Object)
If sp1.SelectedItem = "abbeverare" Then
lbl1.Text = "abbivirari"
MP.Initialize
MP.Load(File.DirAssets,"abbeverare.wav")
MP.Play
End If
If sp1.SelectedItem = "accendere" Then
lbl1.Text = "addumari"
MP.Initialize
MP.Load(File.DirAssets,"accendere.wav")
MP.Play
End If
If sp1.SelectedItem = "addormentato" Then
lbl1.Text = "addummisciutu"
MP.Initialize
MP.Load(File.DirAssets,"addormentato.wav")
MP.Play
End If
If sp1.SelectedItem = "albero" Then
lbl1.Text = "arvulu"
MP.Initialize
MP.Load(File.DirAssets,"albero.wav")
MP.Play
End If
end sub
Sub btnDimmi_Click
VR.Listen
End Sub
Sub VR_Result (Success As Boolean, Texts As List)
If Success = True Then
lbl2.Text = Texts.Get(0)
End If
If lbl2.Text = "abbeverare" Then
lbl1.Text = "abbivirari"
MP.Initialize
MP.Load(File.DirAssets,"abbeverare.wav")
MP.Play
If lbl2.Text = "accendere" Then
lbl1.Text = "addumari"
MP.Initialize
MP.Load(File.DirAssets,"accendere.wav")
MP.Play
If lbl2.Text = "addormentato" Then
lbl1.Text = "addummisciutu"
MP.Initialize
MP.Load(File.DirAssets,"addormentato.wav")
MP.Play
If lbl2.Text = "albero" Then
lbl1.Text = "arvulu"
MP.Initialize
MP.Load(File.DirAssets,"albero.wav")
MP.Play
If lbl2.Text = "addormentato" Then
lbl1.Text = "addummisciutu"
MP.Initialize
MP.Load(File.DirAssets,"addormentato.wav")
MP.Play
Else
Msgbox ("SPIACENTE, FRASE NON TROVATA SUL DATABASE","FRASE NON PRESENTE")
End If
End Sub
I am interested in this code
B4X:
Sub VR_Result (Success As Boolean, Texts As List)
If Success = True Then
lbl2.Text = Texts.Get(0)
End If
If lbl2.Text = "addormentato" Then
lbl1.Text = "addummisciutu"
MP.Initialize
MP.Load(File.DirAssets,"addormentato.wav")
MP.Play
Else
Msgbox ("SPIACENTE, FRASE NON TROVATA SUL DATABASE","FRASE NON PRESENTE")
End If
End Sub
I would like to do in order to play the audio file of selected item on sp1