nevermind, got it (i think) render.cpp compiles and runs. i took the midi messages that i need for lv2host from the heavy midi switch statements. i will just have to make sure i still run those when i switch to the lv2host part.
my heavy patch is up and running. but... the sound is distorted even though i have not changed anything in render() yet (apart from writing a few variables for midi communication)
distorted as in "samplerate reduced" or louder and clipping, it is actually hard to say...i don't get any underruns though...
i just included the longRender(), the longThread() and in setup i have included this:
int fifoFactor = 8; // 16 to 128
/* if(!gBcf.setup((BelaContext*)&context, fifoFactor))
{
fprintf(stderr, "Error: unable to initialise BelaContextFifo\n");
return false;
} */
longThreadTask = Bela_createAuxiliaryTask(longThread, 94, "long-thread", NULL);
gBlockDurationMs = context->audioFrames * fifoFactor / context->audioSampleRate * 1000;
//long thread setup (lv2host)
/* midi_lv2.readFrom(gMidiPort0);
midi_lv2.writeTo(gMidiPort0);
midi_lv2.enableParser(true);
midi_lv2.setParserCallback(midiMessageCallback, (void*) gMidiPort0); */
// these should be initialized by Bela_userSettings above
if((context->flags & BELA_FLAG_INTERLEAVED) || context->audioSampleRate != context->analogSampleRate)
{
fprintf(stderr, "Using Lv2Host requires non-interleaved buffers and uniform sample rate\n");
return false;
}
if(!gLv2Host.setup(context->audioSampleRate, context->audioFrames,
context->audioInChannels, context->audioOutChannels))
{
fprintf(stderr, "Unable to create Lv2 host\n");
return false;
}
std::vector<std::string> lv2Chain;
lv2Chain.emplace_back("http://gareus.org/oss/lv2/fat1");
lv2Chain.emplace_back("http://guitarix.sourceforge.net/plugins/gx_oc_2_#_oc_2_");
lv2Chain.emplace_back("http://plugin.org.uk/swh-plugins/combSplitter");
lv2Chain.emplace_back("http://ssj71.github.io/infamousPlugins/plugs.html#powercut");
lv2Chain.emplace_back("http://calf.sourceforge.net/plugins/Compressor");
lv2Chain.emplace_back("http://guitarix.sourceforge.net/plugins/gx_echo_stereo#_echo_stereo");
lv2Chain.emplace_back("http://guitarix.sourceforge.net/plugins/gx_reverb_stereo#_reverb_stereo");
for(auto &name : lv2Chain)
{
gLv2Host.add(name);
}
if(0 == gLv2Host.count())
{
fprintf(stderr, "No plugins were successfully instantiated\n");
return false;
}
if(context->analogFrames)
gAudioFramesPerAnalogFrame = context->audioFrames / context->analogFrames;
//autotune
gLv2Host.setPort(0, 6, 0.5);
gLv2Host.setPort(0, 7, 0.02);
// gLv2Host.setPort(0, 9, 24);
gLv2Host.setPort(0, 11, 1); //fastmode
gLv2Host.setPort(0, 12, 1); //c
gLv2Host.setPort(0, 13, 0);
gLv2Host.setPort(0, 14, 0);
gLv2Host.setPort(0, 15, 1);
gLv2Host.setPort(0, 16, 0);
gLv2Host.setPort(0, 17, 1);
gLv2Host.setPort(0, 18, 0);
gLv2Host.setPort(0, 19, 1);
gLv2Host.setPort(0, 20, 0);
gLv2Host.setPort(0, 21, 0);
gLv2Host.setPort(0, 22, 1);
gLv2Host.setPort(0, 23, 0);
// Compressor
gLv2Host.setPort(4, 4, 0); // Bypass
gLv2Host.setPort(4, 5, 1); // Input
gLv2Host.setPort(4, 10, 0.125); // Threshold
gLv2Host.setPort(4, 11, 6); // Ratio
gLv2Host.setPort(4, 12, 1); // Attack
gLv2Host.setPort(4, 13, 40); // Release
gLv2Host.setPort(4, 14, 2); // Makeup Gain
gLv2Host.setPort(4, 15, 2.9); // Knee
gLv2Host.setPort(4, 16, 0); // Detection
gLv2Host.setPort(4, 17, 1); // Stereo Link
gLv2Host.setPort(4, 19, 1); // Mix
// octaver off by default
gLv2Host.setPort(1, 3, 0);
gLv2Host.setPort(1, 4, 0);
//comb splitter
gLv2Host.setPort(2, 0, 600);
//powercut
gLv2Host.setPort(3, 3, 4);
gLv2Host.setPort(3, 4, 0);
//echo
//gLv2Host.setPort(5, 0, 1);
gLv2Host.setPort(5, 2, 78);
gLv2Host.setPort(5, 4, 82);
gLv2Host.setPort(5, 1, 0);
gLv2Host.setPort(5, 3, 0);
//_reverb
gLv2Host.setPort(6, 0, 40);
gLv2Host.setPort(6, 3, 0.1);
// scope.setup(4, context->audioSampleRate);
// Turn LED on
pinMode(context, 0, gLedPin, OUTPUT); // Set pin as output
digitalWrite(context, 0, gLedPin, 1); //Turn LED on
note the fifofactor = 8, since i switched to 128 blocksize...
does this part (that i also included from lv2host render) mess heavy up?
void Bela_userSettings(BelaInitSettings *settings)
{
settings->uniformSampleRate = 1;
settings->interleave = 0;
settings->analogOutputsPersist = 0;
}