Welcome to %s forums

BrainModular Users Forum

Login Register

OS is Win=0 / OSX = 1

I need help on a Patch
Post Reply
lytz1
Member
Posts: 123
Contact:

Unread post by lytz1 » 11 Feb 2019, 00:50

Hey there.

Is it possible to get a true/false message (0/1) depending on which OS HH is running?

Unfortunately, the Usine Path module seems to be static. I hoped it would update the path dynamically
depending on which OS HH3 is currently running, but it doesn't.

Basically, I just need the Path module to update the path on .wkp loading and all would be fine.
But it is not.

Any ideas?

Thanks,
tL.

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 11 Feb 2019, 02:22

this script should to the job, connecting 'on itit' or path loadd pulse to refresh

Code: Select all

//////////////////////////
// Extract usine app path with refresh button         
/////////////////////////                                                          
// declaration                                                            
var refresh,textOut : Tparameter;     
var position :  integer;     
var pathstr : string;      
var is_windows : Tparameter;
// initialisation : create parameters
procedure init;                       
begin  
  refresh := CreateParam('get_path',ptButton);                              
  SetIsOutPut(refresh,false);  
                                                           
  textOut := CreateParam('path',ptTextField);      
  SetIsInPut(textOut,false);      
  
  is_windows := CreateParam('is_windows',ptSwitch);
  SetIsInPut(is_windows,false);   
                               
end;                                                        
                                                                  
// Callback
procedure callBack(n:integer);
begin         
          pathstr :=  GetApplicationPath();  
          setStringValue(textout,pathstr);   
          position :=  pos('Win',pathstr); 
          
            if(position>0) then begin  
            setValue(is_windows,1); 
            end;
end;

lytz1
Member
Posts: 123
Contact:

Unread post by lytz1 » 11 Feb 2019, 13:58

Awesome. Yes, this works great. Thanks a lot, man!

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 11 Feb 2019, 15:45

Well done 23FX !

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 11 Feb 2019, 16:09

great script!
but easier with the file-path-delimiter module
if the output is '/' its OSX if the out is '' it's WIN
senso+++

lytz1
Member
Posts: 123
Contact:

Unread post by lytz1 » 11 Feb 2019, 19:01

One little thing though in general with this setup:

@Senso:

It seems that the Sampler tries to load the files even before an "on init" can change the path so
that the files get found immediately.

I still get a long file not found/search list when loading a workspace. When the search is over and nothing was found,
wkp loading completes and THEN the path gets triggered and all samples are there as soon as I enable the engine .

The thing that I did is to move between OSX and Windows without always having to relocate the files.
So again, this works now automatically thanks to 23fx23's script, but it still doesn't suppress the file not found/search
stuff. Even if it should? Is there any way around this?

I mean it does work but I still have quite some downtime until the (in this case unnecessary) search process is over.

Thanks & best,
tL.

lytz1
Member
Posts: 123
Contact:

Unread post by lytz1 » 13 Feb 2019, 16:48

@23fx23

So it seems there might be a problem.

I get always a 1 (1=win10) from the script. I noticed when loading a workspace back on OSX.

I thought it worked flawless, because I imported OSX workspaces into Windows,
and there was no problem.
However: The workspace on OSX also outputs a 1. How come? Any idea?

Thanks,
tL.

lytz1
Member
Posts: 123
Contact:

Unread post by lytz1 » 13 Feb 2019, 17:03

but easier with the file-path-delimiter module
if the output is '/' its OSX if the out is '' it's WIN
senso+++
No, that doesn't work here.
Always get "/"

I did a Path delim going into a string =
that checks against "/" and I get always a 1 on Win10 and on OSX as well...
(Meaning OSX path delimitation. Also on Win10, no change)

Any idea why that is?

Image

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 13 Feb 2019, 17:21

mmm that's strange, sadly can't really debug here as i don't have a mac. what the script is supposed to do is check the install path ie:
"C:Usine Hollyhock Win64 3.0.166" of currently running usine instance the script is trigged from and check if it contains "Win"
i suppose the path of the OSX doesn't contain Win? can't figure the problem.. strange path delim wouldn't work as well..
what do you see as path on the text out of script when run on OSX?

lytz1
Member
Posts: 123
Contact:

Unread post by lytz1 » 13 Feb 2019, 17:46

The Usine path module gives the correct output.
Not sure what's going on.

/Applications/Usine Hollyhock MacOSX 3.0.186.app

Gonna test some more.

lytz1
Member
Posts: 123
Contact:

Unread post by lytz1 » 13 Feb 2019, 18:36

Okay. So it seems that the path module, when saved inside a patch on OSX doesn't update.

Same for the delimiter module.

When saved in OSX it will stay with the application path from OSX (not recalculating) and vice versa.
The same might be true for the path delimiter module. Didn't check that yet though.

(EDIT: Yes indeed. When I add a brand new path delimited in Windows, I get the correct delimitation.
So something is off here. Or the modules aren't built for dynamically calculating these things?)


That also would explain why the script does fail in the other direction. (It worked depending under which OS
the workspace was saved in the first place)

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 13 Feb 2019, 20:11

mm ok yes indeed probably made kinda thing based on the file that stored those metadatas... time for a new suggestion entry for senso^^

lytz1
Member
Posts: 123
Contact:

Unread post by lytz1 » 13 Feb 2019, 20:48

I wrote to support to see if this is intended behavior or not.
Let's see what we get.

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 13 Feb 2019, 21:05

I think that there is a bug:
the module path is saved with the wkp and the old value reloaded on the new platform.
will be corrected in the v187

Post Reply

Who is online

Users browsing this forum: No registered users and 168 guests