I am trying to use an encoder to change position in the song, then set a cue at that new position. Something like this:
The problem is that the encoder value becomes an implicit parameter to set_cue, thus the cue only gets set to +/- 1 (beat).
I see in this post a suggestion that using the value keyword somewhere in the command will prevent the parameter from being used implicitly elsewhere. I can't find any reference to this behavior anywhere else though and it doesn't seem to work as such.
I tried putting a query in the chain in the hope that its result would override the implicit parameter but that does not work:
I tried supplying the second parameter to set_cue explicitly, but also no joy there.
In fact, I can't actually get set_cue to work with a verb in the second parameter in a regular (i.e. non-encoder) action at all e.g.:
Any help getting this to work would be greatly appreciated :)
param_greater 0 ? goto +50ms & set_cue "a" : goto -50ms set_cue "a"
The problem is that the encoder value becomes an implicit parameter to set_cue, thus the cue only gets set to +/- 1 (beat).
I see in this post a suggestion that using the value keyword somewhere in the command will prevent the parameter from being used implicitly elsewhere. I can't find any reference to this behavior anywhere else though and it doesn't seem to work as such.
I tried putting a query in the chain in the hope that its result would override the implicit parameter but that does not work:
param_greater 0 ? goto +50ms & get_position & param_cast 'percentage' & set_cue "a" : goto -50ms & get_position & param_cast 'percentage' & set_cue "a"
I tried supplying the second parameter to set_cue explicitly, but also no joy there.
In fact, I can't actually get set_cue to work with a verb in the second parameter in a regular (i.e. non-encoder) action at all e.g.:
set_cue "a" get_position
Any help getting this to work would be greatly appreciated :)
Posted Wed 11 Dec 19 @ 7:12 am
what is "a" ?
param_greater 0 ? goto +50ms & set_cue : goto -50ms & set_cue
works as expected here, meaning that its not taking +1/-1 beats, but yes applies to HC 1.
Edit... Ah i see its applying to all HCs.
param_greater 0 ? goto +50ms & set_cue : goto -50ms & set_cue
works as expected here, meaning that its not taking +1/-1 beats, but yes applies to HC 1.
Edit... Ah i see its applying to all HCs.
Posted Wed 11 Dec 19 @ 7:53 am
coconut96 wrote :
In fact, I can't actually get set_cue to work with a verb in the second parameter in a regular (i.e. non-encoder) action at all e.g.:
set_cue "a" get_position
This should work:
set_cue 0 & get_position
The reason your code doesn't work is that VirtualDJ tries to pass the string 'get_position' itself as second parameter to set_cue, which of course is rejected as it only accepts specific 'values' as second parameter (+X, -X, +Xms, -Xms, X%)
On the encoder try this:
param_greater 0 ? goto +50ms & set_cue 0 & get_position : goto -50ms & set_cue 0 & get_position
Posted Wed 11 Dec 19 @ 9:26 am
param_bigger 0 ? goto +500ms & delete_cue 2 & hot_cue 2 : goto -500ms & delete_cue 2 & hot_cue 2
might work out for you might not.
Should it? as I understood the implicit would still be the 2nd param of set_cue, and I've never see a 2nd param 'grabbed' after the &
might work out for you might not.
PhantomDeejay wrote :
This should work:
set_cue 0 & get_position
Should it? as I understood the implicit would still be the 2nd param of set_cue, and I've never see a 2nd param 'grabbed' after the &
Posted Wed 11 Dec 19 @ 9:27 am
djdad wrote :
what is "a" ?
Just a name for the cue as I have a need to use more than the standard number of slots.
PhantomDeejay wrote :
The reason your code doesn't work is that VirtualDJ tries to pass the string 'get_position' itself as second parameter to set_cue, which of course is rejected as it only accepts specific 'values' as second parameter (+X, -X, +Xms, -Xms, X%)
So I understand this is what the backticks are for, and I've tried variety of things inside them, but so far without any luck :|
locodog wrote :
Should it? as I understood the implicit would still be the 2nd param of set_cue, and I've never see a 2nd param 'grabbed' after the &
PhantomDeejay wrote :
This should work:
set_cue 0 & get_position
Should it? as I understood the implicit would still be the 2nd param of set_cue, and I've never see a 2nd param 'grabbed' after the &
I believe you are correct. That script works in a normal action due to the default behavior of set_cue given only one parameter, but I'm afraid it doesn't work in an encoder action.
locodog wrote :
param_bigger 0 ? goto +500ms & delete_cue 2 & hot_cue 2 : goto -500ms & delete_cue 2 & hot_cue 2
Thank you for the suggestion. Unfortunately this approach has the side effect of setting Loop_in to the cue point when in a loop.
Posted Wed 11 Dec 19 @ 11:54 am
coconut96 wrote :
Thank you for the suggestion. Unfortunately this approach has the side effect of setting Loop_in to the cue point when in a loop.
I'm not saying mines the right way, just a way, you could resolve this side effect with a query, obviously there's something weird about the implicit that is complicated for devs to explain.
param_bigger 0 ? goto +500ms & delete_cue 2 & setting "loopAutoMove" ? setting "loopAutoMove" 0 & hot_cue 2 & setting "loopAutoMove" 1 : hot_cue 2 : goto -500ms & delete_cue 2 & setting "loopAutoMove" ? setting "loopAutoMove" 0 & hot_cue 2 & setting "loopAutoMove" 1 : hot_cue 2 :
Posted Wed 11 Dec 19 @ 12:26 pm
Thanks locodog. I didn't know about the "loopAutoMove" setting. I can do most of what I've been trying to do now.
Still, I'm hoping one of the devs can provide clarity on these points:
1. Given a script in the form get_loop_out_time & param_cast ms & goto, is it at all possible to achieve the same result in the form goto `get_loop_out_time & param_cast ms`?
2. Is there any way to prevent the implicit encoder parameter from being fed into every single command?
If either of these can be resolved that'd be great as it's the combination of the two that really restricts what can be done with an encoder.
Still, I'm hoping one of the devs can provide clarity on these points:
1. Given a script in the form get_loop_out_time & param_cast ms & goto, is it at all possible to achieve the same result in the form goto `get_loop_out_time & param_cast ms`?
2. Is there any way to prevent the implicit encoder parameter from being fed into every single command?
If either of these can be resolved that'd be great as it's the combination of the two that really restricts what can be done with an encoder.
Posted Fri 13 Dec 19 @ 10:25 am
This might seem crazy, but the past few days I've been trying to write a script that does almost EXACTLY what you mentioned in this post. Here was my script for use with a track selection knob:
I kept searching for a solution, and couldn't find anything. But thankfully I stumbled upon your question, because at first I thought I was the only one having this problem!
After a great deal of experimenting, I finally found a simple workaround. Yes it's somewhat hacky, but it gets the job done at least for cue points that are numeric.
The command param_multiply 0 resets the parameter being passed into the script by the encoder. So you can safely plug value as an explicit parameter into any of the subsequent commands. In this case, set_cue value will be interpreted as set_cue 0, leaving the second parameter as the default. If you wanted a different cue point, like say 3, then just insert another command param_add 3 after multiply. Voila!
Of course, the main limitation of this approach is that it only works with numeric parameters. Also, if the command in question only accepts one parameter to begin with, then you're out of luck. Hope this helps!
param_equal -1 ? goto -50ms & set_cue 0 : goto +50ms & set_cue 0
I kept searching for a solution, and couldn't find anything. But thankfully I stumbled upon your question, because at first I thought I was the only one having this problem!
After a great deal of experimenting, I finally found a simple workaround. Yes it's somewhat hacky, but it gets the job done at least for cue points that are numeric.
param_equal -1 ? goto -50ms & param_multiply 0 & set_cue value : goto +50ms & param_multiply 0 & set_cue value
The command param_multiply 0 resets the parameter being passed into the script by the encoder. So you can safely plug value as an explicit parameter into any of the subsequent commands. In this case, set_cue value will be interpreted as set_cue 0, leaving the second parameter as the default. If you wanted a different cue point, like say 3, then just insert another command param_add 3 after multiply. Voila!
Of course, the main limitation of this approach is that it only works with numeric parameters. Also, if the command in question only accepts one parameter to begin with, then you're out of luck. Hope this helps!
Posted Sun 12 Jun 22 @ 1:06 pm