Facility Control

 View Only
  • 1.  BlackMagic control panel dropdown

    Posted 09-15-2017 03:37
    We are hoping to use Dashboard to control playback of files from a Black Magic Hyperdeck.

    We have downloaded the Panel used in Dashboard U 304. For the most part it seems to be working. The playback buttons work fine, and the "refresh clips" button seems to grab all the filenames without an issue.

    But the cuing seems a bit off. It always seems to cue the file before the one you've chosen. For example, if I choose "C.mov" from the dropdown, it will actually cue "B.mov"
    If you try to cue the first item in the dropdown, then nothing happens at all, and nothing is cued.

    Any idea why?

    Thanks


  • 2.  RE: BlackMagic control panel dropdown

    Posted 09-15-2017 20:55

    It's possible that there is an off-by-one issue where you are getting back clips with ID starting at 1 instead of 0.
    The implementation of this panel is assuming the clip IDs are 0-based.

    Another approach would be to have the response builder include the ID returned by the Hyperdeck. I do not have a Hyperdeck handy but, if you replace the code in the listener task with this, you may get better results (added/changed code marked in bold/red). Please report back if this solves your issue.

    James

    if (event.isConnectEvent()) {
       ogscript.rename('ConnectLabel', 'Connected<fg#00FF00>');
       var commandToSend = ogscript.getObject('sendCommand');
       ogscript.putObject('sendCommand', null);
       if (commandToSend != null) {
          ogscript.debug('sending command: ' + commandToSend);
          this.writeString(commandToSend + '\n', false);
       } else {
          ogscript.debug ('command to send was null');
       }
    } else if (event.isMessageEvent()) {
       var message = event.getBytesAsString().trim();
       var startmsgsearch = message.indexOf('clip count: ');
       if (startmsgsearch != -1) {
          var clipsnum = message.substr(12, message.length-1);
          ogscript.putObject('ClipsNum', clipsnum);
          ogscript.putObject('ClipsCount', 0);
          ogscript.debug('Number of Clips = ' + clipsnum);
          ogscript.putObject('responseBuilder', new Array());
       } else {
          var clipsnum = ogscript.getObject('ClipsNum');
          var clipscount = ogscript.getObject('ClipsCount');
          if (clipsnum != null) {
             if (clipsnum == clipscount) {
                ogscript.debug('end of response');
                ogscript.putObject('busy', false);
                var responseObject = ogscript.getObject('responseBuilder');
                var callback = ogscript.getObject('callback');
                if (callback != null) {
                   ogscript.debug('making callback with ' + responseObject);
                   callback(responseObject);  
                }
                ogscript.putObject('ClipsNum', null);
                ogscript.putObject('ClipsCount', null);
             } else if (clipsnum != clipscount) {
                var clipnamestart = message.indexOf(':');
                var clipnameend = message.indexOf('.mov');
                var clipnameparsed = message.substr(clipnamestart + 2, clipnameend - clipnamestart - 2);
               var clipid = parseInt(message.substring(0, clipnamestart));
               ogscript.debug('clip received: ' clipid +' ' + clipnameparsed + ' ' + clipnamestart + ' ' + clipnameend + ' ' + clipnameparsed.length);
                ogscript.debug('clip received: ' + message);
               ogscript.getObject('responseBuilder').push({"key":clipid, "value":clipnameparsed});
                clipscount++;
                ogscript.putObject('ClipsCount', clipscount);
              } else {
                ogscript.debug('message received ' + message);
              }
          }
       }
    } else if (event.isDisconnectEvent()) {
       ogscript.rename('ConnectLabel', 'Disconnected<fg#FF0000>');
       ogscript.debug('connection closed');
       ogscript.putObject('busy', false);
    } else {
       ogscript.debug('no event info');
    }

     


    #DashBoard


  • 3.  RE: BlackMagic control panel dropdown

    Posted 09-21-2017 17:37
    Hi James,

    Yes that worked perfectly, thanks very much!

    #DashBoard


  • 4.  RE: BlackMagic control panel dropdown

    Posted 06-30-2020 15:04

    Same problem as above, but pasting James' code fix didn't help.  I'm useless at scripting however, so quite possible I did something wrong.  Pasted bolded lines in Listener task in the BMD Panel. 

    Recap - BMD Panel is fully functional except that clips are cued at a -1 position.  eg; clip 002 when cued recalls clip 001.


    #DashBoard


  • 5.  RE: BlackMagic control panel dropdown

    Posted 09-17-2020 01:57

    Hi all,

    Same problem here. Can you explain where the "listener task" is to paste this into? I can't find it.

    All the "listener tasks" I look at are currently blank...

    Thanks!


    #DashBoard


  • 6.  RE: BlackMagic control panel dropdown

    Posted 09-18-2020 00:11

    It appears to be at the bottom of the panel:

     


    #DashBoard


  • 7.  RE: BlackMagic control panel dropdown

    Posted 10-14-2020 02:47

    Hiya

    Using this fix (which I needed, as I too had clips cued wrong, and includes the missing + ); I get a bung response here in the debug:

    15:37:15:678: end of response

    15:37:15:684: making callback with [object Object],[object Object],[object Object],[object Object],[object Object]

    15:37:15:691: WE GOT SOMETHING![object Object]

    What is the obvious that I've missed?

    FYI this is one deck in a grid of 5 of these controller panels. Below is the code from one.

    <tab bottom="0" colspan="1" fill="both" height="696" id="SSD1" left="0" rowspan="1" style="bdr#0C7FF2;bdr:thick;" tabposition="north" top="0" weightx="1.0" weighty="1.0" width="298">
    <abs name="Clip Player">
    <simplegrid bottom="40" cols="1" left="40" right="40" rows="4" top="40" vspace="10">
    <label name="CR1 SSD1 - BG" style="font:bold;size:Bigger;txt-align:center;"/>
    <button buttontype="push" insets="2,2,2,2" name="Refresh Clip List" style="o#000000;size:Big;bg#selectedmuted;">
    <task tasktype="ogscript">//This is our callback
    //We will pass it to the listener and the listener will notify it when
    //it has received the complete response to the command we sent
    var callbackFunction = function(result) {
    //Reset our 'busy' state
    ogscript.putObject('busy', false);//Stop the command sender
    ogscript.getListenerById('commandSender1').stop();
    //ogscript.getAllById('commandSender1')[0].stop();

    //If we didn't get a result, we can't do much more
    if (result == null || result == undefined) {
    ogscript.debug('no result');
    return;
    }
    else
    {
    ogscript.debug('WE GOT SOMETHING!' + result[0]);
    }

    //If we did, let's update our clip list
    params.replaceConstraint(0x1, params.createIntChoiceConstraint(result));
    };

    //If we are already processing something, we can't process something ELSE
    if (ogscript.getObject('busy')) {
    ogscript.debug('can\'t do anything. already busy');
    } else {
    //Put the connection into a known state
    ogscript.getListenerById('commandSender1').stop();
    //ogscript.getAllById('commandSender1')[0].stop();

    //Mark oursevles as 'busy' so nothing else gets sent
    ogscript.putObject('busy', true);

    //Store this so the listener knows what to send
    ogscript.putObject('sendCommand', 'clips get');

    //Add a callback for the listener to call when we are done
    ogscript.putObject('callback', callbackFunction);

    //start the listener so it can send the command and read the result
    ogscript.getListenerById('commandSender1').start();
    //ogscript.getAllById('commandSender1')[0].start();
    }</task>
    </button>
    <param anchor="west" expand="true" id="" oid="0x1" weightx="1.0"/>
    <button buttontype="push" insets="2,2,2,2" name="Load" style="size:Big;bg#0C7FF2;">
    <task tasktype="ogscript">var CueClip = params.getValue(0x1, 0);

    ogscript.debug(CueClip);

    rosstalk.sendMessage(params.getValue(0x21, 0), parseInt(ogscript.getPrivateString('hosts', 'BlackmagicDeck1.port')), ' stop');
    rosstalk.sendMessage(params.getValue(0x21, 0), parseInt(ogscript.getPrivateString('hosts', 'BlackmagicDeck1.port')), ' goto: clip id: ' + CueClip);
    rosstalk.sendMessage(params.getValue(0x21, 0), parseInt(ogscript.getPrivateString('hosts', 'BlackmagicDeck1.port')), ' play: single clip: true loop: true');</task>
    </button>
    </simplegrid>
    </abs>
    <abs name="Settings">
    <table bottom="0" id="commsTable1" left="0" right="0" top="0">
    <tr>
    <param left="0" oid="0x21" pheight="100" pwidth="228" style="size:Big;" top="0"/>
    <button buttontype="push" name="Set" pheight="100" pwidth="58" style="size:Bigger;">
    <task tasktype="ogscript">ogscript.putPrivateString('hosts', 'BlackmagicDeck1.host', params.getValue(0x21,0));
    ogscript.debug('Set IP address to: ' + ogscript.getPrivateString('hosts', 'BlackmagicDeck1.host'));


    var choices1 = new Array();
    choices1.push('no clips loaded');
    var choiceConstraint1 = params.createIntChoiceConstraint(choices1);
    params.replaceConstraint(0x1, choiceConstraint1);
    params.setValue(0x1, 0, 0);

    //Reset our 'busy' state
    ogscript.putObject('busy', false);

    ogscript.reload('commsTable1');</task>
    </button>
    <listener autostart="false" buttontype="toggle" connecthost="%value[0x21][0]%" connectport="%const['hosts']['BlackmagicDeck1.port']%" delimitertype="newline" id="commandSender1" left="0" name="Comms" pheight="100" pwidth="110" style="style:ToggleButtons;" top="0">
    <task tasktype="ogscript">if (event.isConnectEvent()) {
    ogscript.rename('ConnectLabel1', 'Connected&lt;fg#00FF00&gt;');
    var commandToSend = ogscript.getObject('sendCommand');
    ogscript.putObject('sendCommand', null);
    if (commandToSend != null) {
    ogscript.debug('sending command: ' + commandToSend);
    this.writeString(commandToSend + '\n', false);
    } else {
    ogscript.debug ('command to send was null');
    }
    } else if (event.isMessageEvent()) {
    var message = event.getBytesAsString().trim();
    var startmsgsearch = message.indexOf('clip count: ');
    if (startmsgsearch != -1) {
    var clipsnum = message.substr(12, message.length-1);
    ogscript.putObject('ClipsNum', clipsnum);
    ogscript.putObject('ClipsCount', 0);
    ogscript.debug('Number of Clips = ' + clipsnum);
    ogscript.putObject('responseBuilder', new Array());
    } else {
    var clipsnum = ogscript.getObject('ClipsNum');
    var clipscount = ogscript.getObject('ClipsCount');
    if (clipsnum != null) {
    if (clipsnum == clipscount) {
    ogscript.debug('end of response');
    ogscript.putObject('busy', false);
    var responseObject = ogscript.getObject('responseBuilder');
    var callback = ogscript.getObject('callback');
    if (callback != null) {
    ogscript.debug('making callback with ' + responseObject);
    callback(responseObject);
    }
    ogscript.putObject('ClipsNum', null);
    ogscript.putObject('ClipsCount', null);
    } else if (clipsnum != clipscount) {
    var clipnamestart = message.indexOf(':');
    var clipnameend = message.indexOf('.');
    var clipnameparsed = message.substr(clipnamestart + 2, clipnameend - clipnamestart - 2);
    var clipid = parseInt(message.substring(0, clipnamestart));
    ogscript.debug('clip received: '+ clipid +' ' + clipnameparsed + ' ' + clipnamestart + ' ' + clipnameend + ' ' + clipnameparsed.length);
    ogscript.debug('clip received: ' + message);
    ogscript.getObject('responseBuilder').push({"key":clipid, "value":clipnameparsed});
    clipscount++;
    ogscript.putObject('ClipsCount', clipscount);
    } else {
    ogscript.debug('message received ' + message);
    }
    }
    }
    } else if (event.isDisconnectEvent()) {
    ogscript.rename('ConnectLabel1', 'Disconnected&lt;fg#FF0000&gt;');
    ogscript.debug('connection closed');
    ogscript.putObject('busy', false);
    } else {
    ogscript.debug('no event info');
    }</task>
    </listener>
    </tr>
    </table>
    <label id="ConnectLabel1" name="Disconnected" right="10" style="font:bold;bdr:etched;bg#dark;size:Big;fg#F60505;txt-align:center;" top="10"/>
    </abs>
    </tab>

    #DashBoard


  • 8.  RE: BlackMagic control panel dropdown

    Posted 10-19-2020 09:05

    Is there a chance another parseInt() is needed elsewhere?...


    #DashBoard