Sorry for putting this out without a more detailed explanation…
So, in a VCV Rack module I’m working on I try to collect the text of some neighbouring modules. This code seems to be working with VCV Core Notes and Submarine TD-316. But somehow it’s failing in case of Stochastic Telegraph Fermata. Knowing that my DEBUG_VAL variable never set to -0.444 I believe that there is an issue with the plug and/or the model name. But what? I just don’t get it.
@StochasticTelegraph am I missing something?
std::string readNeighbourText(int64_t& outId){
Module* left=getLeftExpander().module;
outId=-1;
if(!left||!left->model||!left->model->plugin) return "";
const std::string& plug =left->model->plugin->slug;
const std::string& model=left->model->slug;
if(plug=="Core"&&model=="Notes"){
DEBUG_VAL=-0.111;
rack::core::NotesModule* n=dynamic_cast<rack::core::NotesModule*>(left);
if(n){outId=n->id; return n->text;}
}
if(plug=="SubmarineFree"&&model=="TD-316"){
DEBUG_VAL=-0.316;
outId=left->id;
json_t* j=left->dataToJson();
std::string result;
if(j){json_t* tJ=json_object_get(j,"text");
if(tJ) result=json_string_value(tJ);
json_decref(j);}
return result;
}
if (plug == "StochasticTelegraph" && model == "Fermata") {
DEBUG_VAL=-0.444;
outId = left->id;
json_t* j = left->dataToJson();
std::string result;
if(j){json_t* tJ=json_object_get(j,"text");
if(tJ) result=json_string_value(tJ);
// if (tJ && json_is_string(tJ)) result = json_string_value(tJ);
json_decref(j);}
return result;
}
return "";
}
Further reference: plugin.json


