View Single Post
Old 08-28-2020, 08:18 AM   #5
Florian.S
Human being with feelings
 
Florian.S's Avatar
 
Join Date: Jul 2020
Location: Ger
Posts: 8
Default

After a lot of try and error i came this far.
My Problem is, that in the part where "lastmarker/number/str" is triggered to get the number of the marker as a string both variables "MarkerName" and "MarkerNr" are overwritten and both have the same value/string. I don't get why this is happening.

Is there a easier way to get the value(name) of a marker than doing it char by char?

Finished output should look like "s/style/text/2/[String of MarkerNr]" and the String out of "MarkerName" should be sended.
I'm able to build the strings via "strcat(#str,"srcstr")"

Thank you guys.

Code:
@input DAW_Reaper OSC „localhost:9001“ //9001 osc out port reaper
@output Companion OSC „localhost:12321“ //12321 osc in port companion

@init
SendCommand = "s/style/text/2/3"; 		//Test Command
SendVal = "Test"; 				//Test String

//The following line sends the OSC command to Companion
oscsend(Companion, SendCommand, SendVal); 	//Test to try connectivity 


@oscmsg /Triggered each time a osc massage is present
oscmatch("/lastmarker/n*",$'s') ? (
oscmatch("/lastmarker/name",$'s') ? (
	x = 0;
	v = 0;
	while(
		fmt0 = oscparm(x,v);
		v == $'s' ? (
		str_offs = 0;
		strcpy(oscparm_val_str, "");
		while(
			fmt0 = oscparm((str_offs<<16) + x, s);
			fmt0 ? str_setlen(oscparm_val_str, str_offs+1);
			str_setchar(oscparm_val_str, str_offs, fmt0);
			str_offs += 1;
			fmt0;
			);
		MarkerName = oscparm_val_str;
		printf("\nMarker1: "); printf(MarkerName);		
		);
	x += 1;
	v;
	);
);

oscmatch("/lastmarker/number/str",$'s') ? (
	x = 0;
	v = 0;
	while(
		fmt0 = oscparm(x,v);
		v == $'s' ? (
		str_offs = 0;
		strcpy(oscparm_val_str, "");
		while(
			fmt0 = oscparm((str_offs<<16) + x, s);
			fmt0 ? str_setlen(oscparm_val_str, str_offs+1);
			str_setchar(oscparm_val_str, str_offs, fmt0);
			str_offs += 1;
			fmt0;
			);
		MarkerNr = oscparm_val_str;
		printf("\nMarker2: "); printf(MarkerNr);
		printf("\nMarker1: "); printf(MarkerName);				
		);
	x += 1;
	v;
	);
);
printf("\n.")					//Print dots to check how often something gets triggered 
);
Florian.S is offline   Reply With Quote