HISE Logo Forum
    • Categories
    • Register
    • Login

    A newbie question, how to write a loop?

    Scheduled Pinned Locked Moved Scripting
    3 Posts 2 Posters 104 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.
    • Felix WF
      Felix W
      last edited by

      How should I write a loop for this situation? I wrote

      for (i = 0; i < 12;  i++){
          ADSR[i].setAttribute(ADSR[i].Attack, value);
      

      does not work.

      277c8889-f575-4773-ad92-6fcb5577c53c-image.png

      //I am a new student at HISE._
      //Windows11 & MacOS Ventura 13.6.7_

      LindonL 1 Reply Last reply Reply Quote 0
      • LindonL
        Lindon @Felix W
        last edited by Lindon

        @CatABC that really not enough to tell us where you are going wrong... include the definition and populating of your ADSR named array..

        so to set up your array, if you havent already:

        const myADSR = [];
        for (i = 0; i < 12;  i++)
        {
          myADSR[i] = Synth.getModulator("ADSR" + (i+1));
        };
        

        ..and in your slider callback...

        for (i = 0; i < 12;  i++)
        {
            myADSR[i].setAttribute(myADSR[i].Attack, value);
        };
        

        HISE Development for hire.
        www.channelrobot.com

        Felix WF 1 Reply Last reply Reply Quote 0
        • Felix WF
          Felix W @Lindon
          last edited by

          @Lindon
          Awesome, that's exactly what I wanted, thank you very much!🥂

          //I am a new student at HISE._
          //Windows11 & MacOS Ventura 13.6.7_

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

          35

          Online

          2.1k

          Users

          12.9k

          Topics

          112.1k

          Posts