コード例 #1
0
  /**
   * Send a track list event to Ardour
   *
   * @param track
   * @param position
   */
  public void trackListVolumeAction(org.ardour.Track track, int position) {

    String uri = "/ardour/routes/gainabs";

    Object[] args = new Object[2];
    args[0] = Integer.valueOf(track.remoteId);

    track.trackVolume = (int) track.sliderToValue(position);
    args[1] = Double.valueOf(track.sliderToValue(position) / 1000.0);

    sendOSCMessage(uri, args);
  }
コード例 #2
0
  /** A handler for track state changes coming from Ardour */
  private void handleChange(OSCMessage message, int whatChanged) {

    // Log.d(TAG, "Received Change: " + message.toString());

    if (state != OscService.READY) {

      Log.d(TAG, "In non Ready state. Returning.");
      return;
    }

    // Route remote Id
    Integer i = (Integer) message.getArg(0);
    Float f = null;

    for (org.ardour.Track track : routes) {

      if (track.remoteId == i.intValue()) {

        switch (whatChanged) {
          case REC_CHANGED:
            f = (Float) message.getArg(1);
            track.recEnabled = (f.floatValue() == 1);
            break;
          case SOLO_CHANGED:
            f = (Float) message.getArg(1);
            track.soloEnabled = (f.floatValue() == 1);
            break;
          case MUTE_CHANGED:
            f = (Float) message.getArg(1);
            track.muteEnabled = (f.floatValue() == 1);
            break;
          case NAME_CHANGED:
            track.name = (String) message.getArg(1);
            break;
          case GAIN_CHANGED:
            double gainval = (float) message.getArg(1) * 1000.0;
            if (gainval <= 0.0000000001) gainval = 0.0000000001;
            track.trackVolume = track.valueToSlider(gainval);
            System.out.println(
                "Gain as Int: " + track.valueToSlider(gainval) + ", fromArdour: " + gainval);
            if (track.getTrackVolumeOnSeekBar())
              return; // gein change from user on seekbar we return here

            break;
        }

        // send message to view
        Message msg = transportHandler.obtainMessage(2000, routes);
        transportHandler.sendMessage(msg);

        return;
      }
    }
  }
コード例 #3
0
  /**
   * Update the tracklist as received from Ardour
   *
   * @param message
   */
  private void updateTrackList(OSCMessage message) {

    Log.d("A", message.toString());

    /*
    for(int i = 0;i < message.getArgCount(); i++){
    	System.out.println("Message at " + i + " : " + message.getArg(i));
    }

    */
    // First arg
    String s = (String) message.getArg(0);

    if (s.equals("end_route_list")) {

      Long frameRate = (Long) message.getArg(1);

      Message msg = transportHandler.obtainMessage(500, frameRate);
      transportHandler.sendMessage(msg);

      Long maxFrame = (Long) message.getArg(2);

      Message msg1 = transportHandler.obtainMessage(400, maxFrame);
      transportHandler.sendMessage(msg1);

      Message msg2 = transportHandler.obtainMessage(1000, routes);
      transportHandler.sendMessage(msg2);

      state = OscService.READY;
    } else {

      org.ardour.Track t = new org.ardour.Track();

      // System.out.println("Track contains: " + s);

      if (s.equals("AT")) {
        t.type = org.ardour.Track.AUDIO;
      } else if (s.equals("MT")) {
        t.type = org.ardour.Track.MIDI;
      } else if (s.equals("B")) {
        t.type = org.ardour.Track.BUS;
      }

      // Set the name of the track
      s = (String) message.getArg(1);
      t.name = s;

      // Set mute state
      Integer i = (Integer) message.getArg(4);
      t.muteEnabled = (i.intValue() > 0);

      // Set solo state
      i = (Integer) message.getArg(5);
      t.soloEnabled = (i.intValue() > 0);

      // Set remote id
      i = (Integer) message.getArg(6);
      t.remoteId = i.intValue();

      // Set record state
      if (t.type == org.ardour.Track.AUDIO || t.type == org.ardour.Track.MIDI) {
        i = (Integer) message.getArg(7);
        t.recEnabled = (i.intValue() > 0);
      }

      routes.add(t);
    }
  }