I have been rolling up my sleeves. Just because I ask about a single issue here, which is related to functions and use in VCV, I am having trouble with, doesn’t mean I am having trouble with everything else.
During the last week, I build a phaser based “phaselocked” sequencer, with clock divider, length, offset, random step selection, freeze function, probability, retrigger function, with complete control over where the sequencer position at any given time. I did the user interface. I made an LFO that does the same. There is pretty much no sequencer who does anything close to this in VCV. Nysthi Programmer is the one that comes closest, but it also has its weak points, which I why I am writing my own personal sequencer.
I learned how to add presets and save them in json file. This momentary button, I posted code for above, which I did myself, is part of that presets system, for saving. I made it and shared it with the guy that made this thread, no questions asked, cause he needed it too and now I am just trying to simplifying my code in main process block by turning it into a function.
ALL of this on my own, with out asking a single question, just doing research on the web and looking in this forum. I have no sleeves left
BUT… I am new to using functions and there is clearly something that does not compute the same way in a function in VCV, as it does if the code is used directly in process block. And I am just trying to find out how it works.
No I am not a programmer, so there is absolutely stuff, I dont understand. But that’s how it is, we are on different levels and, I hope, that we all help as we have skills for. I helped this guy, in this thread. I also made a Launch controller LXL template and a patch for another guy in here a few days ago, cause I knew how to do that.
So you saying I have to learn to roll up my sleeves… I am gonna let it slide, cause you don’t know how much work I have been doing the last week or how much I’ve learned…
I see many people in these programming forums, who when someone asks about something, it ends up in long lectures about something that really had nothing to do with the issue the person asked about. I always wondered why that is… Why not spend the time that one would spend on the lecture, to actually help out? I just don’t understand that mentality.
About initialising the counter. I already tried that. Doesn’t do anything at all. If you look at the code says:
if (input > 0){
count}
else{count = 0;}
So when the input 0, counter is reset to 0. The parameter send to input is initialised to zero, so the counter is also 0.
And also, once again, the code above works directly in process block, without the initialisation. Which ones again makes me think that there is a difference in using for example a counter in or outside process block.
The example I posted is as simple as it gets. if input on, then Count, if input off then set to 0. I use the output for debugging. I tried printf in the function, but it also only work sin process block, not in my function.cpp. I believe that if it was an initialisation issue, the counter would just start off where it left, so if it had reached 34567, it would just start of there next time input is 1. That’s what usually happens if a counter is not initialised. I did try to initialise it again and the output I get from the counter function is just 0 and 1 when I turn off/on the toggle button that’s fed to the function, the counter just doesn’t start at all. So I don’t think it’s an init issue.