HISE Logo Forum
    • Categories
    • Register
    • Login

    Store values in ScriptPanel data object

    Scheduled Pinned Locked Moved General Questions
    51 Posts 6 Posters 2.6k 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.
    • toxonicT
      toxonic
      last edited by

      Any ideas, why the compiled plugin won't saveparameter value data to the preset files? Inside Hise it works like a charme, but not the compiled plugin... 🤔

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

        @toxonic No I'm not sure, but presets are an xml format so writing an object to it doesn't make sense.

        Let's go back to the beginning, there is probably a better way to do whatever it is you are trying to do. What do you want to achieve?

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

        toxonicT 1 Reply Last reply Reply Quote 0
        • toxonicT
          toxonic @d.healey
          last edited by toxonic

          @d-healey Yeah, "preset" might be the wrong word.
          Okay, so far I have a multieffect plugin, each effect has it's own sequencer track to trigger the effect.
          Each effect has a UI Section, where you can adjust the effect parameters.
          Now, I want to be able to store and recall 10 parameter sets of each effect individually, so you can automate these "presets" in the DAW, instead of automating each parameter of each effect, which would be tricky and time consuming. I can't use the HISE preset system because of the inbuilt sequencer, which will always stop playing, when i would change a preset.
          Actually, I got it working to store the parameter sets as a 2 dimensional arrays for each effect.
          So, for example the 10 values of the first parameter of effect one's parameter set would be stored in effectOneArray [0] (just an example name).
          And to save the parameter sets between the sessions, i store these arrays as objects into files, via the mentioned functions above. As i already said, this work fine in HISE itself, but for some reason, the compiled plugin won't write any values to the files in the AppData directory.

          ulrikU 1 Reply Last reply Reply Quote 0
          • toxonicT
            toxonic
            last edited by

            Noone? 🤔

            1 Reply Last reply Reply Quote 0
            • ulrikU
              ulrik @toxonic
              last edited by

              @toxonic Do you have a small example snippet?

              Hise Develop branch
              MacOs 15.3.1, Xcode 16.2
              http://musikboden.se

              toxonicT 2 Replies Last reply Reply Quote 0
              • toxonicT
                toxonic @ulrik
                last edited by

                @ulrik mhh, i'm afraid, i would have to create one, since the project is too large to reduce it to a snippet.
                I will give it a try, to make a small snippet to demonstrate the point, where i stuck...

                1 Reply Last reply Reply Quote 0
                • toxonicT
                  toxonic @ulrik
                  last edited by

                  @ulrik Oh, this is driving me nuts! I created a snippet, that basically does, what happens in my project file in regard of saving and recalling "presets" (don't mind about that term, i don't mean hise presets). And what shall I say, the example works without issues, also as compiled plugin!
                  Here's the snippet, but that's kinda senseless to dig into, because this one works...

                  HiseSnippet 1383.3ocsW0jaabCElismzHklhDfd.H7pQHN1RxIoE00MxV1NvHMIpQNAIvvHgZFJIVOCoJGpXITDfbC5UnGkhtr6691UcauAsOxgye1xINBNZgvv2ue7iOR9XGovmFGKjHmJGLcDE474tcmxUCaOjv3n82A4bc2NRZLUc.MV0.s8zQj3XZ.xwYwGnMwoxRHyu+89aSBIbeZtHD54BlO86YQLUtzNsdHKLbOR.8.VTAquSq88E71hPwX.NK5VGMh3eLY.8wDsYK3hbtxtALkP1UQTzXjyRaKBl1cn3Ddh8OmEy5ER0CZf5BAJQ7dhv.Mh0RQsGxBC5jNsiQPT5jSBKlPBeo6iXArL44jwMLJv4dTjObVnL7VrD7ZTDd0K.uY.ImBPZoDHcS2t9R1HUtFMdtl69bEU1m.zdQnjXKZg+5JtsEfEb0pQjio6IgAYd3cu50WAC+Uaip.yGqvugHw68hNDIIJFuI9vTeGPUsEQiDbXf2xOjK50X4ZqTEOyemuSMmGmVe4ZGUDeIUicogTefqATNaWgO6I1VLA.5FUqt1Z3cXRiGSwJANF9fZCUb07vBFAQbOVHs6zXEMRGTS4izqfvmESkVegfm6s1Dv8rPYfjdwUqva4biRwT+wbeESvSvSUFOjwo4ROQxTzDuvda8zmt0KqU8mMDXdnV0XzS58ivjyZyFUeagnqCDLyIggmI9IhsyDrmN3UjT0XIuXBBEjfshsYHK36LNJZJdKojXHzSDxiwEIRiZnDBV65CKSdrMquAl8soU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m afraid, I have to find out, where the difference to my project is...

                  1 Reply Last reply Reply Quote 0
                  • toxonicT
                    toxonic
                    last edited by

                    But it seems not to be a problem, that i can't write to the files, rather than theres something wrong with the internal dummy arrays, that don't seem to work properly.
                    Whenever i change a preset in the DAW plugin, it shows only default values, but it should at least show the values, that are stored in it's dummy array.
                    I just copied the preset files from my hise project to the AppData User Presets directory, and as soon, as i change a parameter, the corresponding preset file will be overwritten with null.
                    Any ideas?

                    ulrikU 1 Reply Last reply Reply Quote 0
                    • ulrikU
                      ulrik @toxonic
                      last edited by

                      @toxonic It works here, in Hise no problems.
                      I compiled it and opened it in Logic, at the first launch, I had not copied the presetFile to the AppData UserPresets folder so it created a new presetFile with all values at undefined.

                      But if I changed the knob values it wrote them down to the file

                      Hise Develop branch
                      MacOs 15.3.1, Xcode 16.2
                      http://musikboden.se

                      toxonicT 1 Reply Last reply Reply Quote 0
                      • toxonicT
                        toxonic @ulrik
                        last edited by

                        @ulrik Yeah, that's what i mean, the snippet works like expected, but in my project i go pretty much the same way, but it wont work as compiled plugin! That's driving me crazy! 🙈

                        ulrikU 1 Reply Last reply Reply Quote 0
                        • ulrikU
                          ulrik @toxonic
                          last edited by

                          @toxonic Have you located where on your computer the file "presetFile" is located when you open the daw?
                          If so, while you're running the daw, open the file with some text editor and have it open, chose a preset and start changing your knobs, is the file changing, what is written inside?

                          Like this:

                          storevalues.gif

                          Hise Develop branch
                          MacOs 15.3.1, Xcode 16.2
                          http://musikboden.se

                          toxonicT 1 Reply Last reply Reply Quote 0
                          • toxonicT
                            toxonic @ulrik
                            last edited by toxonic

                            @ulrik Yeah, it's getting overwritten with 'null' , as i stated 2 posts above ... this is, why i believe, it must have something to do with the dummy arrays, but i can't get my head around,why it works in HISE but not with the compiled plugin

                            1 Reply Last reply Reply Quote 0
                            • toxonicT
                              toxonic
                              last edited by

                              Just to demonstrate my issue, i added a panel, whcih i use to visualize the content of one of the preset dummy arrays.
                              This is, what it looks in HISE, i can see the values changing, when tweaking parameters:
                              HISE-working.png

                              And this is, what it looks in Ardour as compiled plugin.
                              Remember, the snippet i posted, which works pretty much the same way, works in both, Hise and in Ardour as compiled plugin....
                              Compiled-not_working.png

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

                                @toxonic Ok starting from the bottom up then(you have probably done all this):

                                1. How are you saving these values? In a json file? - I assume yes.
                                2. In which folder are you saving the file? - I assume AppData
                                3. How are you loading this data on init?

                                HISE Development for hire.
                                www.channelrobot.com

                                toxonicT 1 Reply Last reply Reply Quote 0
                                • toxonicT
                                  toxonic @Lindon
                                  last edited by toxonic

                                  @Lindon Thanks for your reply!

                                  1. No, i'm saving the data inside the files via the File.writeObject(ArrayToStore)in a file called for example stutterPresets. The array to store in the files, containing the values for the UI controls is called the same.
                                  2. Yes, actually in AppData/User Presets
                                  3. I made two functions, one to save the arrays in a file and one to recall them.
                                  // Directory to store Presets
                                  var PresetDir = FileSystem.getFolder(FileSystem.UserPresets);
                                  
                                  //function store
                                  inline function writePreset (FILE, ARRAY)
                                  {
                                      local PresetFile = PresetDir.getChildFile(FILE);
                                      PresetFile.writeObject(ARRAY);
                                  }
                                  
                                  //function recall
                                  inline function recallPresets (FILE)
                                  {
                                  	local PresetFile = PresetDir.getChildFile(FILE);
                                  	return PresetFile.loadAsObject();
                                  }
                                  

                                  I recall them on init lie this (for example):

                                  stutterPresets = recallPresets("stutterPresets");
                                  

                                  PS: What you are seeing in the Panel in my last post are the values of the array, which I wan't to store inside a file. Since this is already empty in the compiled plugin, I don't wonder about, that the files are overwritten with null. I just can't get my head around, why the arrays won't get filled with the parameter values i set in the corresponding "presets"...

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

                                    @toxonic

                                    Okay so theres no validation going on, and some maybe incorrect naming, and an incorrect call to writeObject: so start like this:

                                    //function store
                                    inline function writePreset (fileName, myJSONData)
                                    {
                                        local PresetFile = PresetDir.getChildFile(fileName);
                                        if (PresetFile.isFile())
                                       {
                                             PresetFile.writeObject(myJSONData);
                                       }else{
                                           // display an error here.....
                                       };
                                    }
                                    

                                    So the most obvious problem is you were trying to save an array when the command expects JSON, so you should fix that at least...

                                    HISE Development for hire.
                                    www.channelrobot.com

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

                                    9

                                    Online

                                    1.7k

                                    Users

                                    11.8k

                                    Topics

                                    102.8k

                                    Posts