Ejemplo n.º 1
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;
      }
    }
  }
Ejemplo n.º 2
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);
  }