Quick Sign In:  

Forum: VirtualDJ Technical Support

Topic: Read the position of deck 1 and then set this position on deck 2 by minus 2 seconds
Hello
I would like to use a key combination to read the position of deck 1 and then set this position on deck 2 by minus 2 seconds.
I have tried the following:
set '$PosDeck1' = deck 1 get_position & deck 2 goto var '$PosDeck1' -2000ms
Unfortunately this does not work. I have the feeling that the variable is not set correctly.
I would be very happy about your support.
 

geposted Mon 15 Apr 24 @ 8:35 am
Try this:
deck 1 set '$deck1songpos' '`deck 1 song_pos' & deck 2 get_var '$deck1songpos' & param_cast percentage & deck 2 song_pos & deck 2 goto -2000ms

This should work "perfectly" if the song loaded on the 2 decks is the same.
If the song is different, then there are some other more complicated ways to do this
 

geposted Mon 15 Apr 24 @ 8:47 am
Thank you for your fast feedback.
The script works as described. Unfortunately, the songs are two different songs with different lengths.
Can you give me some hints on how to realise this?
Why does the param_cast function have to be used? We use the same function (song_pos) to query the song position. (I have tried it. Without the param_cast function the script does not work)
Is there a way to display the value of a variable somewhere?
 

geposted Mon 15 Apr 24 @ 9:49 am
locoDogPRO InfinityModeratorMember since 2013
you don't need a variable you just have to handle with the fact that goto uses absolute [pitch neutral] time values

action_deck 1 ? param_multiply 'get_time elapsed' `deck 2 param_multiply get_pitch_value 0.01` & param_cast ms & deck 2 goto & param_multiply -2000 `param_multiply get_pitch_value 0.01` & param_cast ms & param_cast relative & goto : param_multiply 'get_time elapsed' `deck 1 param_multiply get_pitch_value 0.01` & param_cast ms & deck 1 goto & param_multiply -2000 `param_multiply get_pitch_value 0.01` & param_cast ms & param_cast relative & goto
 

geposted Mon 15 Apr 24 @ 11:09 am
Thank you very much Locodog. Your code worked perfectly.
 

geposted Wed 17 Apr 24 @ 12:18 pm