camikura / touchdesigner-atem-chop

Control Blackmagic Design ATEM from TouchDesigner's CHOP Operator
MIT License
14 stars 1 forks source link

How to control fade sliders? #4

Open CosmicStephan opened 1 year ago

CosmicStephan commented 1 year ago

プラグインが使いやすくて、ありがとうございます! AUTOではなく、FADEを自分で制御する為のスライダをこのプラグインで動かすことが出来ますか?

Thank you for this plugin! It's very easy to use. Using your plugin, is there a way to control the fade slider that's used for manual transitions?

image

camikura commented 1 year ago

Currently that feature is not implemented. I may implement it when I have time. Until then, I'll leave this issue open.

Thanks.

CosmicStephan commented 1 year ago

@camikura Thank you for your reply. Any hints on how I can modify your source code to do this? It seems the sendCommand() method in atem.cc takes specific strings ("DCut", "CPgI", etc.), bitshifts them and sends them as data packets... Does BlackMagic define these strings, and do you know where I could find the correct one for ME-faders?

There's also

define MIXERCONTROL_CT_CLASS_FADER 0x50000000L

in mmeapi.h . Is that related?

camikura commented 1 year ago

To change transition positions, you need to send CTPs commands.

like this. but no test.

uint16_t pos = 500; // 0 <= pos <= 1000
vector<uint8_t> data{me, 0};
data.push_back((pos * 10) / 256);
data.push_back((pos * 10) % 256);
sendCommand("CTPs", data);

Reference

CosmicStephan commented 1 year ago

Hey, that worked, thank you! Once the position hits 1000, the cut completes and you have to send values from going up from 0 to 1000 again even though you're moving the slider in the opposite direction, so I do this in a CHOPExecute DAT for MIDI slider input:

def onValueChange(channel, sampleIndex, val, prev):
    global direction
    adjVal = val if direction == 1 else 1.0 - val   
    outputValue.par.value0 = adjVal * 1000
    if(adjVal >= 1.0):
        direction = direction * -1
    return

The only issue with this is that, depending on the starting position of the real slider and the ATEM Software Control's slider, the ATEM Software Control's slider can be seen going in the opposite direction, but this doesn't really affect functionality.

By the way, are the strings like "CTPs" something you made or is it part of BlackMagic's code (and if so, how did you find out what the strings are?)? EDIT: Just noticed the reference link you posted!

EDIT: Also, I'm wondering how to refresh values that I send to the Atem CHOP. In TD, setting the same value twice doesn't output the value. For the MIDI Out chop, I could bypass this problem by sending the values via Python, but not sure what to do with the Atem CHOP.