Пример #1
0
  /**
   * Check if the OSC client is connected
   *
   * @return
   */
  public boolean isConnected() {

    if (oscClient != null) {
      return oscClient.isConnected();
    }

    return false;
  }
Пример #2
0
  /** Connect to the Ardour OSC server */
  public void connect() {

    try {

      Log.d(TAG, "Connetecting to Ardour");

      if (oscClient != null && oscClient.isConnected()) {
        disconnect();
      }

      oscClient = OSCClient.newUsing(OSCClient.UDP); // create UDP client with any free port number
      oscClient.setTarget(new InetSocketAddress(InetAddress.getByName(host), port));

      Log.d(TAG, "Starting connection...");

      oscClient
          .start(); // open channel and (in the case of TCP) connect, then start listening for
                    // replies

      Log.d(TAG, "Started. Starting listener");

      oscClient.addOSCListener(replyListener);

      Log.d(TAG, "Listening.");

      if (oscClient.isConnected()) {

        routes.clear();
        state = OscService.ROUTES_REQUESTED;

        System.out.println("OSC State: " + state);
        sendOSCMessage("/routes/list");
        // Object[] args = {1,2};
        // sendOSCMessage("/routes/gainabs", args);
      }

    } catch (UnknownHostException e) {
      Log.d(TAG, "Unknown host");
      e.printStackTrace();
    } catch (IOException e) {
      Log.d(TAG, "IO Exception");
      e.printStackTrace();
    }
  }