コード例 #1
0
 public BluetoothVisualizerControllerJni(
     ActivityHost activity, boolean startTransmissionOnConnection) {
   waveform = new byte[Visualizer.CAPTURE_SIZE];
   lock = new SlimLock();
   state = new AtomicInteger();
   this.startTransmissionOnConnection = startTransmissionOnConnection;
   lastPlayerCommandTime = (int) SystemClock.uptimeMillis();
   ignoreInput = 0;
   Player.bluetoothVisualizerLastErrorMessage = 0;
   Player.bluetoothVisualizerState = Player.BLUETOOTH_VISUALIZER_STATE_CONNECTING;
   bt = new BluetoothConnectionManager(this);
   final int err = bt.showDialogAndScan(activity);
   if (err != BluetoothConnectionManager.OK) onBluetoothError(bt, err);
   else BackgroundActivityMonitor.start(activity);
 }
コード例 #2
0
 public void destroy() {
   if (waveform != null) {
     version++;
     connected = false;
     transmitting = false;
     Player.bluetoothVisualizerState = Player.BLUETOOTH_VISUALIZER_STATE_INITIAL;
     lock.lockHighPriority();
     try {
       waveform = null;
       if (bt != null) {
         bt.destroy();
         bt = null;
       }
     } finally {
       lock.releaseHighPriority();
     }
     if (fxVisualizer != null) {
       fxVisualizer.destroy();
       fxVisualizer = null;
     }
     Player.stopBluetoothVisualizer();
     BackgroundActivityMonitor.bluetoothEnded();
   }
 }