Quick Sign In:  

Forum: VirtualDJ Plugins

Topic: Keeping a key pressed through OnProcessSamples

This topic is old and might contain outdated or incorrect information.

Is there a way to keep a key held pressed down in the OnProcessSamples event? If so, how is this done.

Thinking that using SendCommand("Pad 1") will send an independent push each time the loop goes through. Would like the button to stay down until I ask it to release.

Thanks.
 

Posted Sun 12 Mar 17 @ 6:09 pm
locodogPRO InfinityModeratorMember since 2013
I dunno, but what is pad 1 calling?
 

Posted Mon 13 Mar 17 @ 5:32 am
I wrote a 'pad recorder' plugin and it' plays back what is in each of the pads. So it scrapes the original pad setup and puts it in a vector of new pads and injects the keydown event into each respective pad row. So basically when a user presses down the pad the plugin can detect it using GetInfo. For a better feature it would be nice to have the application keep up the current action during keydown. So if the pad has a sustained event, the loop doesn't repeatedly press down the key. I really think it's too complicated to get the extra holding effect I want and will have to make due for the simple fact it's doing playback of instant events only.

Make sense?
 

Posted Mon 13 Mar 17 @ 12:10 pm
djcelPRO InfinityModeratorMember since 2004
If i well understood you need a boolean. Create a variable int status; in your class.
Then init the value to 0
Then you need to call getinfo (in a periodic loop) to catch the change of the pad.
So your question is on fact how to create this getinfo loop?

 

Posted Sun 19 Mar 17 @ 1:14 pm
AdionPRO InfinityCTOMember since 2006
The problem is that you can not emulate key press and key release separately through SendCommand, so you couldn't play back the recorded script.
 

Posted Sun 19 Mar 17 @ 1:58 pm
Thanks @djcel. Catching the change isn't the issue. I got that figured out, I know when a button is pressed and released. Just having it playback if a button is held down.

Thanks@Adion, I went through the scenarios a few times before you responded and I figured there was no way to emulate a key holding effect. Each time it runs through OnProcessSamples procedure it doesn't know during play back to keep the button down from the recorded script if I use a SendCommand. I was thinking of using a windows keyboard hook to grab system keyboard events so I can inject them that way but don't think that will help either because if VDJ main code isn't accepting a way to send keydown and release, then holding won't take place. :(

Which is also interesting all the plugins I can now guess are written sending VDJ commands which really don't hold down buttons but act on the verbs sent to it. So if someone wrote a plugin to hold down flanger for 5 seconds, the C++ code would send an activation at the first instance and deactivation at 5 seconds with no holding needed.. grrrr.. :(

Oh well, you win some you lose some.
 

Posted Mon 20 Mar 17 @ 1:42 pm


(Old topics and forums are automatically closed)