Page 1 of 1

Pause playback when fader is at 0

Posted: Tue Apr 11, 2017 05:04
by Arvol
Is there a way to pause a clip in a layer when said layer is set to 0?

My current work around is mapping a hotkey on my QWERTY keyboard to set the play head to 0 and I press that key when I bring my midi fader up.

There's a lot of clip loading going on and I'd love for the clips to start from the beginning when I pull of the opacity fader of that clip.

I did some digging in between sets but I wasn't able to find a setting. Maybe I was looking In the wrong places?

Thanks guys.

Re: Pause playback when fader is at 0

Posted: Tue Apr 11, 2017 05:38
by Zoltán
you mean something like fader start?

this could be done with a little programming and osc
you'd need to listen for the clips playing in layers, then when their layer opacity is moving from 0 set the playhead to 0.

maybe it would be possible with double mapping of the control signal you use to move the opacity to the playhead, or maybe to a cue point.

Re: Pause playback when fader is at 0

Posted: Tue Apr 11, 2017 23:55
by Arvol
I was kind of hoping there was a quick select option for this.

Could this request be added to the already long line of requests? Preferably a check box in the layer autopilot area?

I thought about doing your method of a work around when I initial did mine. I typically only use midi as I haven't had the time to dig into osc. My concern was anytime moved my intensity fader it would trigger the clip from the beginning.

Thanks for brainstorming with me.

Fader Starter

Posted: Wed Apr 12, 2017 20:53
by Zoltán
Just for the fun of it ....

Code: Select all

/*
  this is a simple fader starter processing sketch by Zoltán Pálffy
 for use with Resolume 4 and 5, 
 if you use this code to earn money, donate at http://programs.palffyzoltan.hu
 distribute only with this header please.
 you'll need the processing framework - https://processing.org
 and Andreas Schlegel's oscP5, and NetP5 library  - http://www.sojamo.de/libraries/oscP5/
 
 this sketch will listen for clip launches in resolume, and layer opacity slider movement
 if you move the layer opacity from 0 it will relauch the clip that is playing in the layer.
 fader start.
 */
import netP5.*;
import oscP5.*;

int [] layerClip = new int [] {0, 0, 0, 0};
int [] layerMute = new int [] {0, 0, 0, 0};
OscP5 oscP5;
NetAddress myRemoteLocation;


void setup() {

  size(400, 400);
  frame.setTitle("FaderStarter for Resolume");
  frameRate(25);
  // start oscP5, listening for incoming messages at port 7001 set resolume OSC output to this port
  oscP5 = new OscP5(this, 7001);

  // set resolume OSC input to this port  : 7000
  // ip is localhost
  myRemoteLocation = new NetAddress("127.0.0.1", 7000);
}


void draw() {
  background(0);
  try {
    fill(200, 200, 250);
    text("fader starter for Resolume - http://programs.palffyzoltan.hu", 10, 20);
    for (int i=1; i< layerMute.length; i++) {
      fill(200, 200, 50);
      String addition = "";
      if (layerMute[i] == 1) {
        addition = " waiting for fader start";
        fill(200, 100, 100);
      }
      if (layerClip[i] == 0) 
      { 
        fill(100);  
        text( "no clip playing in layer "+i, 10, i*20+20);
      } else {
        text("active clip in layer "+i+" : "+layerClip[i] + addition, 10, i*20+20);
      }
    }
  }
  catch(Exception e) {
  }
}

int [] growIntArray (int [] in, int to) {
  int [] ret = new int[to];
  for (int i=0; i < ret.length; i++) {
    if (i < in.length) ret[i] = in[i];  //copy existing
    else ret[i] = 0;  // fill others with 0
  }
  return ret;
}

void checkAndGrow(int layerNumber) {
  if (layerNumber > layerMute.length) {  // array too small to store this many layers
    println(layerMute.length, "array needs to grow to ", layerNumber );
    layerMute = growIntArray(layerMute, layerNumber + 1);
    layerClip = growIntArray(layerClip, layerNumber + 1);
  }
}

void oscEvent(OscMessage message) {
  try {
    String msg = message.addrPattern();
    //look for layer opacity messages 
    if (match(msg, "/layer.*/video/opacity/values") != null) {
      int layerNumber = Integer.parseInt(msg.replaceAll("/layer(\\d+)/video/opacity/values", "$1"));
      checkAndGrow(layerNumber);
      if (message.get(0).floatValue() == 0f) {
        layerMute[layerNumber] = 1;  // if layer opacity is set to 0 store that info
      } else 
      if (layerMute[layerNumber] == 1) {
        //relaunch clip 
        layerMute[layerNumber] = 0;
        sendRelaunchToClip(layerNumber);
      }
    }
    //look for clip launch messages 
    if (match(msg, "/layer.*/clip.*/connect") != null) {
      int layerNumber = Integer.parseInt(msg.replaceAll("/layer(\\d+)/clip(\\d+)/connect", "$1"));
      int clipNumber = Integer.parseInt(msg.replaceAll("/layer(\\d+)/clip(\\d+)/connect", "$2"));
      int action = message.get(0).intValue();
      checkAndGrow(layerNumber);
      if (action == 1) { 
        layerClip[layerNumber] = clipNumber;
      } else { 
        if (layerClip[layerNumber] == clipNumber) layerClip[layerNumber] = 0;
      }
    }
  }
  catch(Exception e) {
    e.printStackTrace();
  }
}

void sendRelaunchToClip(int layer) {
  if (layerClip[layer] != 0 ) {
    OscMessage myMessage = new OscMessage("/layer"+layer+"/clip"+layerClip[layer]+"/connect");
    myMessage.add(1);
    oscP5.send(myMessage, myRemoteLocation);
  }
}
and for the lazy ones: you can get the binaries on my website

Re: Pause playback when fader is at 0

Posted: Thu Apr 13, 2017 02:11
by Arvol
Thanks buddy! I'll give it a shot in a week or so when things slow down a bit :)

Re: Pause playback when fader is at 0

Posted: Thu Jun 22, 2017 21:28
by DayVeeJay
You could do this with Visution's IR OSC SA as well

Re: Pause playback when fader is at 0

Posted: Fri Jun 23, 2017 06:24
by drazkers
Easy to do with a button, hard with a fader.