コード例 #1
0
ファイル: Sound.java プロジェクト: nidok/Anki-Android
 /** Stops the playing sounds. */
 public static void stopSounds() {
   if (sMediaPlayer != null) {
     sMediaPlayer.stop();
     releaseSound();
   }
   ReadText.stopTts();
 }
コード例 #2
0
ファイル: ReadText.java プロジェクト: algakzru/Anki-Android
 public static void speak(String text, String loc) {
   int result = mTts.setLanguage(new Locale(loc));
   if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
     Toast.makeText(
             mReviewer.get(),
             mReviewer.get().getString(R.string.no_tts_available_message) + " (" + loc + ")",
             Toast.LENGTH_LONG)
         .show();
     Timber.e("Error loading locale " + loc);
   } else {
     if (mTts.isSpeaking()) {
       Timber.d("tts engine appears to be busy... clearing queue");
       stopTts();
       // sTextQueue.add(new String[] { text, loc });
     }
     Timber.d("tts text '%s' to be played for locale (%s)", text, loc);
     mTts.speak(mTextToSpeak, TextToSpeech.QUEUE_FLUSH, mTtsParams);
   }
 }