Quick Sign In:  

Forum: General Discussion

Topic: How to code multiple queries and cue present? - Page: 1

This part of topic is old and might contain outdated or incorrect information

I added a question onto an old thread of mine but didn't get a reply. Thought I'd write a new one here as the other thread had gotten long and it was possibly overlooked.

I'm trying to work out how to code multiple questions. My current code only queries if 'deck 1 = paused?':

deck 1 pause ? deck 1 level 100% & deck 1 goto_cue 3 & deck 1 cue_button 3 : deck 1 level 100% & deck 1 goto_cue 3 & deck 1 pause & deck 1 cue_button 3

But I also want to ask if 'cue#3 is present?' So if cue#3 is present then it would activate the code above, otherwise it would do nothing.

I cannot find the correct command to check if there is an existing cue point already present. And I don't understand how to code more than one question. Can anyone help? Thanks
 

Posted Tue 02 Aug 16 @ 2:52 pm
locodogPRO InfinityModeratorMember since 2013
has_cue 3 ?


query 1 ? [q1 true] query 2 ? [q1 and q2 true] : [q1 true, q2 false] : [q1 false]

if you want to query 2 while q1 is false, query again

query 1 ? [q1 true] query 2 ? [q1 and q2 true] : [q1 true, q2 false] : [q1 false] query 2 ? [q1 false q2 true] : [q1 false q2 false]
 

Posted Tue 02 Aug 16 @ 3:02 pm
Many thanks locodog. Will try that all out when I get home.
 

Posted Thu 04 Aug 16 @ 3:44 pm
Thanks locodog, I got it working with:

deck 1 has_cue 3 ? deck 1 pause ? deck 1 level 100% & deck 1 goto_cue 3 & deck 1 cue_button 3 : deck 1 level 100% & deck 1 goto_cue 3 & deck 1 pause & deck 1 cue_button 3 : nothing

But now I'm trying to code a button to do the same as above, but which then continues to play the track after holding for 1000ms, and syncs it (not before).

I have the 'continue play' bit correct using:

deck 1 has_cue 3 ? deck 1 level 100% & deck 1 goto_cue 3 & deck 1 pause & deck 1 cue_play 3 1000ms : nothing

But I'm having problems with adding the 'sync' bit. Using your formula above, I thought it would have been this:

deck 1 has_cue 3 ? holding 1000ms ? deck 1 sync : deck 1 level 100% & deck 1 goto_cue 3 & deck 1 pause & deck 1 cue_play 3 1000ms : nothing

The sync bit works correctly, but for some reason the 'stutter' effect now works totally differently after adding the 'holding 1000ms ?'

Have you any idea what the problem is?

 

Posted Tue 09 Aug 16 @ 2:08 pm
Bump. Having trouble figuring this out.
 

Posted Tue 23 Aug 16 @ 10:05 pm
@locodog I wondered if you knew what was happening here.

deck 1 has_cue 3 ? holding 1000ms ? deck 1 sync : deck 1 level 100% & deck 1 goto_cue 3 & deck 1 pause & deck 1 cue_play 3 1000ms : nothing

I thought it meant this:

- if deck 1 has_cue 3 and holding 1000ms are true, then deck 1 sync

- if deck 1 has_cue 3 is true but holding 1000ms is false, then deck 1 level 100% & deck 1 goto_cue 3 & deck 1 pause & deck 1 cue_play 3 1000ms

- if deck 1 has_cue 3 and holding 1000ms are false, then do nothing

Is that not right?
 

Posted Sun 28 Aug 16 @ 3:17 pm
I had someone test it out on virtualdj 8 with the same result, so it must be a problem with the code. Is there another way to code the same thing? Or is it possible to do in virtualdj 8?
 

Posted Wed 07 Sep 16 @ 12:29 pm
locodogPRO InfinityModeratorMember since 2013
You are querying holding for 1000ms, but on your not holding answer, you're calling cue_play and wanting to hold that for 1000ms play.

which do you want to win?
Drop cue_play to something like 950ms

 

Posted Wed 07 Sep 16 @ 4:34 pm
It's still the same though.

The code below works fine:

deck 1 has_cue 3 ? deck 1 level 100% & deck 1 goto_cue 3 & deck 1 pause & deck 1 cue_play 3 950ms : nothing

But as soon as I add the code to make it sync after 1000ms, the "deck 1 level 100% &..." code behaves in a totally different way than above. It doesn't stutter as a punch button anymore.

deck 1 has_cue 3 ? holding 1000ms ? deck 1 sync : deck 1 level 100% & deck 1 goto_cue 3 & deck 1 pause & deck 1 cue_play 3 950ms : nothing

Isn't that the same on your end?
 

Posted Wed 07 Sep 16 @ 4:50 pm
Not sure if this line can be changed:

deck 1 level 100% & deck 1 goto_cue 3 & deck 1 pause & deck 1 cue_play 3 950ms

It's the only way I found to add a punch button that works the same way if the track is paused or playing, and then it continues to play after being held down for 950ms
 

Posted Wed 07 Sep 16 @ 4:55 pm
locodogPRO InfinityModeratorMember since 2013
Not sure then, maybe change the hotcue mode to stutter & switch cue_play for hot_cue 3
 

Posted Wed 07 Sep 16 @ 5:22 pm
That doesn't work unfortunately. Is it possible to add more queries to the code below. One that continues to play the track after holding for 950ms, and another that syncs the track after holding for 1000ms?

deck 1 has_cue 3 ? deck 1 pause ? deck 1 level 100% & deck 1 goto_cue 3 & deck 1 cue_button 3 : deck 1 level 100% & deck 1 goto_cue 3 & deck 1 pause & deck 1 cue_button 3 : nothing
 

Posted Thu 08 Sep 16 @ 4:08 pm
locodogPRO InfinityModeratorMember since 2013
I honestly think having two holding scripts in one macro doesn't play nice
 

Posted Fri 09 Sep 16 @ 11:45 am
Yeah it definitely looks that way. How about syncing after the track has been playing for 1000ms. i.e. Is there a way to query how long a track has been playing for, instead of how long the button is held down for?
 

Posted Fri 09 Sep 16 @ 5:19 pm
locodogPRO InfinityModeratorMember since 2013
Probably yes, I've a hazy idea but it gets complicated, syncing after a whole second after launching a hotcue, doesn't feel like it would work for me

why not just have a sync button

 

Posted Fri 09 Sep 16 @ 5:55 pm
I do lots of fast juggling between tracks and having to press that extra sync button is causing mistakes. That'd be great if you can see a way to get that sync in.
 

Posted Fri 09 Sep 16 @ 6:40 pm
..bit hard to explain it but basically I'm pressing lots of buttons at the same time and having it sync in one will make things a lot simpler
 

Posted Fri 09 Sep 16 @ 6:55 pm
locodogPRO InfinityModeratorMember since 2013
try this instead, I didn't see it at first

deck 1 has_cue 3 ? holding 1000ms ? play & deck 1 sync : deck 1 level 100% & deck 1 goto_cue 3 & deck 1 pause & deck 1 cue_play 3 : nothing


 

Posted Fri 09 Sep 16 @ 7:12 pm
When you use "holding ?" query on a script the action get's executed either after 1 sec (when holding query validates as true) or either when you release the button (on up prior to 1 sec from down)
Therefore on cases like this it won't help
You want a "do this & if holding do that as well" script which is difficult to achieve depending on the actions themselves.

I didn't follow this thread from the beginning and it's kinda hard to understand it now.

So, please describe how you want your button to behave.
Try to avoid any code, but describe it as good as you can.
Perhaps then I can come up with something.
 

Posted Fri 09 Sep 16 @ 8:43 pm
Locodog, thanks but still no luck unfortunately. Ok Phantom I'll try and explain it as simply as possible.


On some of my tracks I've added a cue point (cue #3). I want to use one single button to do the following:

- If there's no cue #3 added I don't want the button to do anything. If cue #3 has been added I want the button to:

- Whether the track is paused or already playing, when I press the button it plays from cue #3 'only' as long as the button is held down. As soon as the button is released the track stops.

- But if the button is held down for 1000ms it then syncs the track, and continues to play it after the button is released.

Let me know if anything's unclear at all.
 

Posted Sat 10 Sep 16 @ 2:45 am
80%