[SOLVED] Lemur doesn't load text on pad when starting

Discuss problems and solutions.
Post Reply
daeavelwyn
Newbie
Posts:7
Joined:13 Jan 2017 12:53
[SOLVED] Lemur doesn't load text on pad when starting

Post by daeavelwyn » 19 Jan 2017 19:28

Hi every one,

I can't succeed in having lemur loading text for my pads when starting. For this to work, I have to load the lemur editor on my PC, load my template, start synchro (with play/stop button) and connect to my tablet. Then I have to click actualisation button to finaly have my text loaded on my tablet.

I can see the blocks (pad / switch), but no text appears on them.
I join 2 files and my jzml to a better understanding.
onstart.PNG
here is the on start/load state, no text is loaded.
onstart.PNG (28.76KiB)Viewed 3228 times
Attachments
reaper-scoring04.jzml
(41.23KiB)Downloaded 86 times
with-text.PNG
here is my templates with the text loaded
with-text.PNG (61.28KiB)Viewed 3228 times
Last edited by daeavelwyn on 20 Jan 2017 00:54, edited 1 time in total.

oldgearguy
Regular
Posts:315
Joined:02 Nov 2013 11:19

Re: Lemur doesn't load text on pad when starting

Post by oldgearguy » 19 Jan 2017 22:33

OnLoad is one of those poorly documented things. The manual obliquely refers to the fact that it might not work in all cases, but they really don't go into details.

What is happening in your script is that when the OnLoad is executing, the variables labels are not always "available" at the time the script executes, so the pads get initialized to blanks.

What I've done to improve my odds is to create an initialize() script at a high level and set that to onLoad with local hardcoded arrays, kind of like this:

Code: Select all

decl labels={'Show current VSTi'}, pad_lbls={'Prev Marker ','Next Marker','Prev Region','Next Region','Prev Track','Next Track','Prev Folder','Next Folder'};

setattribute(Fx.Fx,'labels',labels);
setattribute(Navigation.Navigation,'labels',pad_lbls);
this was defined at the project level, parallel to ColorScheme() and it worked. try moving all the initializations into there and see if that works better.

As an aside, I try to avoid using containers unless there's a very good reason. If you're doing it just for grouping, it adds another level of indirection/reference when you work with objects inside the containers. It's definitely a personal style thing, but since Lemur is limited in the number of characters in a script file and I try to minimize the number of objects it has to deal with to keep performance as good as possible. Again, I don't have any special inside information, so my assumptions may be inaccurate; it's a style thing.

daeavelwyn
Newbie
Posts:7
Joined:13 Jan 2017 12:53

Re: Lemur doesn't load text on pad when starting

Post by daeavelwyn » 20 Jan 2017 00:53

Hi oldgearguy,

Really thanks for your answer, I thought about this solution (I mean init script), but before starting to work on, I'd prefere to know if there isn't an easier solution...the best quality of programers : laziness :-D

Regarding the containers, you are right, it's because i'm new with lemur scipting and I'd like to keep hierarchy the more readable as possible for now :)

I'll probably make a more optimized script later, but for now it really fits to my needs :)

thanks again for your reply ;-)

oldgearguy
Regular
Posts:315
Joined:02 Nov 2013 11:19

Re: Lemur doesn't load text on pad when starting

Post by oldgearguy » 20 Jan 2017 10:38

daeavelwyn wrote:Hi oldgearguy,

Really thanks for your answer, I thought about this solution (I mean init script), but before starting to work on, I'd prefere to know if there isn't an easier solution...the best quality of programers : laziness :-D

Regarding the containers, you are right, it's because i'm new with lemur scipting and I'd like to keep hierarchy the more readable as possible for now :)

I'll probably make a more optimized script later, but for now it really fits to my needs :)

thanks again for your reply ;-)
You can try keeping it the way you have it and change from having a separate variable outside the text() initialization routine to creating one local to that routine. (use a

Code: Select all

 decl label = {"Text1", "text2", "Text3"}; 
)initialization. So, move your labels variable inside the script and try that.

The idea is onLoad is running when the rest of your project is still being set up, so the script that is running needs to have all it's information already defined inside it.

daeavelwyn
Newbie
Posts:7
Joined:13 Jan 2017 12:53

Re: [SOLVED] Lemur doesn't load text on pad when starting

Post by daeavelwyn » 23 Jan 2017 12:48

Hi olgearguy,

So, i've tested your second option which works pretty cool, thanks :)
I'm now having an issue with the section name (woodwinds,brass and so). I'd like to create a loop that could assign the name from a vector. This loop would be in an init script. But, I can't figure how to concatenate stuff and get it working.
Here is the loop :

Code: Select all

//RESET : Send every Instrument sitch to ON.
decl i;
for(i=0; i<sizeof(TCP_Instruments_Name); i++)
{
	ShowHide_Instruments_TCP.Toggle_ShowHide_+TCP_Instruments_Name[i]+.x=1;
}
/* here is the old assignement method
ShowHide_Instruments_TCP.Toggle_ShowHide_Woodwinds.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Brass.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Percussions.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Keyboards_harp.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Voices.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Strings.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_SoundDesign.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Band.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Ethnic.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_AudioInput.x=1;*/
The TCP_Instruments_Name is declared at the highest level of the project like this :
TCP_Instruments_Name={'Woodwinds','Brass','Percussions','Keyboard - Harp','Voices','Strings','Sound Design','Band','Ethnic','Audio Input'};

But of course, Lemur doesn't accept such a syntax. I join the new jzml file. Thanks again for the time you take to help me :)
Attachments
reaper-scoring04.jzml
(40.08KiB)Downloaded 83 times

oldgearguy
Regular
Posts:315
Joined:02 Nov 2013 11:19

Re: [SOLVED] Lemur doesn't load text on pad when starting

Post by oldgearguy » 23 Jan 2017 14:29

The generic way to do it is to build up a string with the name of the object you want to modify then pass that to findobject() and then you can use the return value.

So, something like:

Code: Select all

myExamplescript()
{
decl TCP_Instruments_Name={'Woodwinds','Brass','Percussions','Keyboard - Harp','Voices','Strings','Sound Design','Band','Ethnic','Audio Input'};
decl i, myObjStr, tgtObj;

for (i=0; i < sizeof(TCP_Instruments_Name); i++) {
   myObjStr = 'ShowHide_Instruments_TCP.Toggle_ShowHide_' + TCP_Instruments_Name[i];
   tgtObj = findobject(myObjStr);
   tgtObj.x = 1;
}
}
note - I don't have a Lemur available, so this is just typed in off the top of my head. I never remember if that final "tgtObj.x = 1" works or if I have to use a setexpression() construct...

daeavelwyn
Newbie
Posts:7
Joined:13 Jan 2017 12:53

Re: [SOLVED] Lemur doesn't load text on pad when starting

Post by daeavelwyn » 23 Jan 2017 18:26

ok, i've tried several way, but still can't find how to easily debug with monitor (a real console / log out and a better text editor would make scripting in lemur really better...). Anyway, here is the script :

Code: Select all

//RESET : Send every Instrument sitch to ON.
decl TCP_Instruments_Name={'Woodwinds','Brass','Percussions','Keyboard - Harp','Voices','Strings','Sound Design','Band','Ethnic','Audio Input'};
decl i, myObjStr, tgtObj;

for (i=0; i < sizeof(TCP_Instruments_Name); i++) 
{
   myObjStr = 'ShowHide_Instruments_TCP.Toggle_ShowHide_'+TCP_Instruments_Name[i]+'.x';
   tgtObj = findobject(myObjStr);
   setexpression(tgtObj,myObjStr,1);
}


/*ShowHide_Instruments_TCP.Toggle_ShowHide_Woodwinds.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Brass.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Percussions.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Keyboards_harp.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Voices.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Strings.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_SoundDesign.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Band.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Ethnic.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_AudioInput.x=1;*/
of course, it doesn't work :-(

daeavelwyn
Newbie
Posts:7
Joined:13 Jan 2017 12:53

Re: [SOLVED] Lemur doesn't load text on pad when starting

Post by daeavelwyn » 23 Jan 2017 21:51

Ok, so answering to myself :

Code: Select all

//RESET : Send every Instrument sitch to ON.
decl TCP_Instruments_Name={'Woodwinds','Brass','Percussions','Keyboards_harp','Voices','Strings','SoundDesign','Band','Ethnic','AudioInput'};
decl i, myObjStr, tgtObj;

for (i=0; i < sizeof(TCP_Instruments_Name); i++) 
{
   myObjStr = 'ShowHide_Instruments_TCP.Toggle_ShowHide_'+TCP_Instruments_Name[i];
   tgtObj = findobject(myObjStr);
   setexpression(tgtObj,'x',1);
}


/*
The previous loop execute the following lines :
ShowHide_Instruments_TCP.Toggle_ShowHide_Woodwinds.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Brass.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Percussions.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Keyboards_harp.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Voices.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Strings.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_SoundDesign.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Band.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Ethnic.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_AudioInput.x=1;*/
I hope I could help :)

oldgearguy
Regular
Posts:315
Joined:02 Nov 2013 11:19

Re: [SOLVED] Lemur doesn't load text on pad when starting

Post by oldgearguy » 24 Jan 2017 00:18

daeavelwyn wrote:Ok, so answering to myself :

Code: Select all

//RESET : Send every Instrument sitch to ON.
decl TCP_Instruments_Name={'Woodwinds','Brass','Percussions','Keyboards_harp','Voices','Strings','SoundDesign','Band','Ethnic','AudioInput'};
decl i, myObjStr, tgtObj;

for (i=0; i < sizeof(TCP_Instruments_Name); i++) 
{
   myObjStr = 'ShowHide_Instruments_TCP.Toggle_ShowHide_'+TCP_Instruments_Name[i];
   tgtObj = findobject(myObjStr);
   setexpression(tgtObj,'x',1);
}


/*
The previous loop execute the following lines :
ShowHide_Instruments_TCP.Toggle_ShowHide_Woodwinds.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Brass.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Percussions.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Keyboards_harp.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Voices.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Strings.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_SoundDesign.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Band.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_Ethnic.x=1;
ShowHide_Instruments_TCP.Toggle_ShowHide_AudioInput.x=1;*/
I hope I could help :)
So that works? If so, great you figured it out. Like I said - since Lemur isn't documented down to the lowest level, I don't know when the reference to the object works directly and when it needs to be part of the setexpression() call. In theory, the object is known and someDynamicNamedObject.x should work. In any case, hope that helps you move forward.

Once you learn a handful of standard tricks like that, scripting becomes a bit less painful.

Monitor objects can be set using Monitor.value='string'; or for multiple values, Monitor.value={'string1', 'string2'};

Post Reply