Quick Sign In:  

Forum: VirtualDJ Technical Support

Topic: MIDI button scripting question
bghomePRO InfinityMember since 2022
I added the following script to a button of a MIDI controller:
param_add 1 2 & param_cast 'integer' & debug


This is executed twice, once the button is down and once it's up.
My expectation after pressing the button is
to see
Int: 3
Int: 3

but actually I get:
Int: 1
Int: 0

If I set the same to a custom UI button, then I get 3 as expected.
Does anyone know how to do it properly in case of MIDI button/action?
 

Posted Wed 27 Nov 24 @ 8:14 pm
locoDogPRO InfinityModeratorMember since 2013
Shouldn't be the case unless your device is sending an implicit, buttons usually don't, but evidence says they do.
try this

param_multiply 0 & param_add 1 & param_add 2 & param_cast 'integer' & debug
 

Posted Wed 27 Nov 24 @ 11:09 pm
bghomePRO InfinityMember since 2022
locoDog wrote :
Shouldn't be the case unless your device is sending an implicit, buttons usually don't, but evidence says they do.
try this

param_multiply 0 & param_add 1 & param_add 2 & param_cast 'integer' & debug


That worked well. Thank you for the hint.

I have a similar question. Why am I getting Int: 0 and Int: 1, instead of the song BPM value?
get_bpm & param_cast 'integer' & debug
 

Posted Fri 29 Nov 24 @ 9:57 am
locoDogPRO InfinityModeratorMember since 2013
same reason, your device sends an implicit value

see this, I don't even have to cast to debug
param_multiply 0 & param_add `get_bpm` & debug

when there's an implicit value it will get added to the end of every verb, and it gets there before a _cast does.
So you have to work with it. You don't have a choice,
buttons normally don't have an implict, sliders do, jogs do, encoders do, pad_params do

See the implicit for more details.
 

Posted Fri 29 Nov 24 @ 11:53 am
bghomePRO InfinityMember since 2022
I see. Thank you very much.
 

Posted Fri 29 Nov 24 @ 5:29 pm