Old 01-13-2018, 03:39 PM   #81
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 435
Default

Quote:
Originally Posted by goldenarpharazon View Post
How and where did this 15 digit printed hex number come from?
This variable is a part of what would be the constructed sysex message later in the script.


P.S. What is a proper way to detect if character "b" from the string "abcd" is present in the string "tofu"?
I'm trying different variations of the following code and it's either always prints "Found" or doesn't print anything.
Code:
pama = "abcd";
match("*?%c*","tofu", str_getchar(pama,1)) ? printf("Found\n");
__________________
It's not ok to use message's body for your signature. Use signature (i.e. this) part of the message, instead. Don't be -Michael mschnell.
fundorin is offline   Reply With Quote
Old 01-13-2018, 04:08 PM   #82
goldenarpharazon
Human being with feelings
 
Join Date: Feb 2016
Posts: 95
Default

Quote:
Originally Posted by fundorin View Post
This variable is a part of what would be the constructed sysex message later in the script.
The image shows 10 bytes that should be represented internally in the computer memory in EEL either as a string, or as an array.

So what is correlation between that string and the 15 digit hex number shown as "=2470141C33C0202" ?
goldenarpharazon is offline   Reply With Quote
Old 01-13-2018, 06:15 PM   #83
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 3,858
Default

Quote:
Originally Posted by fundorin View Post
I've used an ugly line for now, that only allows letters and numbers:
To make such a statement nicer you could do a string that contains 128 characters just 0 and 1: 1 meaning to use the code represented by the position in the string, 0 meaning not to use it.

then the statement just is something like

Code:
allowstring = "000000000000000000000000000000011111111   ....

str_getchar(allowstring, str_getchar(str_in,pos) == 0x31 ? ....
Or you use match with a string containing the allowed characters. (BTW.: (re your other post), the second parameter of match needs to be a string, not a character (which is a number), and here you can use regular expressions (re yet another of your posts) !!! e.g. to match just a single character of a string ).

-Michael
__________________
www.boa-sorte.de

Last edited by mschnell; 01-13-2018 at 06:24 PM.
mschnell is offline   Reply With Quote
Old 01-13-2018, 11:39 PM   #84
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 435
Default

Quote:
Originally Posted by goldenarpharazon View Post
The image shows 10 bytes that should be represented internally in the computer memory in EEL either as a string, or as an array.

So what is correlation between that string and the 15 digit hex number shown as "=2470141C33C0202" ?
That image is not related to EEL. It's a sysex header template from Novation SL programmer's manual.
This one is a real header for my controller - "\xF0\x00\x20\x29\x03\x03\x12\x00\x02\x00\x02\x02\ x01\xF7";
And 2470141C33C0202 is a direct conversion of hex string above, which is, obviously, won't work as a substitute in EEL for that hex string.

Quote:
Originally Posted by mschnell View Post
To make such a statement nicer you could do a string that contains 128 characters just 0 and 1: 1 meaning to use the code represented by the position in the string, 0 meaning not to use it.

then the statement just is something like

Code:
allowstring = "000000000000000000000000000000011111111   ....

str_getchar(allowstring, str_getchar(str_in,pos) == 0x31 ? ....
Or you use match with a string containing the allowed characters. (BTW.: (re your other post), the second parameter of match needs to be a string, not a character (which is a number), and here you can use regular expressions (re yet another of your posts) !!! e.g. to match just a single character of a string ).
So, what should my code look like, to get it working? To find if "b" is in "tofu"?

Quote:
Originally Posted by mschnell View Post
-Michael
Pretty please? I'm tired of deleting this from every quote. Put it in your signature, where the web address is sitting.
__________________
It's not ok to use message's body for your signature. Use signature (i.e. this) part of the message, instead. Don't be -Michael mschnell.
fundorin is offline   Reply With Quote
Old 01-14-2018, 12:33 AM   #85
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 3,858
Default

Quote:
Originally Posted by fundorin View Post
So, what should my code look like, to get it working? To find if "b" is in "tofu"?
I am not accustomed with using RegEx, so I can't help. It was you requesting the use of RegEx in EEL, and with "match" here you are..
Quote:
Originally Posted by fundorin View Post
Pretty please? I'm tired of deleting this from every quote. Put it in your signature, where the web address is sitting.
IMHO, discussion-wise, it does not make much sense to quote the complete content of a post, but only quote the very relevant part that exactly the part of the answer you are just writing is referring to.

-Michael
__________________
www.boa-sorte.de

Last edited by mschnell; 01-14-2018 at 02:11 PM.
mschnell is offline   Reply With Quote
Old 01-14-2018, 12:40 AM   #86
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 435
Default

Experimenting:
PHP Code:
pama "ak";
printf("---------\n");
printf("0 - %c\n"str_getchar(pama,0));
printf("1 - %c\n"str_getchar(pama,1));
match("a","abcdefg") ? printf("Found 1\n");
match("k","abcdefg") ? printf("Found 2\n");
match("*a*","abcdefg") ? printf("Found 3 - correct\n");
match("*k*","abcdefg") ? printf("Found 4\n");
match("*%s*","abcdefg",str_getchar(pama,0)) ? printf("Found 5 - incorrect\n");
match("*%s*","abcdefg",str_getchar(pama,1)) ? printf("Found 6 - incorrect\n");
match("*%{str_getchar(pama,0)}c*","abcdefg") ? printf("Found 7 - incorrect\n");
match("*%{str_getchar(pama,1)}c*","abcdefg") ? printf("Found 8 - incorrect\n"); 
output:
Code:
---------
0 - a
1 - k
Found 3 - correct
Found 5 - incorrect
Found 6 - incorrect
Found 7 - incorrect
Found 8 - incorrect
__________________
It's not ok to use message's body for your signature. Use signature (i.e. this) part of the message, instead. Don't be -Michael mschnell.
fundorin is offline   Reply With Quote
Old 01-14-2018, 12:47 AM   #87
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 435
Default

Quote:
Originally Posted by mschnell View Post
-Michael
IMHO, discussion-wise, it does not make much sense to insert irrelevant info into a post. There's a signature part of the message exists for that type of stuff. Literally. Signature part. For signature. For your signature. Your signature. For the name. For your name. For -Michael. To put it there. Instead of the message's body. Seriously. That simple.
__________________
It's not ok to use message's body for your signature. Use signature (i.e. this) part of the message, instead. Don't be -Michael mschnell.
fundorin is offline   Reply With Quote
Old 01-14-2018, 06:03 AM   #88
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 435
Default

So, this is the only way that worked for me.

code:
Code:
mapa = "abc";
pama = "ak";
sa = sprintf(#, "\*%c\*", str_getchar(pama,0));
sk = sprintf(#, "\*%c\*", str_getchar(pama,1));
printf("---------\n");
printf("mapa = %s, pama - %s, sa = %s, sk = %s\n", mapa, pama, sa, sk);
// match("*?%{tuto}s*?",pama)    ? printf("Found\n");
printf("%s\n", sk);
match(sa,mapa)    ? printf("Found1 - a in abc\n");
match(sk,mapa)    ? printf("Found2 - k in abc\n");
match(sprintf(#, "\*%c\*", str_getchar(pama,0)),mapa)    ? printf("Found3 - a in abc\n");
match(sprintf(#, "\*%c\*", str_getchar(pama,1)),mapa)    ? printf("Found4 - k in abc\n");
Found 1 and 3 would work, while 2 and 4 won't. That's right.
__________________
It's not ok to use message's body for your signature. Use signature (i.e. this) part of the message, instead. Don't be -Michael mschnell.
fundorin is offline   Reply With Quote
Old 01-14-2018, 11:04 AM   #89
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 435
Default

I'm having difficulties with storing strings for the third time and I keep forgeting, how my previous solutions worked out.
So, here we have a piece of code:
Code:
    oscmatch("/track/%d/name", trackNumber)            ? (
        oscparm(0,'s',oscTrackName[trackNumber]);
        oscTrackName8[trackNumber] = formatString(oscTrackName[trackNumber],8,1);
        printf("f  %i - %s\n", trackNumber, oscTrackName[trackNumber]);
        printf("r  %i - %s\n", trackNumber, oscTrackName8[trackNumber]);
        printf("f4 %i - %s\n", trackNumber, oscTrackName[4]);
        printf("r4 %i - %s\n", trackNumber, oscTrackName8[4]);
        printf("---\n");
        );
Let's say that formatString function just reduced incoming strings to the length of 8 characters.

And this is the log output:
Code:
f  1 - asdas121415
r  1 - asdas121
f4 1 - Track 4
r4 1 - asdas121
---
f  2 - Track 2
r  2 - Track 2 
f4 2 - Track 4
r4 2 - Track 2 
---
f  3 - Track 3
r  3 - Track 3 
f4 3 - Track 4
r4 3 - Track 3 
---
f  4 - Track 4
r  4 - Track 4 
f4 4 - Track 4
r4 4 - Track 4 
---
f  5 - Track 5
r  5 - Track 5 
f4 5 - Track 4
r4 5 - Track 5 
---
f  6 - Track 6
r  6 - Track 6 
f4 6 - Track 4
r4 6 - Track 6 
---
f  7 - Track 7
r  7 - Track 7 
f4 7 - Track 4
r4 7 - Track 7 
---
f  8 - Track 8
r  8 - Track 8 
f4 8 - Track 4
r4 8 - Track 8
As it can be seen here, full strings, i.e oscTrackName[trackNumber] (f) are stored properly, based of trackNumber = 4 (f4) behavior.
Reduced variables, i.e. oscTrackName8[trackNumber] (r) are all pointing to the same string, as trackNumber = 4 (r4) is showing us.

Here's how those arrays are declared in @init section. Both are declared exactly the same way:
Code:
oscTrackName        = 49*16384;
oscTrackName8        = 61*16384;
mem_set_values(oscTrackName+1,        #,#,#,#,#,#,#,#);
mem_set_values(oscTrackName8+1,        #,#,#,#,#,#,#,#);
So, when displaying track names with oscTrackName we get this:

and with oscTrackNames8 we get this:


And I don't understand, why.
__________________
It's not ok to use message's body for your signature. Use signature (i.e. this) part of the message, instead. Don't be -Michael mschnell.
fundorin is offline   Reply With Quote
Old 01-14-2018, 11:29 AM   #90
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 435
Default

This solves the issue above:

Apparently, this code doesn't work:
Code:
oscTrackName8[trackNumber] = sprintf(#,"%s",oscTrackName[trackNumber]);
but this one works fine:
Code:
sprintf(oscTrackName8[trackNumber],"%s",oscTrackName[trackNumber]);
And I have no clue why.
Maybe, that's because it's not possible to assign literal strings directly in EEL, using "=" operator.
__________________
It's not ok to use message's body for your signature. Use signature (i.e. this) part of the message, instead. Don't be -Michael mschnell.
fundorin is offline   Reply With Quote
Old 01-14-2018, 02:18 PM   #91
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 3,858
Default

See the warning about the short lived temporary string # in the docs.

Quote:
Originally Posted by fundorin View Post
I have no clue
True !. The cause of that fact obviously is that I only provide crap instead of trying to help, so lets give up.

Putting fundorin on the ignore list.
-Michael
__________________
www.boa-sorte.de

Last edited by mschnell; 01-14-2018 at 10:29 PM.
mschnell is offline   Reply With Quote
Old 01-15-2018, 08:35 AM   #92
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 3,858
Default

If anybody wants a little training with the EEL string handling system (which in fact is very simple, but might be unusual, regarding the ways of other programming language, hire some example code for checking out:
Code:
@init

printf("init\n");

printf("----\n");

#st = "1234";
#su = "9876";
printf("%d: %s\n",#st,#st);
printf("%d: %s\n",#su,#su);
printf("%d: %s\n",st);
printf("%d: %s\n",su);
printf("----\n");

sn = 0;
strcpy(sn, "abcd");

sm = 1;
strcpy(sm, "ABCD");

so = #st;
sp = #su;
printf("%d: %s\n", sn, sn);
printf("%d: %s\n", sm, sm);
printf("%d: %s\n", so, so);
printf("%d: %s\n", sp, sp);
printf("%d: %s\n",  #,  #);
# = "hash";
h = #;
printf("%d: %s\n",  #,  #);
printf("%d: %s\n",  h,  h);
h = # = "hash";
printf("%d: %s\n",  #,  #);
printf("%d: %s\n",  h,  h);

printf("%d: %s\n",  #,  z=#="hash1");
printf("%d: %s\n",  #=#st,  #);
printf("%d: %s\n",  z,  z);

printf("\n-- sprintf --\n");
x = 777;
y = sprintf(x, "//%d//", 3);
printf("%d: %s   %d: %s\n", x, x, y, y);
y = sprintf(#, "//%d//", 3);
printf("%d: %s   %d: %s\n", #, #, y, y);
printf("%d: %s   %d: %s\n", x, x, y, y);
printf("%d: %s   %d: %s\n", #, #, y, y);
y = 3;
y = "three";
y1 = sprintf(y2=#, y3="//%s//", y4=y);
printf("%d: %s   %d: %s   %d: %s   %d: %s\n", y1, y1, y2, y2, y3, y3, y4, y4);


printf("\n-- += --\n");
#f = "f";
#g = "g";
#f += sn;
sm += #g;
printf("+=    %s,   %i,    %s,    %i\n", #f, #f, sm, sm);
#f = #f + sn;
#g = "123" + #f; //+"456";
printf("+     %s,   %s\n", #f, #g);

printf("\n-- Loop --\n");
strcpy(2, #st);
strcpy(3, #su);
i = 0;
loop(4,
  printf("%i: %s\n", i, i);
  i += 1;
);


printf("\n-- match --\n");

z = match ("x", "xyz");
printf ("%d\n", z);
z = match ("xyz", "xyz");
printf ("%d\n", z);

x = "x";
y = "abcdef";
z = match(x, y);
printf("%d: %s   %d: %s\n", x, x, y, y);
printf ("%d\n", z);

x = "cd";
z = match(x, y);
printf("%d: %s   %d: %s\n", x, x, y, y);
printf ("%d\n", z);
z = match(x, "%0s", y);
printf("%d: %s   %d: %s\n", x, x, y, y);
printf ("%d\n", z);


printf("\n-- file --\n");
f = fopen("c:/tmp/xxx.txt", "r");
printf("handle: %i\n", f);
  f ? (
    i = 0;
    x = 100;
    l = -1;
    while (l) (
      l = fgets(f, x);
      l ? (
        str_setlen(x, l-1);
        printf("%i: %i: %s\n", i, l, x);
      );  
      i += 1;
      x += 1;
    );  
    printf("----\n");
    x = 100;
    loop (i-1,
      l = strlen(x);
      printf("%i: %s\n", l, x);
      x += 1;
    )
  );
printf("----\n");
(I did not try the 3rd parameter of match, as I am not at all knowledgeable with RegEx, and hence the documentation is too sparse for me to comprehend.)
-Michael
__________________
www.boa-sorte.de

Last edited by mschnell; 01-15-2018 at 10:19 PM.
mschnell is offline   Reply With Quote
Old 01-15-2018, 10:19 PM   #93
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 3,858
Default

Quote:
Originally Posted by mschnell View Post
(I did not try the 3rd parameter of match, as I am not at all knowledgeable with RegEx, and hence the documentation is too sparse for me to comprehend.)
OSCII-Bot docu -> "Searches for the first parameter in the second parameter, using a simplified regular expression syntax."
I now seem to understand that the 2nd, the 3rd and more parameters of match() work like sprintf(), and hence the 3rd parameter is not about RegEx, but supposedly the RegEx code will go into the 2nd.
Nonetheless I don't know how this works.

-Michael
__________________
www.boa-sorte.de
mschnell is offline   Reply With Quote
Old 01-16-2018, 09:31 AM   #94
Veto
Human being with feelings
 
Join Date: Aug 2010
Posts: 767
Default

Parameters 3 to n just assign values to given variables.
PHP Code:
@gfx
gfx_x
=gfx_y=0gfx_set(1,1,1);

in="42@veto.com";

s1=#;
s2=#;
match("%u@%s.%s"indecs1s2); 
// same as 
match("%{dec}u@%{s1}s.%{s2}s"in);

gfx_printf("%u\n%s\n%s",dec,s1,s2);
//42
//veto
//com 
Think of match(needle, haystack, &var1, &var2, &var3, ...) Michael
Veto is offline   Reply With Quote
Old 01-16-2018, 02:56 PM   #95
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 3,858
Default

Ooops.

match() sets the values of parameters 3, ... ?!?!?

So I was totally confused.

-Michael
__________________
www.boa-sorte.de

Last edited by mschnell; 01-16-2018 at 03:05 PM.
mschnell is offline   Reply With Quote
Old 01-16-2018, 03:47 PM   #96
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 435
Default

So, I've came to the point where single dimension array might not be enough for storing osc data.
I've used only single variable commands before, like
Code:
oscmatch("/track/%{number}d/mute")            ? oscTrackMute[number]            = oscparm(0,0);
for t/track/@/mute/toggle.

Now, it's two variables. What would be a best way to store those?
n/track/@/recv/@/volume
__________________
It's not ok to use message's body for your signature. Use signature (i.e. this) part of the message, instead. Don't be -Michael mschnell.
fundorin is offline   Reply With Quote
Old Yesterday, 02:59 AM   #97
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 435
Default

I'm still struggling with controlling volume/pan of the device tracks via
TRACK_VOLUME n/track/@/volume
TRACK_PAN n/track/@/pan
with pots or non-mechanical faders.

Controls in Reaper are jumping to the current pot value, regardless of what was the actual vol/pan value in Reaper for that track. Can't come up with a stable soft pickup code for built-in ReaperOSC commands. Any help would be appreciated.
__________________
It's not ok to use message's body for your signature. Use signature (i.e. this) part of the message, instead. Don't be -Michael mschnell.
fundorin is offline   Reply With Quote
Old Yesterday, 03:25 AM   #98
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 435
Default

I might've found an issue here.
Even if ReaperOSC file have this entry:

TRACK_PAN n/track/pan n/track/@/pan s/track/pan/str s/track/@/pan/str

Reaper doesn't send feedback to the device when /n/track/@/pan is sent from the device:
Quote:
----------------------------------
Incoming OSC...
Message: /track/pan
Value: 0.055000
----------------------------------
Incoming OSC...
Message: /track/pan/str
Value: 89%L
----------------------------------
Incoming OSC...
Message: /track/1/pan/str
Value: 89%L
There's no "/track/1/pan" command above.

When pan is adjusted in Reaper:
Quote:
----------------------------------
Incoming OSC...
Message: /track/1/pan
Value: 0.183000
----------------------------------
Incoming OSC...
Message: /track/1/pan/str
Value: 63%L
And /track/1/pan is the command that my script is tracking, to store pan values for all 8 tracks of the device. Because of this, I can't update feedback values in time to implement soft pickup.
__________________
It's not ok to use message's body for your signature. Use signature (i.e. this) part of the message, instead. Don't be -Michael mschnell.
fundorin is offline   Reply With Quote
Old Yesterday, 05:20 AM   #99
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 435
Default

I'm trying to use this code for soft pickup of the single pot:
Code:
    msg2 == slP[1] ?(
        (oscTrackPan[1]-0.1 < msg3/127 && msg3/127 < oscTrackPan[1]*127+0.1) ? (
            oscsend(osc_out, "n/track/%d/pan", msg3/127, 1);
            oscTrackPan[1] = msg3/127;
            );
        );
With this code, pot's position only picked up when pot is rotated relatively slow, and if it's twisted fast, Reaper looses it's position.

At the same time, this simple code is rock solid and doesn't loose pot's position at all.
Code:
    msg2 == slP[1] ?(
            oscsend(osc_out, "f/action/%d/cc/soft", msg3/127, 21);
        );
Action 21 is "Track: Set pan for track 01 (MIDI CC/OSC only)".

What is the magic behind that soft pickup action in Reaper?
__________________
It's not ok to use message's body for your signature. Use signature (i.e. this) part of the message, instead. Don't be -Michael mschnell.
fundorin is offline   Reply With Quote
Old Yesterday, 12:24 PM   #100
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 435
Default

I've spent lots of lost hours on this issue and it seems like there's no other solution, except for devs adding soft takeover for built-in ReaperOSC commands.
One could add extra flag, telling the script that the value was set by Reaper or by physical pot, so it would be possible to soft takeover the value for the pot, that was previously set by Reaper, but, as soon as you'd assign another control to send panorama adjust command, you'll immediately need another flag for it. And another one. And another. The more unique controls you want to use for the same parameter adjustment, the more flags should be implemented into the code.
Otherwise, there's no way to tell the script, is the value was previously adjusted by Reaper or by the same midi control, that just simply jumped too fast and didn't sent each continuous value to the script, despite of it's purpose (CC - continuous control).
So, soft takeover logic should be implemented on the Reaper's side.
__________________
It's not ok to use message's body for your signature. Use signature (i.e. this) part of the message, instead. Don't be -Michael mschnell.
fundorin is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:54 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.