HISE Logo Forum
    • Categories
    • Register
    • Login

    Compiling C++ nodes and Scriptnode Networks

    Scheduled Pinned Locked Moved Solved Bug Reports
    7 Posts 3 Posters 147 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • HISEnbergH
      HISEnberg
      last edited by

      @Christoph-Hart I opened a Github Issue about this but is there anyway to change the FX compiler to automatically compile C++ nodes first, and then Scriptnode networks?

      Currently, whenever I go to compile my fx again, I have to turn off the compilation on the Scriptnode networks, compile the C++ and wait for the compiler to finish. Then I need to go back into the networks, set them to compile and go through the whole process again.

      DanHD 1 Reply Last reply Reply Quote 0
      • DanHD
        DanH @HISEnberg
        last edited by

        @HISEnberg yeah I've found this too. There was one network that seemed buggy, and when I figured out which one it was I rebuilt it and it's been ok ever since.

        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
        https://dhplugins.com/ | https://dcbreaks.com/
        London, UK

        Christoph HartC 1 Reply Last reply Reply Quote 0
        • Christoph HartC
          Christoph Hart @DanH
          last edited by

          Can you make a example project that requires this? Usually if you trash the dll before rebuilding it should always work - if a scriptnode network requires a C++ node that isn't compiled yet it will use a placeholder during the compilation process, but if there is an old DLL hanging around, this might cause issues.

          TLDR: Does the problem persist if you delete the entire DspNetwork/Binaries folder before a clean rebuild?

          DanHD HISEnbergH 2 Replies Last reply Reply Quote 2
          • DanHD
            DanH @Christoph Hart
            last edited by

            @Christoph-Hart I still have the network and probably a time machine backup of the whole project before I rebuilt that network so will try and cobble something together. Pretty certain I deleted either the dll or the whole binaries folder but will try with and without.

            Perhaps a good idea to auto move the dll during the compile process and then put back if it fails?

            DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
            https://dhplugins.com/ | https://dcbreaks.com/
            London, UK

            1 Reply Last reply Reply Quote 0
            • HISEnbergH
              HISEnberg @Christoph Hart
              last edited by HISEnberg

              @Christoph-Hart

              I tried deleting the Binaries folder before rebuilding on my Windows machine and I get errors like the following:

              > Create files
              > Sorting include dependencies
              > Creating C++ file for Network ScriptnodeNetwork
              > Copying third party files
              > Compiling dll plugin
              Re-saving file: C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\AutogeneratedProject.jucer
              Finished saving: Visual Studio 2022
              Finished saving: Xcode (macOS)
              Finished saving: Linux Makefile
              Compiling 64bit  Example ...
              MSBuild version 17.13.19+0d9f5a35a for .NET Framework
              
                Main.cpp
                RNBO.cpp
                include_hi_dsp_library_01.cpp
                include_hi_dsp_library_02.cpp
                include_hi_tools_01.cpp
                include_hi_tools_02.cpp
                include_hi_tools_03.cpp
                include_juce_audio_basics.cpp
                include_juce_audio_formats.cpp
                include_juce_core.cpp
                include_juce_data_structures.cpp
              !C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Source\ScriptnodeNetwork.h(23,73): error C3203: 'myCPlusNode': unspecialized class template can't be used as a template argument for template parameter 'T', expected a real type [C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Builds\VisualStudio2022\Example_DynamicLibrary.vcxproj]
                include_juce_dsp.cpp
                (compiling source file '../../Source/Main.cpp')
                
              !C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Source\ScriptnodeNetwork.h(24,69): error C3203: 'myCPlusNode': unspecialized class template can't be used as a template argument for template parameter 'T', expected a real type [C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Builds\VisualStudio2022\Example_DynamicLibrary.vcxproj]
                (compiling source file '../../Source/Main.cpp')
                
              !C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\processors.h(252,2): error C2825: 'T': must be a class or namespace when followed by '::' [C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Builds\VisualStudio2022\Example_DynamicLibrary.vcxproj]
                (compiling source file '../../Source/Main.cpp')
                    C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\processors.h(252,2):
                    the template instantiation context (the oldest one first) is
                        C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Source\ScriptnodeNetwork.h(28,49):
                        see reference to class template instantiation 'scriptnode::container::chain<scriptnode::parameter::plain<int,0>,scriptnode::wrap::fix<2,int>>' being compiled
                        C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\Container_Chain.h(170,78):
                        see reference to class template instantiation 'scriptnode::container::container_base<ParameterClass,scriptnode::wrap::fix<2,int>>' being compiled
                            ParameterClass=scriptnode::parameter::plain<int,0>
                        C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\Containers.h(137,28):
                        see reference to class template instantiation 'std::tuple<scriptnode::wrap::fix<2,int>>' being compiled
                        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\tuple(823,23):
                        see reference to class template instantiation 'std::_Tuple_val<_This>' being compiled
                            _This=scriptnode::wrap::fix<2,int>
                        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\tuple(151,9):
                        see reference to class template instantiation 'scriptnode::wrap::fix<2,int>' being compiled
              !C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\processors.h(252,2): error C2510: 'T': left of '::' must be a class/struct/union [C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Builds\VisualStudio2022\Example_DynamicLibrary.vcxproj]
                (compiling source file '../../Source/Main.cpp')
                
              !C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\processors.h(252,2): error C2061: syntax error: identifier 'ObjectType' [C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Builds\VisualStudio2022\Example_DynamicLibrary.vcxproj]
                (compiling source file '../../Source/Main.cpp')
                
              !C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\processors.h(252,2): error C2061: syntax error: identifier 'WrappedObjectType' [C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Builds\VisualStudio2022\Example_DynamicLibrary.vcxproj]
                (compiling source file '../../Source/Main.cpp')
                
              !C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\processors.h(252,2): error C7683: you cannot create a reference to 'void' [C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Builds\VisualStudio2022\Example_DynamicLibrary.vcxproj]
                (compiling source file '../../Source/Main.cpp')
                    C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\processors.h(252,2):
                    the template instantiation context (the oldest one first) is
                        C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Source\ScriptnodeNetwork.h(59,29):
                        see reference to function template instantiation 'auto &scriptnode::container::container_base<ParameterClass,scriptnode::wrap::fix<2,int>>::get<0>(void) noexcept' being compiled
                        with
                        [
                            ParameterClass=scriptnode::parameter::plain<int,0>
                        ]
                        C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Source\ScriptnodeNetwork.h(28,49):
                        see reference to class template instantiation 'scriptnode::container::chain<scriptnode::parameter::plain<int,0>,scriptnode::wrap::fix<2,int>>' being compiled
                        C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\Container_Chain.h(170,78):
                        see reference to class template instantiation 'scriptnode::container::container_base<ParameterClass,scriptnode::wrap::fix<2,int>>' being compiled
                        with
                        [
                            ParameterClass=scriptnode::parameter::plain<int,0>
                        ]
                        C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\Containers.h(137,28):
                        see reference to class template instantiation 'std::tuple<scriptnode::wrap::fix<2,int>>' being compiled
                        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\tuple(823,23):
                        see reference to class template instantiation 'std::_Tuple_val<_This>' being compiled
                        with
                        [
                            _This=scriptnode::wrap::fix<2,int>
                        ]
                        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\tuple(151,9):
                        see reference to class template instantiation 'scriptnode::wrap::fix<2,int>' being compiled
                        C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\processors.h(252,2):
                        while compiling class template member function 'auto &scriptnode::wrap::fix<2,int>::getObject(void)'
                            C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\Containers.h(100,85):
                            see the first reference to 'scriptnode::wrap::fix<2,int>::getObject' in 'scriptnode::container::container_base<ParameterClass,scriptnode::wrap::fix<2,int>>::get'
                        with
                        [
                            ParameterClass=scriptnode::parameter::plain<int,0>
                        ]
                
              !C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\processors.h(252,2): error C3313: 'return expression': variable cannot have the type 'auto &' [C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Builds\VisualStudio2022\Example_DynamicLibrary.vcxproj]
                (compiling source file '../../Source/Main.cpp')
                
              !C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\Containers.h(100,94): error C2440: 'return': cannot convert from 'int' to 'int &' [C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Builds\VisualStudio2022\Example_DynamicLibrary.vcxproj]
                (compiling source file '../../Source/Main.cpp')
                
              !C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\Containers.h(100,98): error C7683: you cannot create a reference to 'void' [C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Builds\VisualStudio2022\Example_DynamicLibrary.vcxproj]
                include_juce_events.cpp
                (compiling source file '../../Source/Main.cpp')
                
              !C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\Containers.h(100,98): error C3313: 'return expression': variable cannot have the type 'auto &' [C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Builds\VisualStudio2022\Example_DynamicLibrary.vcxproj]
                (compiling source file '../../Source/Main.cpp')
                
              !C:\Users\mikez\Documents\GitHub\HISE\hi_dsp_library\node_api\nodes\Containers.h(100,98): error C3487: 'int': all return expressions must deduce to the same type: previously it was 'int &' [C:\Users\mikez\Desktop\HiseProjects\Personal\Example\DspNetworks\Binaries\Builds\VisualStudio2022\Example_DynamicLibrary.vcxproj]
                (compiling source file '../../Source/Main.cpp')
                include_juce_graphics.cpp
              
              

              Just to reiterate, it will work fine if I compile the C++ node first, then compile the C++ node and the Scriptnode network.
              This is an example, it is literally just the autogenerated C++ template embedded into a Scriptnode Network.

              HiseSnippet 1065.3ocuVs0aaaCElxNJswqEXEa6c+n6PPfkiSbG1Cqw21L1riPUVPeqfghtl0TjBRTIQaXuueV6mz9GrcnnjkThSSgwVsALz4l324x2g1MRRnwwxHjUqKRCoHqmY6kJTqFsByDnYiQVGXO4VbPHmhFlFhiio9HKql+n1r0A6gx972+vPLGKHzRUHzkRFg9Kr.lpTq6q+YFmOE6SufETw69udFQJFI4xD.JMs6hBwj032SWf0t0vF8S33UHqu0l3eUui86S50m9cGSW1+UCb5MXoSuSFzuG9z98AazAmh6gr1ehOSIi7TXEMFYs2Poep2J4MByAbIKlcEjUffCxCNYi5oRtuNE0ZQiVw39tE0nXD7VbKqXMMUru1dNymsQeYk6KyLztLhpEPqF0gWyZvyoJ75VAdaARVUfzdFH8BaORDKTUZQimuvdlPQiVhI06kFeQV+k8HI3fPcT.dMcZDHrIfNm1s6gsged42uLQPTLonsTrPpnmK57xV+dqCZ8GsZeWSKWtUa5iIRx4znsZVOZD8wBriHI3JZzgsuFySnabDR+50T6GtlVskSLYcEGkhYBl57Pp3gFDP4kJ3oec1XrBqaD45.+BoQJlFBVioWCz.Sa4.6wz30JYHPDtWOClVj9Ibrp9Hjlnka.pA05a5liHloRqRD+Oat5SEhuv1koHq1NFarELBUp+OvXNa741SVtjRTk.bO6ou8yG0qUN0CNS8g+rbw1SeqyVIc+oc4.dXDMDGQuP5xwochy159F.iG19Jtjr1i8az6yJBMPXn1iNjUXgfxi2Exy9exUEmOdS4MxDES794XUD6VfEtHIvC1qSnixQGnypglCYj6pk0yEdTgelv+.exM5nksxM5TXrB8aAUciLZcV6H+Yj0S009uJu1Kj9zBKmw4xaFICBY4CqlbiFEmI7D6tGAeMt4J4ogqjBFQ2vLAUjCmEHSfiOOQJG9GVznJxI3dqKvLtlK3kDCaT7OW3AumrKKgYQqE.5fCdJl.E+TWrZklSo2IACvzniHaFj2V9TNRoaFlaK2le5FoKNBrCKziMYs9jKtx0.VHGCzUU8EtVM01Mk0LHtuFCO2NHcjKOINSWMP+M1vn3G.p2QUcYa.r9K4QfQiJvVy3Jj.mmyDWpGhgG08Mzb7sajc.YCfmmVFyX5RbBWUIpSPmknjAvLewk9UVeCBOzgmUMdhcnVC5w.xjagXDXdkkjvhhwrXLvn7uCpfjN+o8gWV+dlKVDzLdbLplH3st7My+tE0MH0XpZMnVBlsBSKAKnaXVXMK9RsUBlWfCXFemtj6ywhf.LIR9NhY2lNgdZlFnWJxl0NvdtVtsC5ZSxTdMT.7uydGgT+Ucu.6sqAd7tFX+cMvS10.OcWCbvtF3qd7.0+44btodRG1x5NIaHzxZhvPbfEnn+UsVJoq
              

              The C++ Node:

              // ==================================| Third Party Node Template |==================================
              
              #pragma once
              #include <JuceHeader.h>
              
              namespace project
              {
              using namespace juce;
              using namespace hise;
              using namespace scriptnode;
              
              // ==========================| The node class with all required callbacks |==========================
              
              template <int NV> struct myCPlusNode: public data::base
              {
              	// Metadata Definitions ------------------------------------------------------------------------
              	
              	SNEX_NODE(myCPlusNode);
              	
              	struct MetadataClass
              	{
              		SN_NODE_ID("myCPlusNode");
              	};
              	
              	// set to true if you want this node to have a modulation dragger
              	static constexpr bool isModNode() { return false; };
              	static constexpr bool isPolyphonic() { return NV > 1; };
              	// set to true if your node produces a tail
              	static constexpr bool hasTail() { return false; };
              	// set to true if your doesn't generate sound from silence and can be suspended when the input signal is silent
              	static constexpr bool isSuspendedOnSilence() { return false; };
              	// Undefine this method if you want a dynamic channel count
              	static constexpr int getFixChannelAmount() { return 2; };
              	
              	// Define the amount and types of external data slots you want to use
              	static constexpr int NumTables = 0;
              	static constexpr int NumSliderPacks = 0;
              	static constexpr int NumAudioFiles = 0;
              	static constexpr int NumFilters = 0;
              	static constexpr int NumDisplayBuffers = 0;
              	
              	// Scriptnode Callbacks ------------------------------------------------------------------------
              	
              	void prepare(PrepareSpecs specs)
              	{
              		
              	}
              	
              	void reset()
              	{
              		
              	}
              	
              	void handleHiseEvent(HiseEvent& e)
              	{
              		
              	}
              	
              	template <typename T> void process(T& data)
              	{
              		
              		static constexpr int NumChannels = getFixChannelAmount();
              		// Cast the dynamic channel data to a fixed channel amount
              		auto& fixData = data.template as<ProcessData<NumChannels>>();
              		
              		// Create a FrameProcessor object
              		auto fd = fixData.toFrameData();
              		
              		while(fd.next())
              		{
              			// Forward to frame processing
              			processFrame(fd.toSpan());
              		}
              		
              	}
              	
              	template <typename T> void processFrame(T& data)
              	{
              		
              	}
              	
              	int handleModulation(double& value)
              	{
              		
              		return 0;
              		
              	}
              	
              	void setExternalData(const ExternalData& data, int index)
              	{
              		
              	}
              	// Parameter Functions -------------------------------------------------------------------------
              	
              	template <int P> void setParameter(double v)
              	{
              		if (P == 0)
              		{
              			// This will be executed for MyParameter (see below)
              			jassertfalse;
              		}
              		
              	}
              	
              	void createParameters(ParameterDataList& data)
              	{
              		{
              			// Create a parameter like this
              			parameter::data p("MyParameter", { 0.0, 1.0 });
              			// The template parameter (<0>) will be forwarded to setParameter<P>()
              			registerCallback<0>(p);
              			p.setDefaultValue(0.5);
              			data.add(std::move(p));
              		}
              	}
              };
              }
              
              

              Just so you know this is HISE 4.1.0
              Github commit hash (August 14): https://github.com/christophhart/HISE/commit/edf70c1ad20e77df7615feb44e17f7bb9a248a81

              Christoph HartC 1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart @HISEnberg
                last edited by

                @HISEnberg have you setup the node_properties.json correctly? Looks like it can't deduce whether the uncompiled nodes are polyphonic.

                HISEnbergH 1 Reply Last reply Reply Quote 0
                • HISEnbergH
                  HISEnberg @Christoph Hart
                  last edited by

                  @Christoph-Hart Thanks for clarifying, that was my mistake. So deleting the Binaries does indeed work!!!

                  1 Reply Last reply Reply Quote 0
                  • HISEnbergH HISEnberg has marked this topic as solved
                  • First post
                    Last post

                  26

                  Online

                  1.9k

                  Users

                  12.5k

                  Topics

                  108.8k

                  Posts