Developing with gen~ & iPlug2

hello all,

first time posting & hope to start a wee discussion on finding a way to get this working in iPlug2

@olilarkin was really nice and past on some old iPlug1 code that had cycling74s gen~ working within it. ive done some chopping up & have been trying to get something working, but lo and behold, problems have popped up, thats fine

gen~ is a really nice piece of tech I feel would be a great addition & Oli has expressed interest in it as well, plus I feel that since FAUST is possible, why not gen~. having your visual coded effect to be used as a plugin is just a really great thing.
I have tried in JUCE, but damn, the documentation is terrible for it & out of date, plus JUCE is damn thorough with C++ and can get too much, so iPlug2 feels a much better path in the ling run


my troubles have started right away from not doing much of anything, just a simple duplication of the effect example, then having the gen~ code imported into the project & then trying to use the gen_exported.h, much like how FAUST is done.
except the gen~ code has pointers & the such going on. but trying the code from the original iPlug build, it starts borking out & im trying to figure that out. bear in mind im not a C++ whiz like many, still learning the current iPlug2 as well

and here is my working out, it is named the same & uses the same .maxpat

the started problem is using the pointer from the gen setup in iPlugGen.h, which is then being setup in iPlugGen.cpp
gen = (CommonState *)create(44100., DEFAULT_BLOCK_SIZE);

anyhow. hope someone can point me in the correct direction & even we could work a good method for this out



since im a new user, it wouldn’t allow me to post up more than 1 link

so here is original iPlug gen~ example on GitHub, comes with the .maxpat



silly me, I did forget the namespace. so did get slightly a better response, but still working this out

Ah - missed this last reply after taking a look at this…

First step is to makes sure you include gen_exported:: on the function calls.
Next you need to compile genlibs.cpp/json.c/json_builder.c so that it links.

That gets me to a point of building with your repo.

1 Like

thanks for that @AlexHarker ive been trying to fugure it out, but im lost on the compile json_builder.c. ive looked, but have not found info on it. cycling74 docs are, I found, lacking somewhat

thanks again

The files you need to build are all in the gen_dsp folder which has been added to the Xcode project, although you can’t directly add files from a folder reference in Xcode - they need to be from a group.

You need to add those files to each target you want to build (and similarly on windows) otherwise the build won’t link as there will be missing symbols.

1 Like

kisses to you @AlexHarker - a bit of faffing around it worked & will have a play & then post up the results, also update the GitHub repo with a proper working copy

again, thanks xxx

1 Like

ok. im getting close, thanks @AlexHarker
but after following some of the original iPlugGen project, I am getting errors & it crashes after trying to get UI in at any point from the originals code.
so, reaching out again after trying for a while & seeing how this could be implemented. trying to figure out how to access the separate controls.
thesis just using the APP part. nit tried with anything else just yet, just making sure it works on 1 thing first

it get sounds, grainy sound, but it does work in that respect. beware of feedback if you try it yourself. I have even edited the .maxpat gen~ to make sure it was going thru it to iPlug & it did, which is nice the link is near done

ive updated my GitHub repo with the changes

Are there any specific things to look at in the GUI?

currently its crashing at the moment I add in the for loop, or more so when I get things in the for loop in the setup trying to grab the params of the exported gen file

for the UI, I was looking at setparameter in the gen~ file. but also making sure I look at AttachController, though did have some code I seemed to have gotten rid of that im trying to remember I typed

kNumParams is currently 3 but your gen code has 4 parameters. That is likely your crash. I can run the following code in the constructor if I pass the correct number of parameters when constructing the plugin (I am passing num_params() rather than kNumParams).

for (int i = 0; i< num_params(); i++) {
    ParamInfo* p = gen->params+i;
    GetParam(i)->InitDouble(p->name, p->defaultvalue, p->outputmin, p->outputmax, 0.00001, p->units);

Also you are currently calling perform once per sample * once per channel.

You only need to call perform once in ProcessBlock() as perform processes blocks of samples in multiple channels. You can remove both of the loops in this method.

1 Like

ah aye, the for loops, whoops silly me that slipped by.
thats the grainy sound dealt with. checking out the change of the kNumParams & no crash anymore

: Plugin(info, MakeConfig(num_params(), kNumPresets)){

sorted the params in the .h with the extra setting as well, just to make sure.
that has fixed things when doing the load, which is closer to getting this done, phew hahaha. did get a very brief bit of control on, so now working that out
feels like it getting close now. so now its working on accessing all the controls easily. getting close :+1:

thanks again for the help @AlexHarker

ok. now there is a full working flanger example for app working

I do plan to solve/fix the VST/AU version, since that is my personal goal. but this is a great start. only tested in macOS, no idea about windows

but if anyone has ideas, please do share :black_heart:

also thanks goes to @AlexHarker for their help & patience :black_heart:

VST3 working

AUv3 is still not currently building, & getting a Command Rez failed with a nonzero exit code message for AUv2, its pointing to IPlugAU.r

ok. now I wanna build rom this a wee bit more. I was thinking of different support in terms of getting this to work on VST, which was done via VST3 [no point in doing VST2 since that needs an account, plus no point in the end]
but trying to do AUv2 & AUv3 have proved somewhat troublesome & errors are popping up, though I am doing the same setup for VST3. having .cpp files in the compile section

anyhow. there are many errors popping up, stating that it hasn’t got certain functions. so just trying to get these squashed, but am asking if anyone else may have a problem or fix

though this isnt just the only errors, these were after putting in .cpp fils into the compile

the repo has been updated with my current finding & play arounds, this is in xcode, so no windows


ok. I solved in AUv2 problem, so that builds, which is great. the AUv3 is still very much buggy, but will work thru that another time. happy to at least get VST3 & AUv2 working :+1:

I am still working on AUv3 macOS support in iPlug2. On iOS it is working well but there are still some issues with macOS, some of which I’ve addressed very recently, and would require re-duplicating a template project

good to know. I thought the AUv3 on macOS looked less on the compile side hahaha
Though it’s nice the iOS version is working

Thank you for the hard work :+1: