HISE Logo Forum
    • Categories
    • Register
    • Login

    which data container would you recommend for this use case?

    Scheduled Pinned Locked Moved Scripting
    16 Posts 3 Posters 363 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.
    • d.healeyD
      d.healey @prehm
      last edited by

      @prehm In that case using arrays seems fine, I don't think you'll get much benefit from a MIDI list here. You should probably declare the arrays as const and use .reserve() if you know how many elements you will need.

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

      1 Reply Last reply Reply Quote 0
      • P
        prehm
        last edited by

        Okay cool thank you, that’s good to know!
        I wonder, is there any way for an array to always keep track of the concatenated state of three other arrays? Or the other way around, a smaller array that always represents a certain section of a bigger array?

        d.healeyD VirtualVirginV 2 Replies Last reply Reply Quote 0
        • d.healeyD
          d.healey @prehm
          last edited by

          @prehm might be possible with a broadcaster but I'm not sure

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

          1 Reply Last reply Reply Quote 0
          • VirtualVirginV
            VirtualVirgin @prehm
            last edited by

            @prehm said in which data container would you recommend for this use case?:

            Okay cool thank you, that’s good to know!
            I wonder, is there any way for an array to always keep track of the concatenated state of three other arrays? Or the other way around, a smaller array that always represents a certain section of a bigger array?

            I would think all you need to do is update the larger array every time you update the smaller arrays;
            so whenever a change in value occurs for a smaller array, make sure to use array.concat() for the larger one.

            You can listen to my orchestral mockups here:
            https://www.virtualvirgin.net/

            P 1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey
              last edited by

              Another option is to dump the smaller arrays. Keep the big one with all your values, and have another one with 7 elements to keep track of the indexes within that big array.

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

              1 Reply Last reply Reply Quote 0
              • P
                prehm @VirtualVirgin
                last edited by

                @VirtualVirgin
                Yes that’s the way I’ve been doing it, but because that operation has to be done a lot of times in my script at a single note on event, I was wondering if instead there was a way to work with the exact same piece of memory in order to to save computation time, instead of clearing and concatenating over and over again.

                d.healeyD VirtualVirginV 2 Replies Last reply Reply Quote 0
                • d.healeyD
                  d.healey @prehm
                  last edited by

                  @prehm said in which data container would you recommend for this use case?:

                  i dont really know how to specify any further without breaking down the whole concept..

                  Might be time to break down the concept so we know why you are doing what you are doing.

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

                  1 Reply Last reply Reply Quote 0
                  • VirtualVirginV
                    VirtualVirgin @prehm
                    last edited by VirtualVirgin

                    @prehm said in which data container would you recommend for this use case?:

                    @VirtualVirgin
                    Yes that’s the way I’ve been doing it, but because that operation has to be done a lot of times in my script at a single note on event, I was wondering if instead there was a way to work with the exact same piece of memory in order to to save computation time, instead of clearing and concatenating over and over again.

                    I would think if you use Array.reserve() like David mentions above and use only one array for the concatenation (assuming that you are only require one output at a time), then my impression is that this would simply reuse the same memory space over and over. Somebody please correct me if I am wrong about that.

                    You can listen to my orchestral mockups here:
                    https://www.virtualvirgin.net/

                    P 1 Reply Last reply Reply Quote 0
                    • P
                      prehm @VirtualVirgin
                      last edited by

                      @VirtualVirgin
                      Yes I think that’s an error on my side, but still it would save the action of clearing and concatenating if I could just „view“ part of the big array through one of the small arrays.

                      @d-healey
                      That idea is interesting, if I understand you correctly, I would set it up like this:?

                      Const SmallArray = [1, 2]
                      Const BigArray = [SmallArray[0], SmallArray[1]]
                      And so on

                      Is that what you meant? Would this keep track of value changes? Can’t test it right now but I will later, thanks!

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

                        @prehm Not what I mean.

                        For example (dummy values)
                        Big array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
                        Small array = [0, 4, 6, 9, 12, 14, 16]

                        The small array is the index for where to start counting in your big array. So if you go with element 3 of the small array that gives you 6, so you start counting from the 6th element in the big array.

                        Again though without knowing exactly what the end goal is we are just throwing possibilities at you.

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

                        P 1 Reply Last reply Reply Quote 0
                        • P
                          prehm @d.healey
                          last edited by

                          @d-healey
                          Thanks a lot, some fresh ideas is really all I need 🙃

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

                          12

                          Online

                          1.7k

                          Users

                          11.9k

                          Topics

                          103.3k

                          Posts