Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 03-09-2015, 07:33 PM   #1
mim
Human being with feelings
 
Join Date: Mar 2009
Posts: 370
Default EEL : Create sends from selected tracks to track named "reverb"

This script is to create sends from selected tracks to any track named "reverb" in the project

It also switch send and receive tracks to 6 channels. And create envelope for both send volume and set mute.

This was a part of Lua script , that I translated to EEL to try to avoid the maxlength of the GetSetTrackState in Lua ( http://forum.cockos.com/showpost.php...&postcount=275 ).

The EEL version only do 2 time better :can't get more than 8192 characters of the chunk state.

I don't know what to do to workaround this. Any help would be sincerely greatly appreciated ....

Code:
function msg_s(m)
(
  ShowConsoleMsg(m);
  ShowConsoleMsg("\n");
);

// m = int (convert int to string and show "m")
function msg_d(m)
(
  ShowConsoleMsg(sprintf(#, "%d", m));
  ShowConsoleMsg("\n");
);

// m = float (convert float to string and show "m")
function msg_f(m)
(
  ShowConsoleMsg(sprintf(#, "%f", m));
  ShowConsoleMsg("\n");
);


function PimpMySends()(

  trackcount=CountTracks(0);
  i=0;
  numberofreverb=0;
  #reverbidx[0]=0;
  #trackstr="";
  str_setlen(#trackstr,100);
  x=0;
  while (i < trackcount) (
  	    CurrentTrack = GetTrack(0, i);
  	    #trackname="";
	    ok = GetSetMediaTrackInfo_String(CurrentTrack, "P_NAME", #trackname, 0);
	    match("reverb",#trackname) ? (
	    	#reverbidx[x]=i;
	    	x += 1;
			
			numberofreverb += 1;

	    	);
	    i += 1;
	    );

  selectedtrackscount = CountSelectedTracks(0);
  j=0;
  while (j < selectedtrackscount) (

    trackptr = GetSelectedTrack(0, j);
    SetMediaTrackInfo_Value(trackptr, "I_NCHAN", 6);

    k=0;
    while (k < numberofreverb) (
      reverbtrackptr=GetTrack(0,#reverbidx[k]);
      SetMediaTrackInfo_Value(reverbtrackptr, "I_NCHAN", 6);
      #trackstr="";

      GetSetTrackState(reverbtrackptr, #trackstr);

      msg_s("From REAPER GetSetTrackState : ");
      msg_s(#trackstr);

      goodi=0;
      i=0;
      
        while (i< strlen(#trackstr)-5) (
             #test="";
        	strcpy_substr(#test,#trackstr,i,7);
		    match("MIDIOUT",#test) ? (
		    	goodi=i;
		    	i=strlen(#trackstr)+1;
		    	);

    		i += 1;
    	) ;
     trackptr != reverbtrackptr ? (

        TrackIdx = floor(GetMediaTrackInfo_Value(trackptr, "IP_TRACKNUMBER"))-1;
        sprintf(#trackidxstr,"%d",TrackIdx);
        #sendstr = "\nAUXRECV ";
		#sendstr += #trackidxstr;
        #sendstr += " 0 1 0 0 0 0 3072 0 -1 4177951 -1 ''\n<AUXVOLENV\nACT 1\nVIS 1 0 1\nLANEHEIGHT 0 0\nARM 1\nDEFSHAPE 0 -1 -1\nPT 0 0 0\nPT 0.0001 0 0\n>\n<AUXMUTEENV\nACT 1\nVIS 1 0 1\nLANEHEIGHT 0 0\nARM 1\nDEFSHAPE 1 -1 -1\nPT 0.0001 0 0\nPT 0 0 0\n>\n";
        strcpy_substr(#start,#trackstr,0,goodi-1);
        
        strcpy_substr(#end,#trackstr,goodi);

        #tobesend="";
        #tobesend += #start;
        #tobesend += #sendstr;
        #tobesend += #end;
        #tobesend += ">";
        GetSetTrackState(reverbtrackptr, #tobesend);
		);

      k += 1;
    );
    j += 1;
  );

);



PreventUIRefresh(100);
PimpMySends();
PreventUIRefresh(-100);
mim is offline   Reply With Quote
Old 03-10-2015, 03:19 AM   #2
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,239
Default

I see the problem
I was thinking that maybe using another way to add receives, instead of manipulating the chunk. But I can't find any. :/
heda is offline   Reply With Quote
Old 03-10-2015, 03:53 AM   #3
mim
Human being with feelings
 
Join Date: Mar 2009
Posts: 370
Default

Thank you for taking the time to understand the script and confirm the problem.

Actually there is "SNM_AddReceive" but it doesn't allow to create a multichannel, no midi, automated volume and automated mute receive.

After learning two langages, and spending some days on it I must say I'm kinda disapointed there seems to be no way to get things to work.

Last edited by mim; 03-10-2015 at 04:16 AM.
mim is offline   Reply With Quote
Old 03-10-2015, 05:57 AM   #4
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by mim View Post
After learning two langages, and spending some days on it I must say I'm kinda disapointed there seems to be no way to get things to work.
There actually is - using chunks. But it can become complicated since sends (and their envelopes) are part of the receiving track's chunk.
After dealing with sends from SWS I for one never want to deal with them again unless absolutely needed, haha. But yes, it can be done (https://www.youtube.com/watch?v=mn8i...youtu.be&t=25s)

Btw, to get full chunk (not limited in size) you can use SWS API SNM_GetSetObjectState() (not sure if this could work properly from EEL to to it's screwy memory management, but it does work in Python and I guess it should work in LUA)

Last edited by Breeder; 03-10-2015 at 06:08 AM.
Breeder is offline   Reply With Quote
Old 03-10-2015, 06:16 AM   #5
mim
Human being with feelings
 
Join Date: Mar 2009
Posts: 370
Default

Quote:
Originally Posted by Breeder View Post
There actually is - using chunks. But it can become complicated since sends (and their envelopes) are part of the receiving track's chunk.
After dealing with sends from SWS I for one never want to deal with them again unless absolutely needed, haha. But yes, it can be done (https://www.youtube.com/watch?v=mn8i...youtu.be&t=25s).
LOL!
This is what I'm doing here creating send by creating auxreceive in reverb track chunk.
TBH, For my case it is simple since I only create send rather than modify them.

Quote:
Originally Posted by Breeder View Post
Btw, to get full chunk (not limited in size) you can use SWS API SNM_GetSetObjectState() (not sure if this could work properly from EEL to to it's screwy memory management, but it does work in Python and I guess it should work in LUA)
This is uber awesome !!!! I have a Lua version of it. Let's try it !
Thank you Breeder!

EDIT : Indeed, it works perfect !!! Thank you !!
I'll upload new version of lua script soon

Last edited by mim; 03-10-2015 at 07:35 AM.
mim is offline   Reply With Quote
Old 03-10-2015, 09:00 AM   #6
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,239
Default

hahaha nice

I still haven't looked at all the SWS functions we can now access from reascript. But now I think I really should have a look
heda 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 12:59 PM.


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