arnpet
Lurker
I have some problems with programming in java. I am trying to make class that can produce sounds from words and save it in files. I know that I have to use the method synthesizeToFile and the engine tts.
What I am trying to do is implementing this
public int synthesizeToFile (String text, HashMap params, String filename)
in the method of public void speakWords.
I do not know what the things in
(String text, HashMap params, String filename) stands for.
Sorry for not asking a straightforward question. Any help is appreciated.
//My class declaration implements interfaces for to get the function of the activity shallpublicclass addGlossary extendsActivityimplementsOnClickListener,OnInitListener{
MY_DATA_CHECK_CODE =0;
privateTextToSpeech myTTS;
@Overrideprotectedvoid onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_glossary);
Button speakButton =(Button)findViewById(R.id.speak);
speakButton.setOnClickListener(this);
Intent checkTTSIntent =newIntent();
checkTTSIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
startActivityForResult(checkTTSIntent, MY_DATA_CHECK_CODE);
TextToSpeechpublicvoid onInit(int initStatus)
{if(myTTS.isLanguageAvailable(Locale.US)==TextToSpeech.LANG_AVAILABLE){
myTTS.setLanguage(Locale.US);}elseif(initStatus ==TextToSpeech.ERROR)
{Toast.makeText(this,"Sorry! Text To Speech failed...",Toast.LENGTH_LONG).show();}}}
What I am trying to do is implementing this
public int synthesizeToFile (String text, HashMap params, String filename)
in the method of public void speakWords.
I do not know what the things in
(String text, HashMap params, String filename) stands for.
Sorry for not asking a straightforward question. Any help is appreciated.
//My class declaration implements interfaces for to get the function of the activity shallpublicclass addGlossary extendsActivityimplementsOnClickListener,OnInitListener{
MY_DATA_CHECK_CODE =0;
privateTextToSpeech myTTS;
@Overrideprotectedvoid onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_glossary);
Button speakButton =(Button)findViewById(R.id.speak);
speakButton.setOnClickListener(this);
Intent checkTTSIntent =newIntent();
checkTTSIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
startActivityForResult(checkTTSIntent, MY_DATA_CHECK_CODE);
TextToSpeechpublicvoid onInit(int initStatus)
{if(myTTS.isLanguageAvailable(Locale.US)==TextToSpeech.LANG_AVAILABLE){
myTTS.setLanguage(Locale.US);}elseif(initStatus ==TextToSpeech.ERROR)
{Toast.makeText(this,"Sorry! Text To Speech failed...",Toast.LENGTH_LONG).show();}}}