3 Quick Questions about Expansions!



  • Hello friends 🙂 as per my last post I'm working on a standalone player to replace the Kontakt requirements for my libraries. I've been reading up on the API for files and expansions but I'm having some issues.

    1. How do I setup a one-click install button, where the user clicks the button, opens an explorer window, navigates to the .hr1 monolith and selects it, then have HISE do the rest?

    So far:

    const var expHandler = Engine.createExpansionHandler();
    var expansionDirectory = FileSystem.getFolder(FileSystem.Expansions);
    var selectExpansionFile = "";
    var dir;
    reg hr;
    
    
    inline function onButton2Control(component, value)
    {
        FileSystem.browse(expansionDirectory, false, "", function(result) 
        {
            hr = result;
            expHandler.installExpansionFromPackage(hr);
            expHandler.refreshExpansions();
        });
    };
    
    

    It behaves (or misbehaves) the following way(s):

    • It opens the browser on Compile and Plugin Initialization (I think because it's declaring the variable expansionDirectory & giving it a value in the init.
    • It returns a memory address as the result, even if I use filetostring.
    • It doesn't install or load the expansion, so I think I missed some stuff.
    1. Do my expansions need that metadata thing I read about? Or is that only when encrypting the expansions? The .hxi file?

    2. Is there currently a way to disable the "Locate Samples" prompt on initial installation? The player will come with no samples or sample maps, everything will be expansion-based.

    Cheers 🙂



    1. https://forum.hise.audio/topic/3922/when-you-want-to-go-too-fast-you-regret-it-quickly/19?_=1617719224935

    It opens the browser on Compile and Plugin Initialization

    You need to disable saveInPreset on your button.

    It returns a memory address as the result, even if I use filetostring.

    Are you sure you're using filetostring correctly?

    1. Yes, if you want to use the built in installer - https://docs.hise.audio/working-with-hise/project-management/expansions/encrypted_expansion.html

    2. Yes, there is a flag in Projucer in the hi_core section, you can also set it as a preprocessor flag in your project preferences.



  • @d-healey said in 3 Quick Questions about Expansions!:

    You need to disable saveInPreset on your button.

    Fixeded 🙂

    Are you sure you're using filetostring correctly?

    Decent chance I'm not.

            hr.toString(Filename);
            Console.print(hr);   
    

    970b05b7-05bc-423b-b6b2-8b16c3360f73-image.png

    1. Yes, if you want to use the built in installer - https://docs.hise.audio/working-with-hise/project-management/expansions/encrypted_expansion.html

    I'll read up! Thank you. Do I just make an empty .hxi in Notepad or whatever? Or does HISE have a way to generate them? I can't find anything in the Sampler or in Export menu.

    1. Yes, there is a flag in Projucer in the hi_core section, you can also set it as a preprocessor flag in your project preferences.

    So...

    7066adcc-759e-4fb9-a484-258135ab54a0-image.png

    ?



  • @iamlamprey said in 3 Quick Questions about Expansions!:

    I'll read up! Thank you. Do I just make an empty .hxi in Notepad or whatever? Or does HISE have a way to generate them? I can't find anything in the Sampler or in Export menu.

    Read up again, that link gives you a step by step guide.

    hr.toString(Filename);

    Try hr.toString(FileSystem.Filename);

    So...

    Looks good to me.



  • @d-healey said in 3 Quick Questions about Expansions!:

    Read up again, that link gives you a step by step guide.

    So turns out I've never clicked or even seen the Sampler Workspace before 😧

    Try hr.toString(FileSystem.Filename);

    That gives a Compile Error:

    433fc07b-45e1-4397-8edd-30502c964593-image.png

    File.loadAsString also returns a memory address.



  • That gives a Compile Error:

    My mistake, it's part of the File class rather than the FileSystem class, so should be File.Filename -https://docs.hise.audio/scripting/scripting-api/file/index.html#tostring

    File.loadAsString also returns a memory address.

    I don't think it returns a memory address, HISE script doesn't get that deep. I think it returns a File object.



  • @d-healey Yeh still doesnt return as a string, it's not that important really.



  • @iamlamprey Might be a bugged constant, try toString(0);



  • @d-healey I'll try it shortly, right now HISE is frozen encoding the expansion. Does it normally take forever? Or is something breaking?



  • @iamlamprey Probably depends on the amount of data it needs to encode and your system specs. Shouldn't take too long though.



  • @d-healey I think my HISE build might be old. It freezes at 0% no matter which expansion. It's also still asking me to set an encryption key in the script which I believe was deprecated.

    I'll try a newer build.



  • Okay encoding works now! But I'm still having some issues with this whole system.

    1. Is there a way to just read the samples/samplemap/images etc from the .hr1 file WITHOUT unpacking them to a "Samples" folder? I'd much rather just give users a single file download, have them point to it using a button, and have the plugin just load everything from that.

    2. My current script is almost working, I think. It's unpacking the .ch1 and info.hxi into the Samples folder (which I set using a Custom Settings floatingtile). But there's no images, and when I click the button to set the active expansion, nothing loads.

    I feel like I missed a step...

    Export Stage:

    1. Export sample map as monolith. (Which is later referenced using the {EXP::Expansion}SampleMap stuff, and works fine within HISE.
    2. Encode the expansion pack in the Sampler Workspace, with key etc all setup.
    3. Export Samples for Install, with correct expansion selected, and .hxi file embedded properly.

    Import Stage:

    1. Set Samples folder using Custom Settings floatingtile.
    2. Install expansion using browser and:
    expHandler.installExpansionFromPackage (hr, FileSystem.Samples);
    expHandler.refreshExpansions();
    

    This creates the expansion subfolder, Samples folder and unpacks the .ch1 and info.hxi properly.

    1. Set active expansion/load images/load samples using:
    Engine.setCurrentExpansion("Bloom");
    backgroundImage = ("{EXP::Bloom}bg_bloom.png");
    Image_BG.setAlpha(1);
    Image_BG.set("fileName", backgroundImage);  
    SamplerRR.asSampler().loadSampleMap("{EXP::Bloom}Bloom_SampleMap");
    

    It just doesn't get to that last stage, I'm not sure why.



  • @iamlamprey said in 3 Quick Questions about Expansions!:

    Is there a way to just read the samples/samplemap/images etc from the .hr1 file

    No. The hr file is an archive that contains the samples in the .ch format, and everything else inside the hxi file. You have to extract the archive, via the installer, in order to access its contents.

    I'd much rather just give users a single file download, have them point to it using a button, and have the plugin just load everything from that.

    That's essentially what you do. You give them the hr file and get your plugin to unpack/install it. They will end up with multiple files but you only need to send them one.

    It's unpacking the .ch1 and info.hxi into the Samples folder (which I set using a Custom Settings floatingtile). But there's no images, and when I click the button to set the active expansion, nothing loads.

    Only the samples should go in the Samples folder. The hxi is the expansion and goes inside the appData/yourCompany/expansions folder. This is handled automatically by the built in installer.

    1. Set Samples folder using Custom Settings floatingtile.

    I don't do it this way. I set the location through the install function. You can see that in my example that I posted a link to in my first post of this thread.



  • @d-healey said in 3 Quick Questions about Expansions!:

    by the built in installer.

    sorry the WHAT

    does HISE have an installer now for stuff? as in I shouldn't be distributing .vst3 files directly?



  • @iamlamprey said in 3 Quick Questions about Expansions!:

    does HISE have an installer now for stuff? as in I shouldn't be distributing .vst3 files directly?

    The expansion installer - you're already using it.

    expHandler.installExpansionFromPackage (hr, FileSystem.Samples);



  • @d-healey ok thank goodness I was about to absolutely freak out 😲



  • Ok so the .hxi isn't getting copied over to the appdata folder. In fact there isn't even an expansion folder for Bloom in there at all.

    Progress!



  • @iamlamprey Have you checked the box to link expansions to your project? Have you set expansion type to encrypted? Have you set an encryption key?



  • @d-healey Yes yes and yes. But I just realized I lost part of my script when HISE crashed, the allowedExpansionTypes section. Recompiling now to see if that was causing it.



  • Nope, still not loading properly.

    I've noticed the compiled plugin also keeps asking me to locate samples folder every 3 seconds, so I think I'll turn those flags back on.


Log in to reply
 

11
Online

1.2k
Users

3.8k
Topics

33.5k
Posts