Hi there,
VM is really a good platform !
I want to make a module that is synced to host. The test module of VMD does not seems to include options to test this so I thought I would simulate a clock signal with Named Timers.
1. Is this the most simple option?
2. What are the characteristics clocks signals? Is it +5V during 1 sample or longer?
3. Maybe a dummy question but how can I print values for debug ? System.out.println doesn't seem to work in the output console.
Thank you in advance
Simulate a clock signal / printing values
Re: Simulate a clock signal / printing values
Hi there,
debugging is a bit of a nuisance. Here's what works for me...
1) the debugger lets you look at variables, etc. (Sorry, bit obvious.)
2) If you put a text box onto the canvas somewhere you can write text into the text box. Delete the text box when you're done.
Regarding 2, I have a text box with the module name in it that I sometime use for debugging. That way you don't take extra space on the canvas.
Very best regards...
gary
debugging is a bit of a nuisance. Here's what works for me...
1) the debugger lets you look at variables, etc. (Sorry, bit obvious.)
2) If you put a text box onto the canvas somewhere you can write text into the text box. Delete the text box when you're done.
Regarding 2, I have a text box with the module name in it that I sometime use for debugging. That way you don't take extra space on the canvas.
Very best regards...
gary
-
- Posts: 2
- Joined: Sat Jan 19, 2019 6:49 pm
Re: Simulate a clock signal / printing values
Thanks a lot ! Will try your text box tips
Best regards,
Best regards,
Re: Simulate a clock signal / printing values
I'd be really interested in any code snippets you'd be prepared to share on how to do the sync to host - especially if it is then possible to do division of the timer (i.e. 1/2 beat, 1/4 beat, 1/3 beat, etc.)
-
- Site Admin
- Posts: 257
- Joined: Fri Jul 27, 2018 5:36 pm
Re: Simulate a clock signal / printing values
There are two ways to sync to host. The simplest is to call GetTempo(), which is available in the VoltageModule class (along with GetTimeSignatureNumerator(), and GetTimeSignatureDenominator()). The other way is to use the Sync signal, which contains 96 pulses per quarter note. Dividing the sync signal into beats is simple - advance your clock every 96 pulses for quarter notes, every 48 pulses for eighth notes, every 32 pulses for triplets, etc. A reset jack is necessary in order to ensure your clock is properly synced to the playback clock.
Thanks,
Dan
Re: Simulate a clock signal / printing values
Thank you, really clear.
Re: Simulate a clock signal / printing values
Also, you can use Log("something") to write to the Output console. Just have to run in the Debug mode for this to work. For continuously monitoring the value of a variable (or variables), I also use the textbox method all the time.
Re: Simulate a clock signal / printing values
I've been doing the text box thing quite a lot recently. The log options looks quite nice - does this get optimised out for the published versions? But think having watch variables and break of variable change in the debugger would make the experience much better.