How to use Gen Exported code alongside other C++ code on Daisy (or other ) audio board

dan snazelle's icon

A long time ago before OOPSY someone made this tutorial for using Gen~ code within a C++ program alongside other code.

https://gist.github.com/tomoyanonymous/5954632487aa0853c203a5cc313cc8bd

I would like to be able to do this with the Daisy as I want to use the power of gen alongside other things Gen is not really designed for (non audio stuff, as well as audio things like FFT)--menus, housekeeping, etc.

Unless I am wrong Oopsy is meant more for using the code without too many additions or changes.

So the problem I am having is that this tutorial is very old. The AudioCallback on Daisy no longer takes **in and **out. when i exported code from gen using the message box-i get all the proper files. I got the code compiling without errors etc. But I am not getting any working audio. (just a loud constant pitch which the pod often does when things are not setup properly. none of the pots do anything.






I am stumped as to 1.

how to get my parameters from daisy connecting to the parameters in the gen exported file

(right now i have a paramter in my gen patch called freq and one called mod

So on the daisy I set it up like this


p_freq.Init(hw.knob1, 0, 2500, Parameter::LINEAR);

p_mod.Init(hw.knob2, 0, 127, Parameter::LINEAR);

freq = p_freq.Process();

mod = p_mod.Process();

simpleFM::setparameter(fm_instance,0,freq*200,nullptr);

simpleFM::setparameter(fm_instance,1,mod*100,nullptr);



and then 2. How to get audio in and out WHILE making it work with the t_sample ** type
normally everything is a float on the daisy for audio


for audio(since this is just an FM oscillator and i do not need any audio INPUT

i tried to do this within the callback


// Audio Loop

t_sample** out0 = (t_sample**)out[0];

simpleFM::perform(fm_instance,0,1,(t_sample **)out0,1,size);

for(size_t i = 0; i < size; i ++)

{

// out[0][i] = (float &&)out0;

}

}

thanks for any help getting the gen files to connect to the daisy audio callback and the parameters to connect to the daisy knobs..


Micah Lewis's icon

As for working with C++ and max simultaneously....It's almost been two years, and now I'm wondering the same thing. I've found a beta release that allows you to do this: https://forum.electro-smith.com/t/oopsy-update-prerelease-want-to-try-the-new-features-early/3456

But it looks like it never reached production. If you happened to find another workaround, I'd love to hear it! (Although the feedback seems pretty positive in the comments here! I'll have to mess around with it for myself I guess).

And there are some nice tutorials/examples that include using parameters in Gen and Daisy! (But this is from a while ago, so maybe I'm just misunderstanding the problem...) https://cycling74.com/tutorials/oopsy-daisy-%E2%80%94-an-introduction-part-2