HISE Logo Forum
    • Categories
    • Register
    • Login

    Crash when creating global mod sources using the Builder

    Scheduled Pinned Locked Moved Solved Bug Reports
    4 Posts 2 Posters 57 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.
    • OrvillainO
      Orvillain
      last edited by

      Content.makeFrontInterface(600, 600);
      reg builder = Synth.createBuilder();
      
      inline function createGlobalModulationSources()
      {
      	local modmatrix_idx = builder.create(builder.SoundGenerators.GlobalModulatorContainer,
      								"Global Mod Container",
      								0,
      								builder.ChainIndexes.Direct);
      
      	local globalModulatorsChainIndex = 1;
      	builder.create(builder.Modulators.Velocity,
      						"Velocity",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      	
      	builder.create(builder.Modulators.KeyNumber,
      						"Key Number",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      	
      	builder.create(builder.Modulators.FlexAHDSR,
      						"Env 1",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.FlexAHDSR,
      						"Env 2",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.FlexAHDSR,
      						"Env 3",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.MacroModulator,
      						"Macro 1",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.MacroModulator,
      						"Macro 2",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.MacroModulator,
      						"Macro 3",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.MacroModulator,
      						"Macro 4",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.Random,
      						"Random",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.PitchWheel,
      						"Pitch Wheel",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.MidiController,
      						"Mod Wheel",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.MidiController,
      						"Midi CC 1",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.MidiController,
      						"Midi CC 2",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.MidiController,
      						"Midi CC 3",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.HardcodedEnvelopeModulator,
      						"Custom LFO 1",
      						modmatrix_idx,
      						globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.HardcodedEnvelopeModulator,
      	 					"Custom LFO 2",
      	 					modmatrix_idx,
      	 					globalModulatorsChainIndex);
      
      	builder.create(builder.Modulators.HardcodedEnvelopeModulator,
      	 					"Custom LFO 3",
      	 					modmatrix_idx,
      	 					globalModulatorsChainIndex);
      };
      
      builder.clear();
      createGlobalModulationSources();
      builder.flush();
      

      If I do the above, then HISE will crash every single time.

      If I remove the last two custom LFO's (or just comment them out) then it does not crash.

      My extra definitions are:

      HISE_NUM_SCRIPTNODE_FX_MODS=24
      HISE_NUM_POLYPHONIC_SCRIPTNODE_FX_MODS=24
      NUM_HARDCODED_FX_MODS=24
      NUM_HARDCODED_POLY_FX_MODS=24
      

      If I run a debug build I get the following pop-up in VS2022:
      18776327-b9c4-4d09-bbd8-3a7165ee1ba2-image.png

      And I basically get locked in this cycle:
      033ba488-6299-4285-8a07-ba2083822d82-image.png

      Given it is saying that an array subscript is out of range, I can only assume that either I'm reading out of the range of an array, or that the definitions aren't being honoured in some way. A hardcoded limit on the number of modulators perhaps??

      If I comment out everything except the 3 'Custom LFO' creation steps, then it still crashes... this implies that the crash is something to do with creating multiple HardcodedEnvelopeModulator objects.

      @Christoph-Hart

      Musician - Instrument Designer - Sonic Architect - Creative Product Owner
      Crafting sound at every level. From strings to signal paths, samples to systems.

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

        @Orvillain said in Crash when creating global mod sources using the Builder:

        HISE_NUM_SCRIPTNODE_FX_MODS=24

        16 is the current maximum, if you want to use more, you need to change this constant:

        Link Preview Image
        HISE/hi_dsp_library/node_api/helpers/modulation.h at 1d6a4d0e43ac6fbcf2bf7c0e53683657697f4370 · christophhart/HISE

        The open source framework for sample based instruments - HISE/hi_dsp_library/node_api/helpers/modulation.h at 1d6a4d0e43ac6fbcf2bf7c0e53683657697f4370 · christophhart/HISE

        favicon

        GitHub (github.com)

        It will also require you to recompile HISE / all DLL networks as this will change the generated C++ code for networks.

        But then again, do you really need 24 modulation slots or is it still not working with gaps in the parameter definition? I'd rather fix that so that you can get away with 16 ones because the other way feels like throwing "money" (aka CPU cycles / memory) on a problem to make it go away.

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

          oh wait a minute, actually it should support more than 16 modulation sources, let me check that.

          OrvillainO 1 Reply Last reply Reply Quote 1
          • OrvillainO
            Orvillain @Christoph Hart
            last edited by

            @Christoph-Hart Yep, this is fixed now. Thanks Christoph!

            Musician - Instrument Designer - Sonic Architect - Creative Product Owner
            Crafting sound at every level. From strings to signal paths, samples to systems.

            1 Reply Last reply Reply Quote 0
            • OrvillainO Orvillain marked this topic as a question
            • OrvillainO Orvillain has marked this topic as solved
            • First post
              Last post

            29

            Online

            1.9k

            Users

            12.2k

            Topics

            106.6k

            Posts