Sign In:     


Forum: VirtualDJ Plugins

Topic: Access to the clock

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

Is it possible to have access to the clock that we can see on skins? (=fullhour)

Or is it possible to have access to the clock of Windows? (...adding new functions for windows in .h)

Endeed I would like to get the time so as to use it in plugins: something like GetParam...
 

Posted Mon 22 Nov 04 @ 12:14 pm
I think we can use:

#include time.h

in the header of the cpp file

with symbols superior and inferior (they don't appear on the forum)
 

I have created a kind of wake up for VDJ but it freezes Vdj to work.

If someone knows about time program using the library time.h, reply here
(It's not only concerning program for vdj but general C, C++ programs. I mean you don't need to know how to develop plugin for vdj but only know using time.h)
 

Here is my function:

////////////////////

#include time.h>

void wait ( int seconds )
{
clock_t endwait;
endwait = clock () + seconds * CLK_TCK ;
while (clock() < endwait) {}
}

/////////////////
For example: wait(1); equals to 1 second

The problem is that the loop while freezes VDJ. Do you have any ideas to solve that problem?
 

Can we do multithreading with VDJ?
I mean one thread for excutions in VDJ and another thread for my function wait()
 

djcel;

I think (not sure) that you can't use clock functions in a VDJ plugin because VDJ gets samples and treat them with the plugin before playing them. (Sorry for my english)
 

My idea is to create a new thread (an event) where I put my loop linked to the Windows time.

I have understood multithreading this night (i'm happy to have discovered that because it was very interesting :-) enough for not sleeping) and I have included this code in my plugin. However vdj always freezes but finaly execute the program like without multithreading.

 

djcel: you should NOT use a while() loop to wait out some time... this is EXTREMELY cpu intensive... I know (in C#... I'm pretty sure there is one in C++ too) there is a function to put the thread to sleep for some time, which does not use much CPU at all (thus, no freezing).

I've never done multithreading in C++ though, only in C#... Good luck ;)

macourteau
 

Do you talk about the function sleep(int) ?

Great idea for the moment but it's not enough for my project
 

I don't know, you should try... I don't really have time now to test this, sorry :(

macourteau
 

I need some help for a new plugin Wake Up:

* define 2 hours with date: one to start and the other one to stop
* when the first one is reached, automix starts + option to broadcast on the web
(vdj has to stay open of course to use the plugin ;-) )
* when the second one is reached, sound is stopped + option to close vdj

I'm calling all developers even new ones !! I can help you to adapt a wake up on VDJ if you know how to create a wake up without freezing
 



(Old topics and forums are automatically closed)