2013-02-02 29 views
0

我對android的tts服務的實現有疑問。 這裏的交易:tts android中的服務說明

-I've看着弗萊特代碼,我看到服務要求有這些3個活動:

<activity 
     android:name=".DownloadVoiceData" 
     android:label="@string/flite_voice_manager" 
     android:theme="@android:style/Theme.Holo" 
     android:configChanges="orientation"> 
     <intent-filter> 
      <action android:name="android.speech.tts.engine.INSTALL_TTS_DATA" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name=".CheckVoiceData" 
     android:label="@string/app_name" 
     android:theme="@android:style/Theme.Translucent.NoTitleBar" > 
     <intent-filter> 
      <action android:name="android.speech.tts.engine.CHECK_TTS_DATA" /> 

      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name=".GetSampleText" 
     android:label="@string/app_name" 
     android:theme="@android:style/Theme.Translucent.NoTitleBar" > 
     <intent-filter> 
      <action android:name="android.speech.tts.engine.GET_SAMPLE_TEXT" /> 

      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
    </activity> 

這些活動的實際行動是自我解釋的,但我想要知道: 他們是強制性的,他們是如何工作的....我有谷歌它,但沒有運氣。

  1. 有人可以指出一些文件,這些活動的解釋?

  2. 此外,是否有任何文件的tts服務流程詳細解釋?

Thanx提前。

+0

你想達到什麼目的,在正常情況下,你不必擔心這些類/活動,因爲它們被tts引擎自動調用? –

+0

我想知道更多關於他們的信息。我應該提供什麼數據,每個活動在xml中有哪些組件?我需要他們嗎?如果我想上傳到設備的音頻文件通過USB等... – someone

+0

對不起,我以前的答案,我是在談論ASR,無論如何這裏是Android的文檔的鏈接http://developer.android.com/reference /android/speech/tts/package-summary.html 也可以使用pico tts引擎以防萬一你想知道引擎本身。 對不起 –

回答

0

CheckVoiceData是必要的,因爲它可以由願意知道引擎是否能夠工作的客戶端調用。 我想你至少可以在沒有其他兩年的情況下生活一段時間。

<activity android:name=".CheckVoiceData" 
      android:theme="@android:style/Theme.NoDisplay"> 
     <intent-filter> 
      <action android:name="android.speech.tts.engine.CHECK_TTS_DATA" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
    </activity> 

CheckVoiceData.onCreate()你會做這樣的事情:

ArrayList<String> askedToCheck = intent.getStringArrayListExtra(TextToSpeech.Engine.EXTRA_CHECK_VOICE_DATA_FOR); 
    // if it is null, they usually check and report all available languages. 


    ArrayList<String> available = new ArrayList<String>(); 
    ArrayList<String> unavailable = new ArrayList<String>(); 

    //... 

    Intent returnData = new Intent(); 
    returnData.putStringArrayListExtra(
      TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES, available); 
    returnData.putStringArrayListExtra(
      TextToSpeech.Engine.EXTRA_UNAVAILABLE_VOICES, unavailable); 
    setResult(result, returnData); 
    finish(); 

有效的語言字符串的一個例子是"eng-USA"