HISE Logo Forum
    • Categories
    • Register
    • Login

    HISE receiving midi CC causes crash.

    Scheduled Pinned Locked Moved Bug Reports
    4 Posts 2 Posters 933 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.
    • E
      elanhickler
      last edited by

      Windows 10 x64 / HISE VST 0.98 x64 / REAPER x64

      STR (Steps to reproduce):
      create new instance of HISE VST in reaper,
      load the master chain preset below
      send midi CC1 via midi item in reaper

      
       <processor type="SynthChain" id="Master Chain" bypassed="0" gain="0.25" balance="0" voicelimit="64" killfadetime="20" iconcolour="0" packagename="" views="32.rk1bzA....v+++++7++++a....f.....f....DD...." currentview="-1"><editorstates bodyshown="1" visible="1" solo="0" folded="0"><childprocessors><processor type="MidiProcessorChain" id="Midi Processor" bypassed="0">
            <editorstates bodyshown="1" visible="1" solo="0" folded="0"><childprocessors><processor type="ScriptProcessor" id="KeyColorCCChanger" bypassed="0" script="// [onInit]
      // ===============
      // onInit Callback
      
      var loKey = 36;
      var hiKey = 79;
      
      var ccValue = 0;
      
      function changeKeyColor(colorAsHex)
      {
      	for(var i = loKey; i < hiKey; i++)
      	{
      		Engine.setKeyColour(i, colorAsHex);
      	}
      };
      
      Synth.deferCallbacks(true);
      // [/onInit]
      
      // [onNoteOn]
      // =================
      // onNoteOn Callback
      
      function onNoteOn()
      {
      
      }
      // [/onNoteOn]
      
      // [onNoteOff]
      // ==================
      // onNoteOff Callback
      
      function onNoteOff()
      {
      
      }
      // [/onNoteOff]
      
      // [onController]
      // =====================
      // onController Callback
      
      function onController()
      {
      	if(Message.getControllerNumber() != 1)
      	{
      		return;
      	}
      
      	for(var i = 0; i < 5000; i++)
      	{
      	    var y = Math.sin(4.0);	
      	}
      
      	ccValue = Message.getControllerValue();
      
      	if(ccValue < 127/3)
      	{
      		changeKeyColor(0xFF00FF00);
      	}
      	else if (ccValue >= 127/3 &amp;&amp; ccValue < 127/2)
      	{
      		changeKeyColor(0xFFFFFF00);
      	}
      	else
      	{
      		changeKeyColor(0xFF0000FF);
      	}
      }
      // [/onController]
      
      // [onTimer]
      // ================
      // onTimer Callback
      
      function onTimer()
      {
      
      }
      // [/onTimer]
      
      // [onControl]
      // ==================
      // onControl Callback
      
      function onControl(number, value)
      {
      
      }
      // [/onControl]
      
      ">
                <editorstates bodyshown="1" visible="1" solo="0" oninitopen="0" onnoteonopen="0" onnoteoffopen="0" oncontrolleropen="1" oncontrolopen="0" ontimeropen="0" folded="0">
                </editorstates></processor></childprocessors></editorstates> </processor>
          <processor type="ModulatorChain" id="GainModulation" bypassed="0" intensity="1">
            <editorstates bodyshown="1" visible="0" solo="0" folded="1">
            </editorstates></processor>
          <processor type="ModulatorChain" id="PitchModulation" bypassed="1" intensity="1">
            <editorstates bodyshown="1" visible="0" solo="0" folded="1">
            </editorstates></processor>
          <processor type="EffectChain" id="FX" bypassed="0">
            <editorstates bodyshown="1" visible="0" solo="0" folded="1">
            </editorstates></processor>
          <processor type="GlobalModulatorContainer" id="Global Mods" bypassed="0" gain="0.25" balance="0" voicelimit="64" killfadetime="20" iconcolour="0">
            <editorstates bodyshown="1" visible="1" solo="0"><childprocessors><processor type="MidiProcessorChain" id="Midi Processor" bypassed="0">
                <editorstates bodyshown="1" visible="0" solo="0" folded="1">
                </editorstates></processor>
              <processor type="ModulatorChain" id="Global Modulators" bypassed="0" intensity="1">
                <editorstates bodyshown="1" visible="0" solo="0" folded="1">
                </editorstates></processor>
              <processor type="ModulatorChain" id="PitchModulation" bypassed="0" intensity="1">
                <editorstates bodyshown="1" visible="0" solo="0" folded="1">
                </editorstates></processor>
              <processor type="EffectChain" id="FX" bypassed="0">
                <editorstates bodyshown="1" visible="0" solo="0" folded="1">
                </editorstates></processor></childprocessors></editorstates> </processor></childprocessors> 
        <macro_controls>
          <macro name="Macro 1" value="4.0389675939903374e-028" midi_cc="100663295">
          <macro name="Macro 2" value="6.3406517931659435e-033" midi_cc="0">
          <macro name="Macro 3" value="6.3566385163371266e-033" midi_cc="0">
          <macro name="Macro 4" value="6.3886119626794928e-033" midi_cc="0">
          <macro name="Macro 5" value="6.2966883044451899e-033" midi_cc="0">
          <macro name="Macro 6" value="6.3806186010939013e-033" midi_cc="0">
          <macro name="Macro 7" value="6.3166717084091688e-033" midi_cc="0">
          <macro name="Macro 8" value="6.3366551123731477e-033" midi_cc="0"></macro> </macro></macro></macro></macro></macro></macro></macro></macro_controls></editorstates></processor>
      
      

      Result:
      CRASH

      ER (Expected result):
      do not crash :D

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

        Hmm I don't get a crash on OS X with Ableton (I can't check on Windows right now). But I think the culprit is the live variable watch table in the DBG area (I remember getting a crash when we were skyping and I was writing this script). Can you confirm this (does it crash without the DBG button pressed)?

        The next problem could be the defering of the callbacks so does deleting this line

        Synth.deferCallbacks(true);
        

        fix it?

        Last guess: you still have this nonsense code in your onController callback:

        for(var i = 0; i < 5000; i++)
        {
            var y = Math.sin(4.0);
        }
        

        I put this in to enforce the CPU usage difference when deferring. If you remove this code and the crash disappears I will have to fix the time-out limit for deferred callbacks.

        1 Reply Last reply Reply Quote 0
        • E
          elanhickler
          last edited by

          yeah, removing the sine calculation code fixes the crash.

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

            @aye58sk4:

            yeah, removing the sine calculation code fixes the crash.

            This was a tough one. Actually the code that was responsible for the crash was this line:

            	ccValue = Message.getControllerValue();
            

            The debugger gave no clues (like always if you debug multithreading issues) and the sine calculation stuff just delayed the call to this API method. If multiple CCs come in in a short time the internal message was overriden and the API call was using a deprecated pointer to the older message.

            Moving this line before the sine loop also fixed the problem. But I changed the handling of the internal message so the original script (and every other script that does heavy calculating in the deffered callbacks) won't crash anymore…

            1 Reply Last reply Reply Quote 0
            • First post
              Last post

            46

            Online

            1.7k

            Users

            11.7k

            Topics

            101.9k

            Posts