01-14-2018, 12:47 AM | #81 |
Banned
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
|
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.
|
01-14-2018, 06:03 AM | #82 |
Banned
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
|
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"); |
01-14-2018, 11:04 AM | #83 |
Banned
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
|
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"); ); 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 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, #,#,#,#,#,#,#,#); and with oscTrackNames8 we get this: And I don't understand, why. |
01-14-2018, 11:29 AM | #84 |
Banned
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
|
This solves the issue above:
Apparently, this code doesn't work: Code:
oscTrackName8[trackNumber] = sprintf(#,"%s",oscTrackName[trackNumber]); Code:
sprintf(oscTrackName8[trackNumber],"%s",oscTrackName[trackNumber]); Maybe, that's because it's not possible to assign literal strings directly in EEL, using "=" operator. |
01-14-2018, 02:18 PM | #85 |
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,793
|
See the warning about the short lived temporary string # in the docs.
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 Last edited by mschnell; 01-14-2018 at 10:29 PM. |
01-15-2018, 08:35 AM | #86 |
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,793
|
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"); -Michael Last edited by mschnell; 01-15-2018 at 10:19 PM. |
01-15-2018, 10:19 PM | #87 | |
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,793
|
Quote:
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 |
|
01-16-2018, 02:56 PM | #88 |
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,793
|
Ooops.
match() sets the values of parameters 3, ... ?!?!? So I was totally confused. -Michael Last edited by mschnell; 01-16-2018 at 03:05 PM. |
01-16-2018, 03:47 PM | #89 |
Banned
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
|
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); Now, it's two variables. What would be a best way to store those? n/track/@/recv/@/volume |
01-17-2018, 02:59 AM | #90 |
Banned
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
|
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. |
01-17-2018, 03:25 AM | #91 | ||
Banned
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
|
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:
When pan is adjusted in Reaper: Quote:
|
||
01-17-2018, 05:20 AM | #92 |
Banned
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
|
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; ); ); 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); ); What is the magic behind that soft pickup action in Reaper? |
01-17-2018, 12:24 PM | #93 |
Banned
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
|
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. |
01-19-2018, 06:07 AM | #94 |
Banned
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
|
After inspecting some csurf plugin's sources, I've realized that there actually IS a flag for each physical knob on the controller, and it's a touch sensor. So, it might be possible to use sensor's state as a trigger for pan/vol actions, like:
if knob wasn't released while panorama value is changing, always consider knob's position as a panorama value. It should solve the issue, when one is twisting pan knob so fast, that it's beginning to pass some midi values. And, because of it, script is starting to think that the value was adjusted by something else, like mouse. Now, it's time to implement this logic into the script. Sometimes I feel like a moron and sometimes like a genius. Today is the latter. 🤡 |
01-20-2018, 01:19 AM | #95 |
Banned
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
|
Last control's position should be added into the script to make soft pickup work.
Solution: Code:
function modeMixerP() ( i=1; while(i<=8) ( msg2 == slP[i] ? ( lastP[i] < oscTrackPan[i] && midiP[i]/127 >= oscTrackPan[i] ? ( oscsend(osc_out, reaper_track_pan, midiP[i]/127, i); oscTrackPan[i] = midiP[i]/127; lastP[i] = midiP[i]/127; ); lastP[i] > oscTrackPan[i] && midiP[i]/127 <= oscTrackPan[i] ? ( oscsend(osc_out, reaper_track_pan, midiP[i]/127, i); oscTrackPan[i] = midiP[i]/127; lastP[i] = midiP[i]/127; ); lastP[i] == oscTrackPan[i] ? ( oscsend(osc_out, reaper_track_pan, midiP[i]/127, i); oscTrackPan[i] = midiP[i]/127; lastP[i] = midiP[i]/127; ); ); i+=1; ); ); |
Thread Tools | |
Display Modes | |
|
|