Pause playback when fader is at 0

Just let it all out, buddy. You're among friends here.
Post Reply
User avatar
Arvol
Might as well join the team
Posts: 2772
Joined: Thu Jun 18, 2015 17:36
Location: Oklahoma, USA

Pause playback when fader is at 0

Post 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.

Zoltán
Team Resolume
Posts: 7088
Joined: Thu Jan 09, 2014 13:08
Location: Székesfehérvár, Hungary

Re: Pause playback when fader is at 0

Post 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.
Software developer, Sound Engineer,
Control Your show with ”Enter” - multiple Resolume servers at once - SMPTE/MTC column launch
try for free: http://programs.palffyzoltan.hu

User avatar
Arvol
Might as well join the team
Posts: 2772
Joined: Thu Jun 18, 2015 17:36
Location: Oklahoma, USA

Re: Pause playback when fader is at 0

Post 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.

Zoltán
Team Resolume
Posts: 7088
Joined: Thu Jan 09, 2014 13:08
Location: Székesfehérvár, Hungary

Fader Starter

Post 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
Software developer, Sound Engineer,
Control Your show with ”Enter” - multiple Resolume servers at once - SMPTE/MTC column launch
try for free: http://programs.palffyzoltan.hu

User avatar
Arvol
Might as well join the team
Posts: 2772
Joined: Thu Jun 18, 2015 17:36
Location: Oklahoma, USA

Re: Pause playback when fader is at 0

Post by Arvol »

Thanks buddy! I'll give it a shot in a week or so when things slow down a bit :)

DayVeeJay
Is seriously in love with Resolume. Met the parents and everything
Posts: 388
Joined: Mon Nov 05, 2007 23:38
Location: Chicago, IL

Re: Pause playback when fader is at 0

Post by DayVeeJay »

You could do this with Visution's IR OSC SA as well

User avatar
drazkers
Wants to marry Resolume, and Resolume said "yes!"
Posts: 968
Joined: Wed May 18, 2011 10:54
Location: Brady V up in Canada

Re: Pause playback when fader is at 0

Post by drazkers »

Easy to do with a button, hard with a fader.

Post Reply