baconpaul / BaconPlugs

My plugins for VCVRack, which you may enjoy.
GNU General Public License v3.0
71 stars 11 forks source link

glissinator lock-up? #7

Closed alto777 closed 6 years ago

alto777 commented 6 years ago

I was looking into your glissinator code as I need to do something similar but not quite. And I'd like to roll it into my thing so there is less wiring.

I got some odd behaviour when I was torutre testing it, I think

if( offsetCount == shift_time )

should be changed to

if( offsetCount >= shift_time )

as the shift time can change during your fade process and this exact deadline is missed. I think one ends up waiting for an int to wrap around…

I think I get your technique enough to work from it. There may be some other "moving target" oddnesses. If fed a rational diet, the plugin works just fine - smoothing steps out.

BTW, thought that adding an output that is an "in gliss" gate could be useful in some circumstances, although I hate to cram up things with all kindsa features. Some of the third party stuff has so much going on it is bewildering.

a7

baconpaul commented 6 years ago

Oh hey thanks. I’ll stress test it but yes I think you are right. And I have a 0.6.2 coming together so I can add that gate. Easy enough!

alto777 commented 6 years ago

The more I poked around with what I am trying to accomplish the more my head spins with the subtleties. I'm fortunate to be just clever enough to reverse engineer and hammer on other people's code to get what I need working… BTW I did find using your 7 segment thing to be straight ahead, although it involved dragging over a fair amount of stuff. I remain alarmed at how little one can know. I try not to break things and operate by pattern matching and eliminating compile-time errors, one by one.

/* BACON SEVEN SEGMENT... */

template < typename T >
struct BufferedDrawFunctionWidget : virtual FramebufferWidget
{...}

template <typename T, int px = 4>
struct SevenSegmentLight : T {...}

/* ...BACON SEVEN SEGMENT */

is all that is needed (collapsed look here) copy/pasted from several of your .cpp/.hpp files. I recall promising to understand it one day! I prolly won't be using it soon, but it will help expand my ignorance.

Meanwhile I found out partly what I want is a "slew limiter", which function is moslty glissinator-like with the big difference being that the rate of change in voltage is not dependent on the difference between target and current voltages, rather a fixed volts/sec. Befaco has one that I've patched in to my simulation, I think a mash-up "slewinator" will suffice. Don't hold your breath.

While I'm being chatty (!) I'll say listening for errors is quite different than looking for them (graphics stuff) or seeing them (quadcopters). It can be quite tiring!

Looking forward to your 0.6.2, hoping to re-release my stuff and new stuff soon also. I can't wait until they are perfect, cough.

a7

baconpaul commented 6 years ago

Right. So glissinator was constant time non constant slope. A slew limiter is constant slope Non constant time. It would be super easy to add a toggle...

The case I tested the most was the input turns around while still mid gliss which is why there’s a lot of stuff around where I am and where I’m going. And of cOurse the comments stink. The case you found is that the slider is moved and time undertakes a gliss. Not one I tested.

With 062 I have the standalone stuff so I can write tests at the command line. That’s how I got the ks working and also how I found the constants for the noise we discussed earlier. It is easy to use that to make gliss be testable and have a constant time and constant slope mode.

Thanks for the comments. I really appreciate them!

alto777 commented 6 years ago

OK, good. I don't mean to be a PITA. I certainly don't look forward hope a large community will find things o finterest and errors and improvments I can think about too, in my eclectic grab-bag - it's hard to stop having ideas and adding to the to-do list. i should do more looking around as I have already re-invented a wheel or two, or at least started before getting lazy and looking someone must have already done this. Almost always true…

baconpaul commented 6 years ago

PitA? Exact opposite! You’ve given me a load of great insights and ideas. Thanks so much!!

baconpaul commented 6 years ago

Hey OK so I actually looked at this and refactored it a bit so I could write a standalone test. Turns out you need two changes to deal with the case of shift_time changing underneath you. First as you point out you need >= but also you need to move the check to the start, not the end, of the step.

If you check out the latest candidate_v0.6.2 you'll see the code commented with what's happening. You'll also see that I moved Glissinator module into a .hpp file and templated it on its base class. This let me write a standalone C++ test which doesn't load any rack code at all but runs my step function. Some fun little template and subclass tricks there you may enjoy. I'll add a few more tests before 0.6.2 completes.

Thanks again

baconpaul commented 6 years ago

Just to close the loop on this, I put together a release_v0.6.2 branch which has this bug fix and also has a gate output on the glissinator (among a set of other features) and just submitted it to the community group for a build. So should be in your rack in a week or so. Thanks for the help.

alto777 commented 6 years ago

Or sooner. Nice work. BTW I didn't "recognize" you there on Rack/Rack*, the horizontal SVGSlider matter. These little successes are very motivating! I've just finished making some rectangular LEDs, haha, that after looking not too hard and not finding that it had been done already. I try to learn while getting the results I want - sometimes the results come before the learning, sometimes after.

*Did when I was puzzling about your little picture, looked familiar somehow but I had never read it as anything…

baconpaul commented 6 years ago

One thing I was thinking about which i didn’t do in 6.2 but may in 6.3 is writing a lambda parameterized drawing lamp. If you look at BufferedLambdaDrawThingy which I use in KarplusStrong, I now have a widget which means I can do

addChild( new BufferedLambdaThing( Vec( x, y ), Vec( w, h ),
                     [=](NVGcontext *vg)
                     {
                          NVGbeginStroke( vg ); // and whatever you want
                      }
                )

I was thinking of similarly doing LambdaDrawLight where you bind it as normal but hand it an extra lambda of signature LambdaDrawLight, NVGContecxt and then that’s what renders. Then I could do things like light up fonts and stuff like that (simulating plastic font with an LED behind it).

Maybe I’ve been programming in FP languages too long... but if that sounds useful let me know and I’ll tag this issue again if I end up adding the class.

alto777 commented 6 years ago

Now you're just showing off! :-)

baconpaul commented 6 years ago

The fix is now in your rack if you update plugins. Thanks for all your help!

alto777 commented 6 years ago

The plugin manager works well. It did happen to remove some experiments I'd done on a few of your modules, haha, but only the "make dist" thing. I still have the work. I have been trying to get better with git/github but I seem to have a mental block. Or a block head. Recently I had occasion to (try to) hack some Ruby code - I thought C++ was mysterious… looks powerful, perhaps in another lifetime.

Meanwhile my family (and the cat) are getting a bit annoyed at my protracted absences and the odd noises emanating from my laboratory.

Rack is eating my life and I am loving it.

alto777 commented 6 years ago

Spoke too soon. I looked at the (new) documentation and it seems it did not update me - I think becuase I never "purchased" it on the plugin manager OR it isn't up to date there, prolly the former. I'll check. Which means the other side-effect was no doubt the result of some misstep of mine whilst slinging plugin folders around. If I was my employee, I'd fire me - so disorganized.

baconpaul commented 6 years ago

If it helps, I have a copy of rack from the distribution I keep in Applications and that uses the plugin manager and I keep it separate from my dev area. With the release version I never screw with the plugins folder. then the update button just works and I can check the releases!

I never learned Ruby, although I know quite a few languages. C++ - especially C++11 and 14 extensions with a working STL - is a great language. C++ in 1992 was much less fun....

alto777 commented 6 years ago

Excellent advice. Now send me some discipline, cough. I did for a while have things fairly well under control, and although it is no excuse I can say it all sorta unraveled during the 0.5->0.6 excitement, which by my luck came just mebbe a 10 days after I discovered Rack…

baconpaul commented 6 years ago

Well if you want to build the 062 from source you should be able to do something like

Git fetch origin Git checkout release_v0.6.2

And get the latest greatest (presuming you didnb’t fork). I’m using the convention that

Candidate_vx.y.z is development and at release I merge it into master and branch it out to release_vx.y.z also