예제 #1
0
  private void initSoundWave() {
    try {
      sscStudioApi = new SSCstudioApi(context);
      sscStudioApi.setReceiveEnable(true);
      sscStudioApi.setUsbDetachNotifyCallback(
          new UsbDetachListener() {

            @Override
            public void usbDetachNotify() {}
          });
      sscStudioApi.setDataReceiveCallback(
          new ReceiveListener() {

            @Override
            public void receiveData(byte[] data) {
              if (listener != null) {
                listener.onRecvData(data);
              }
            }
          });

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
예제 #2
0
 public void onDestroy() {
   try {
     if (null != soundWaveSendLooper) {
       soundWaveSendLooper.quit();
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   if (isSoundWaveLegal) {
     sscStudioApi.stop();
     sscStudioApi.destroyResource();
   }
 }
예제 #3
0
 public void onStart() {
   isSoundWaveLegal = sscStudioApi.start();
   if (isSoundWaveLegal) {
     HandlerThread soundWaveSendThread = new HandlerThread("soundWaveSendThread");
     soundWaveSendThread.start();
     soundWaveSendLooper = soundWaveSendThread.getLooper();
     soundWaveSendHandler = new Handler(soundWaveSendLooper);
     soundWaveSendHandler.post(new soundWaveSendRunnable());
   }
 }