예제 #1
0
 @Override
 public void handleMessage(Message message) {
   switch (message.what) {
     case WHAT_SPEAK:
       String utterance = (String) message.obj;
       mTts.speak(utterance, QUEUING_MODE_INTERRUPT, null);
       return;
     case WHAT_STOP_SPEAK:
       mTts.stop();
       return;
     case WHAT_START_TTS:
       mTts =
           new TextToSpeech(
               mContext,
               new TextToSpeech.OnInitListener() {
                 @Override
                 public void onInit(int status) {
                   // register here since to add earcons the TTS must be initialized
                   // the receiver is called immediately with the current ringer mode
                   registerBroadCastReceiver();
                 }
               });
       return;
     case WHAT_SHUTDOWN_TTS:
       mTts.shutdown();
       return;
     case WHAT_PLAY_EARCON:
       int resourceId = message.arg1;
       playEarcon(resourceId);
       return;
     case WHAT_STOP_PLAY_EARCON:
       mTts.stop();
       return;
   }
 }
예제 #2
0
파일: Effect.java 프로젝트: linhua55/trime
 public void destory() {
   if (mTTS != null) {
     mTTS.stop();
     mTTS.shutdown();
     mTTS = null;
   }
 }
예제 #3
0
  public void destory() {
    if (speakWord != null) {
      speakWord.destory();
    }

    myTTS.shutdown();
  }
예제 #4
0
 public void onPause() {
   if (t1 != null) {
     t1.stop();
     t1.shutdown();
   }
   super.onPause();
 }
예제 #5
0
 @Override
 protected void onDestroy() {
   if (myTTS != null) {
     myTTS.shutdown();
   }
   super.onDestroy();
 }
  /*
   * Code to run ONCE after the driver hits STOP
   */
  @Override
  public void stop() {

    //  add function to clean up status of robot
    textToSpeech.stop();
    textToSpeech.shutdown();
  }
 @Override
 protected void onDestroy() {
   if (tts != null) {
     tts.stop();
     tts.shutdown();
   }
   super.onDestroy();
 }
 @Override
 public void shutdown() {
   if (tts == null) {
     super.shutdown();
     return;
   }
   tts.shutdown();
 }
  public void onDestroy() {
    if (textTalker != null) {
      textTalker.stop();
      textTalker.shutdown();
    }

    super.onDestroy();
  }
 @Override
 public void onDestroy() {
   if (tts != null) {
     tts.stop();
     tts.shutdown();
   }
   super.onDestroy();
 }
 @Override
 public void shutdown() {
   listenToPhoneState(phoneStateListener, PhoneStateListener.LISTEN_NONE);
   if (tts != null) {
     tts.shutdown();
     tts = null;
   }
 }
예제 #12
0
 @Override
 public void onDestroy() {
   if (textToSpeech != null) {
     textToSpeech.stop();
     textToSpeech.shutdown();
   }
   super.onDestroy();
 }
 /*
  * (non-Javadoc)
  * @see android.app.Activity#onDestroy()
  */
 @Override
 public void onDestroy() {
   super.onDestroy();
   if (speech != null) {
     speech.stop();
     speech.shutdown();
   }
 }
예제 #14
0
  @Override
  protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();
    Log.i(LOG_STRING, "detach event");

    mTTS.shutdown();
    // serializeMotionEvents();
    // serializeDemonstration();
  }
예제 #15
0
 @Override
 protected void onDestroy() {
   if (tts != null) {
     tts.stop();
     tts.shutdown();
   }
   unregisterReceiver(mReceiver);
   super.onDestroy();
 }
  @Override
  public void onDestroy() {
    // Don't forget to shutdown!
    if (mTts != null) {
      mTts.stop();
      mTts.shutdown();
    }

    super.onDestroy();
  }
	@Override
	public void onDestroy() {
		stopRingtone = true;
		ttsReady = false;
		if (myTts != null) 
			myTts.shutdown();
		myTts = null;
		if (myRingTonePlayer != null)
			myRingTonePlayer.release();
		myRingTonePlayer = null;
		mServiceLooper.quit();
	} 
예제 #18
0
 @Override // Fragment
 public void onPause() {
   boolean orientationChanged = isOrientationChanged();
   super.onPause();
   if (!orientationChanged && this.textToSpeech != null) {
     textToSpeech.stop();
     textToSpeech.shutdown();
     textToSpeech = null;
     if (BuildConfig.DEBUG)
       Log.d(engSpaActivity.getTag(), "EngSpaFragment.onPause(); textToSpeech closed");
   }
 }
예제 #19
0
 private synchronized void unregisterBroadcastCall() {
   Log.i(TAG, "unregisterBroadcastCall");
   if (broadcastCall != null) {
     unregisterReceiver(broadcastCall);
     broadcastCall = null;
   }
   tmgr.listen(phoneListener, PhoneStateListener.LISTEN_NONE);
   if (textToSpeech != null) {
     textToSpeech.shutdown();
     textToSpeech = null;
   }
   stopSpeechRecognizer();
 }
예제 #20
0
  @Override
  protected void onCommandDeactivated() {
    mLocale = null;
    if (mTts != null) {
      try {
        mTts.shutdown();
      } catch (Exception e) {
        // Don't care
      }

      mTts = null;
    }
    mTtsAvailable = false;
  }
예제 #21
0
 public void onDestroy() {
   super.onDestroy();
   All_In_One.ServiceState(false);
   mShakeDetector.setOnShakeListener(
       new OnShakeListener() {
         @Override
         public void onShake(int count) {
           // Disable
         }
       });
   if (mTts != null) {
     mTts.stop();
     mTts.shutdown();
   }
 }
예제 #22
0
  @Override
  public void onInit(int status) {
    if (status == TextToSpeech.SUCCESS) {
      // TODO: check if the language is available
      Locale ttsLanguage;
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        ttsLanguage = tts.getDefaultLanguage();
      } else {
        ttsLanguage = tts.getLanguage();
      }

      if (ttsLanguage == null) {
        ttsLanguage = Locale.US;
      }

      int supportStatus = tts.setLanguage(ttsLanguage);
      switch (supportStatus) {
        case TextToSpeech.LANG_MISSING_DATA:
        case TextToSpeech.LANG_NOT_SUPPORTED:
          tts.shutdown();
          tts = null;

          Log.e(TAG, "TTS Language data is not available.");
          Toast.makeText(context, "Unable to set 'Text to Speech' language!", Toast.LENGTH_LONG)
              .show();
          break;
      }

      if (tts != null) {
        tts.setOnUtteranceCompletedListener(mSpeechCompleteListener);
        // Register the broadcast receiver for the speech output period
        // updates
        LocalBroadcastManager.getInstance(context)
            .registerReceiver(
                mSpeechIntervalUpdateReceiver,
                new IntentFilter(SettingsFragment.ACTION_UPDATED_STATUS_PERIOD));
      }
    } else {
      // Notify the user that the tts engine is not available.
      Log.e(TAG, "TextToSpeech initialization failed.");
      Toast.makeText(
              context,
              "Please make sure 'Text to Speech' is enabled in the "
                  + "system accessibility settings.",
              Toast.LENGTH_LONG)
          .show();
    }
  }
  @Override
  protected void onPause() {
    super.onPause();
    if (textToSpeech != null) {
      textToSpeech.stop();
      textToSpeech.shutdown();
    }
    Utilities.setDirectionImage("STOP", ivDirection, bt);
    bt.stop();
    recognizer.cancel();
    // finish();

    if (speech != null) {
      speech.destroy();
    }
  }
  @Override
  protected void onPause() {

    directionThread.interrupt();
    super.onPause();
    if (textToSpeech != null) {
      textToSpeech.stop();
      textToSpeech.shutdown();
    }

    if (mGoogleApiClient.isConnected()) stopLocationUpdates();

    mSensorManager.unregisterListener(this);

    handler1.removeCallbacks(runnable);

    finish();
  }
예제 #25
0
  @Override
  public void onDestroy() {
    // Cancel the persistent notification.
    notificationManager.cancel(JANE_NOTIFICATION_CODE);

    // disconnect bluetooth proxy
    try {
      bt.releaseProxy();
    } catch (Exception e) {
      e.printStackTrace();
    }

    // close smack
    AsyncTask<Void, Void, Integer> smackShutdown =
        new AsyncTask<Void, Void, Integer>() {

          @Override
          protected Integer doInBackground(Void... params) {
            connection.disconnect();
            return 1;
          }
        };

    smackShutdown.execute();
    smack.onDestroy();

    // unregister JaneIntent receiver
    this.unregisterReceiver(stateIntents);

    // unregister tts
    tts.shutdown();

    // Tell the user we stopped.
    Toast.makeText(this, "Jane service stopped.", Toast.LENGTH_SHORT).show();
    super.onDestroy();
  }
예제 #26
0
 public void shutdown() {
   ttsInstance.shutdown();
 }
예제 #27
0
파일: Speech.java 프로젝트: qpliu/incant
 public void onStop() {
   textToSpeech.shutdown();
   synchronized (utteranceProgressListener) {
     onDone = null;
   }
 }
예제 #28
0
 @Test
 public void isShutdown_shouldReturnTrueAfterShutdown() throws Exception {
   textToSpeech.shutdown();
   assertThat(shadowOf(textToSpeech).isShutdown()).isTrue();
 }
예제 #29
0
 public void release() {
   txtS.shutdown();
 }
예제 #30
0
  private void doConnectionDisconnect() {
    // First disable all hosts to prevent old callbacks from being
    // processed.
    if (mProtocolHost != null) {
      mProtocolHost.disable();
      mProtocolHost = null;
    }

    if (mConnectionHost != null) {
      mConnectionHost.disable();
      mConnectionHost = null;
    }

    if (mAudioHost != null) {
      mAudioHost.disable();
      mAudioHost = null;
    }

    // Stop threads.
    if (mProtocol != null) {
      mProtocol.stop();
      mProtocol = null;
    }

    if (mClient != null && mClientThread != null) {
      new Thread(
              new Runnable() {
                @Override
                public void run() {
                  mClient.disconnect();
                }
              })
          .start();

      try {
        mClientThread.join();
      } catch (final InterruptedException e) {
        mClientThread.interrupt();
      }

      // Leave mClient reference intact as its state might still be
      // queried.
      mClientThread = null;
    }

    // Broadcast state, this is synchronous with observers.
    state = MumbleConnectionHost.STATE_DISCONNECTED;
    updateConnectionState();

    // Now observers shouldn't need these anymore.
    chatMessages.clear();
    unreadChatMessages.clear();
    users.clear();
    messages.clear();
    channels.clear();

    // Stop wakelock
    if (wakeLock.isHeld()) {
      wakeLock.release();
    }

    if (tts != null) {
      tts.stop();
      tts.shutdown();
    }

    stopSelf();
  }