# Resource Container Issue



## Mark Belbin (Mar 29, 2011)

Hi All,

Has anyone noticed the GUI's of heavily scripted/skinned instruments getting sluggish when using the resource container in 4.2? If so, any advice for making things run more smoothly? Or perhaps this is an issue that NI is aware of and (hopefully) working on? 

Mark


----------



## EvilDragon (Mar 30, 2011)

Never had issues with sluggishness, to tell you the truth. How many images are you using? :lol:


----------



## Lindon (Mar 30, 2011)

..I'm using over 50 or 60 different images with 100+ instantiations..in a fair few apps, all 4.2 resource container based, and I haven't seen any slow down..as Mario says how many are you using?


----------



## Mark Belbin (Mar 31, 2011)

Thanks guys,
I'm in the same ballpark as regards number of images used, etc. The instrument also has a ~6000 line script with a lot of user functions and pseudo functions ala Big Bob's RCB trick. 
What I found at first was just a slowing down of my ui animations (a show stopper, as these animations are for displaying aspects of real-time audio output). Now I've found that the script execution on the whole is slowing down. I know this because note and release callbacks contain note/release/ui triggering functions, and both the animations AND the playback execution are lagging.

I've tried to move my script into the container (on the hunch that the script will communicate better with the ui stuff if it's included in the container, but can't find the "apply from..." option that allows loading the script from the container. I know where the apply from menu is, but there's no container option there that I can see. Anyone got a screenshot to shed some light?

Mark


----------



## polypx (Mar 31, 2011)

Mark,

If you have a Resources Folder that the instrument is pointing at, and a "scripts" folder inside that, then you can point the script editor to scripts inside it.

Once the Resources are packed up as an NKR however, you can no longer point to it, even though the Instrument itself will use it.

I don't think you'll find any change in speed by having it there though, since the script is loaded into the instrument anyway.

cheers
Dan


----------



## Mark Belbin (Mar 31, 2011)

Thanks Polypx,

Here's what further exploration has uncovered:

The slowdown only happens when using the resource container monolith - not when using the resource folder directory. I wanted to use one of the two, since doing so is required in order to use save_array() and/or load(array) with option 1 enabled (to avoid prompting the user for "save array as..." 

My initial understanding was that one had to use the monolith eventually but now it appears to me that it's perfectly reasonable to use the directory structure in the final product. 

You're right that the script needn't be housed in the resource directory or the monolith, since it's applied in the saved .nki, and this is good, since a) it seems I can't "hide" it in the monolith because of the slowdown, and b) I wouldn't want to leave it visible in the directory since it's the only part of the product I want under password.

So it looks like I'll be fine 

Can anyone else see a difference in performance between resource monolith and resource directory?

Mark


----------



## EvilDragon (Apr 1, 2011)

Mark Belbin @ 1.4.2011 said:


> My initial understanding was that one had to use the monolith eventually but now it appears to me that it's perfectly reasonable to use the directory structure in the final product.



NOT if you want to protect your graphics and IRs and scripts.


----------



## Mark Belbin (Apr 1, 2011)

Mario,

The script can be loaded and p/w protected within the .nki without being included in the resources. The graphics and IR's I could care less about. Ammiright?

i.e., Protect them from what, exactly? 

-Mark


----------



## polypx (Apr 1, 2011)

I think he means that if you leave the scripts in an unencoded Resources folder, then they'll be available there.

But if there's definitely a speed advantage, I think you can change the Script Editor to use what's in the editor window, save it again, then erase the text files.

cheers
Dan


----------



## EvilDragon (Apr 1, 2011)

Mark Belbin @ 1.4.2011 said:


> The script can be loaded and p/w protected within the .nki without being included in the resources. The graphics and IR's I could care less about. Ammiright?
> 
> i.e., Protect them from what, exactly?



Depends if you want your graphics to be available up for grabs. Ditto IRs. :lol:


----------



## Lindon (Apr 3, 2011)

Mario,

OK I'll bite, so how would I set it up so my graphics were NOT "up for grabs"?

LP


----------



## EvilDragon (Apr 4, 2011)

Well you just create an RC after you've done adding your graphics to Resources/pictures folder. Then in Instrument Options of the NKI point to that RC. Then move the Resources folder elsewhere, so the NKIs will use the monolith instead of the folder. Distribute it like that. Done


----------

