HISE Logo Forum
    • Categories
    • Register
    • Login

    Execution timeout

    Scheduled Pinned Locked Moved General Questions
    11 Posts 4 Posters 352 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.
    • LindonL
      Lindon @Lindon
      last edited by Lindon

      @Lindon ...and the answer was:

      for(z=0; z < requiredAmount/100; z++)
      {
      	for (e = z* 100; e < (z*100)+100; e++)
      	{
      	 encryptedSet.push(FileSystem.encryptWithRSA(validSet[e],privateK ));	
      	}
      	Console.print("Done:" + (z * 100) + " to:" + ((z*100)+100));
      }
      

      I think the vital bit here is selecting a small enough amount of work to do - here 100 encryptions - so that we get through the work without timeout AND get to head back to the outer loopon a regular enough basis to not trigger the timeout there either...

      HISE Development for hire.
      www.channelrobot.com

      LindonL 1 Reply Last reply Reply Quote 2
      • LindonL
        Lindon @Lindon
        last edited by Lindon

        @Lindon damn it nope not working...

        ...so the actual answer was to move the 100 encryptions into a timer callback......

        numCallsRequired = validSet.length/100;
        numCallsExecuted =0;
        GeneratorPanel.startTimer(3000);
        
        
        // and the timer callback...
        
        GeneratorPanel.setTimerCallback(function()
        {
            Console.print("EX:"+ numCallsExecuted + " REQ:" + numCallsRequired);
            if(numCallsExecuted >= numCallsRequired)
            {
        	GeneratorPanel.stopTimer();
        	Console.print(encryptedSet.length);
        	encryptedStringValues = encryptedSet.join("\n");
        	sf =  thisAppData.getChildFile(template.ProductName + "_EncryptedSerials.txt");
        	sf.writeString(encryptedStringValues);
            }else{
        	for (e = numCallsExecuted* 100; e < (numCallsExecuted*100)+100; e++)
        	{
        encryptedSet.push(FileSystem.encryptWithRSA(validSet[e],privateK ));	
        	}
        	Console.print("Completed:" + (numCallsExecuted * 100) + " to:" + ((numCallsExecuted*100)+100)); 
            }
            numCallsExecuted++;
        });
        
        
        
        

        HISE Development for hire.
        www.channelrobot.com

        d.healeyD 1 Reply Last reply Reply Quote 1
        • d.healeyD
          d.healey @Lindon
          last edited by

          @Lindon Background tasks might be a better solution - but don't ask me how to use them.

          Link Preview Image
          HISE | Docs

          favicon

          (docs.hise.audio)

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          LindonL 1 Reply Last reply Reply Quote 0
          • LindonL
            Lindon @d.healey
            last edited by

            @d-healey yeah perhaps...

            HISE Development for hire.
            www.channelrobot.com

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

              @Lindon Definitely use a background task for this, it's a perfect use case. The docs are pretty complete so it should be straightforward to implement.

              LindonL ? 2 Replies Last reply Reply Quote 2
              • LindonL
                Lindon @Christoph Hart
                last edited by

                @Christoph-Hart thanks I will give it a go...

                HISE Development for hire.
                www.channelrobot.com

                1 Reply Last reply Reply Quote 0
                • ?
                  A Former User @Christoph Hart
                  last edited by A Former User

                  @Christoph-Hart @d-healey I have an inline function that has some math functions to control 4 parameters (sometimes I need much more than 4) at the same time with just one knob.

                  I realized that it causes crash in some DAWs when the plugin is used multiple times in a DAW project. When I control 3 or less parameters at the same time, no issues. Because of that I can't finish my plugin.

                  I think this background tasks can be the solution for these kind of situations. What is the best way to use it, any hints please? The example code is the below:

                  inline function MultipleMod_Function()
                  {    
                  	local coeffOne = ((5.344049323286691) * Math.pow((1.469360748201398), (Knob1.getValue()))) * Math.pow((Knob1.getValue()), (-7.134254805322466E-01));
                  	      
                  	local coeffTwo = ((-6.828519524908431)*Math.pow((1 + ((1.951820425636941E-01)*(Knob1.getValue()))/(-5.344049323286691)), (-1/(1.951820425636941E-01))));     
                  	        
                  	local coeffThree = ((5.071662543519128E-01) + ((4.434246748949629E+02)*Math.pow((Knob1.getValue()), 2.105969454482208)) / (Math.pow(7.670227991996821E+01, 2.105969454482208) + Math.pow((Knob1.getValue()), 2.105969454482208)));
                  	 
                  	local coeffFour = (5.517723965590376E-01) - (1.503463302879198E-01) * Math.exp((-((6.597796821568182E+03) * (Math.pow((Knob1.getValue()), (-6.828519524908431))))));
                  	
                  	.
                  	.
                  	.
                  	.
                  	.
                  	local coeffTwelve = ...etc.
                  	
                  	
                  	
                  	EffectModule.setAttribute(EffectModuleIndexOne, (coeffOne - ((coeffThree - coeffTwo)*((Knob2.getValue())-5)/5)));
                  
                  	EffectModule.setAttribute(EffectModuleIndexTwo, (coeffFour - ((coeffFive - coeffSix)*((Knob2.getValue())-5)/15)));
                  
                  	EffectModule.setAttribute(EffectModuleIndexThree, (coeffSeven - ((coeffEight - coeffNine)*((Knob2.getValue())-5)/2.5)));
                  
                  	EffectModule.setAttribute(EffectModuleIndexFour, (coeffTen - ((coeffElev - coeffTwelve)*((Knob2.getValue())-12.5)/5)));
                  
                  }
                  
                  ? 1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User @A Former User
                    last edited by

                    Any ideas @Christoph-Hart about how to use it? I think it would be worth to try.

                    Christoph HartC 1 Reply Last reply Reply Quote 0
                    • Christoph HartC
                      Christoph Hart @A Former User
                      last edited by

                      @harris-rosendahl no the crash must come from somewhere else. This is nothing that needs to be pushed to a background task (even if you change hundreds of attributes, it will take a few milliseconds at best).

                      The background task is for stuff like "Create 50 wave files with 2MB each and fill it with sine waves" that will take 10 seconds or so.

                      ? 1 Reply Last reply Reply Quote 0
                      • ?
                        A Former User @Christoph Hart
                        last edited by

                        @Christoph-Hart I get it thank you.

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

                        23

                        Online

                        1.7k

                        Users

                        11.9k

                        Topics

                        103.4k

                        Posts