C++ Global Cables: How to manage multiple cables?
-
How did you intend multiple CGs to be managed in scriptnode?
I am causing nothing but errors now that I am trying to incorporate multiple cables. I really don't understand the instructions.// GlobalCables.h #pragma once namespace project { // Use this enum to refer to the cables enum class GlobalCables { GC1 = 0, GC2 = 1 }; // Define separate cable managers for each node using cable_manager_t_one = routing::global_cable_cpp_manager<SN_GLOBAL_CABLE(70357)>; using cable_manager_t_two = routing::global_cable_cpp_manager<SN_GLOBAL_CABLE(70358)>; }
^ I made this header file which I assumed I'd be able to inherit nodes from, but it complains heavily.
#pragma once #include <JuceHeader.h> #include "src/GlobalCables.h" namespace project { using namespace juce; using namespace hise; using namespace scriptnode; template <int NV> struct Lufs_Out_One : public data::base, public global_cable_cpp_manager<SN_GLOBAL_CABLE(GlobalCables::GC1)> { SNEX_NODE(Lufs_Out_One); struct MetadataClass { SN_NODE_ID("Lufs_Out_One"); }; // and then stuff like this: this->setGlobalCableValue<GlobalCables::GC1>(0.0);
This kind of thing does not work whatsoever! What's the intended method? I've been through 4 different methods and I cannot think what was intended with this.
@Christoph-Hart , Thanks.
-
-
@griffinboy said in C++ Global Cables: How to manage multiple cables?:
// Define separate cable managers for each node
Why? It will use variadic templates for building a single base class with all global cables.
-
So, writing nodes for scriptnode is the first c++ I've ever done.
Ontop of that, my understanding of the scriptnode compiler is shaky. I have yet to properly look at how it all comes together in the end. My knowledge is full of holes.This was an attempt to resolve errors which I did not know the cause of. My scripts would always trigger errors in places outside of the script I was working on, and my troubleshooting let me on this wild goose chase all day.
-
Yeah C++ is a beast when you start out and the fact that I'm relying heavily on templates with the scriptnode API is not very helpful for a beginner because it often obfuscates the compile errors.
Now I think you're error here is coming from the line where you subclass your node:
public global_cable_cpp_manager<SN_GLOBAL_CABLE(GlobalCables::GC1)>
just use
public cable_manager_t_one
instead (or the one with both cables that is generated from HISE).
-
Thanks I took a proper look and I was just misunderstanding it.
The instructions tell you exactly what to do.
I think I fell into a trap because I coded up my nodes when i only had one global cable.
When you ask Hise for the GC C++ code for more than one cable, it becomes clearer how it's working.
// Use this enum to refer to the cables, eg. this->setGlobalCableValue<GlobalCables::GC1>(0.4) enum class GlobalCables { GC1 = 0, GC2 = 1 }; // Subclass your node from this using cable_manager_t = routing::global_cable_cpp_manager<SN_GLOBAL_CABLE(70357), SN_GLOBAL_CABLE(70358)>;
-
-
-