Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Remove all envelopes for selected tracks" does not remove send volume #918

Closed
bFooz opened this issue Oct 30, 2017 · 8 comments
Closed

"Remove all envelopes for selected tracks" does not remove send volume #918

bFooz opened this issue Oct 30, 2017 · 8 comments

Comments

@bFooz
Copy link

@bFooz bFooz commented Oct 30, 2017

No description provided.

@nofishonfriday
Copy link
Collaborator

@nofishonfriday nofishonfriday commented Nov 1, 2017

Confirmed (same goes for Send Pan and Send Mute envelopes).
And, what also shouldn't hapen, when running this action and having a track selected that has receives it deletes the send envelopes on the sending track(s).

Probably because send envelopes are stored on the receiving track's chunk and RemoveEnvelopes() called in RemoveAllEnvSelTracks() doesn't account for this.

I've been looking into this but I don't understand the ParserPatcher good enough currently to fix.

@nofishonfriday
Copy link
Collaborator

@nofishonfriday nofishonfriday commented Nov 6, 2017

I'm not really happy with the thought that this action can potentially create havoc (unintentionally deleting send envelopes).

So, I'm wondering is anyone able and plan to fix ?
Otherwise I think it should rather be disabled / hidden for the time being.
Thoughts ?

@veto-gh
Copy link

@veto-gh veto-gh commented Nov 10, 2017

I would love to have a deeper look at the chunk parser class some day.

And, what also shouldn't hapen, when running this action and having a track selected that has receives it deletes the send envelopes on the sending track(s).

In think this would not even be the hardest part. But to prevent the behaviour bFooz is describing we would need to parse all tracks in the project and look for receives of selected tracks.

Other than that there is this:
(EEL-script:)

function eelBegin(UndoYesNo , PrevYesNo) (
	UndoYesNo ? (Undo_BeginBlock(););
	PrevYesNo ? (PreventUIRefresh(1););
);
function eelEnd(UndoYesNo , PrevYesNo , UndoDescription) (
	UndoYesNo ? (Undo_EndBlock(UndoDescription,-1););
	PrevYesNo ? (PreventUIRefresh(-1););
);
function cmd(cmd) (
	match("%s",cmd) ? Main_OnCommand(NamedCommandLookup(cmd),0) : Main_OnCommand(cmd,0);
);


eelBegin(1,1);
cmd(41148);  // Envelope: Show all envelopes for (selected) tracks
i=0;
loop(CountSelectedTracks(0),
	tr=GetSelectedTrack(0,i);
	j=0;
	loop(CountTrackEnvelopes(tr),
		e=GetTrackEnvelope(tr,0);
		loop(CountAutomationItems(e),
			GetSetAutomationItemInfo(e,0,"D_UISEL",1,1);
			cmd(42086);
		);
		SetCursorContext(2,e);   // select envelope
		DeleteEnvelopePointRange(e,-1000000000,1000000000);
		cmd(40065);   // Envelope: Clear (selected) envelope
		j+=1;
	);
	i+=1;
);
eelEnd(1,1,"Remove all envelopes for selected tracks");

But I consider that slightly hacky because of 2 reasons. Firstly we need to remove all envelope points to make Reaper not spawn a dialog on running action 40065 (Envelope: Clear (selected) envelope) and secondly to run that action we need to select an envelope first. And to select an envelope it must be made visible.

Anyway we can take care of all that in the code. It works and it may still be a better approach than to loop through chunks of all tracks.

If anybody of the team wants to see it in the extension just drop a short line and I'll add it.

-EDIT:
Fix so that it works with the new automation items too.

@nofishonfriday
Copy link
Collaborator

@nofishonfriday nofishonfriday commented Nov 10, 2017

Thanks for chiming in Veto.

Just as a note:

But to prevent the behaviour bFooz is describing we would need to parse all tracks in the project and look for receives of selected tracks.

Actually to get the receiving tracks of a track we wouldn't need to do chunk parsing of all tracks, this can be done with the API.
Something like this:

int trackNumSends = GetTrackNumSends(selTrack, 0);
for (int i = 0; i < trackNumSends; i++) { 
 // iterate through destination tracks
   MediaTrack* destTrack = (MediaTrack*)GetSetTrackSendInfo(selTrack, 0, i, "P_DESTTRACK", NULL);
   SetTrackSelected(destTrack, true); // for testing
}

edit:
I got this from Breeder, he uses in BR_GetMediaTrackSendInfo_Track() :D

@veto-gh
Copy link

@veto-gh veto-gh commented Nov 10, 2017

I missed that. Thank you Nofish, that's a huge help!

@nofishonfriday
Copy link
Collaborator

@nofishonfriday nofishonfriday commented Nov 10, 2017

You're welcome.
As for integrating your script in SWS, personally I'm happy with any alternative that doesn't have the 'side effects' this action has.
Iow, I'd say go for it. :)

@veto-gh
Copy link

@veto-gh veto-gh commented Nov 12, 2017

I went the short road, need to comprehend the ParserPatcher class a bit more first to do anything serious (I would also have needed to look for automation items of every removed envelope of every selected track, which are stored on level 1 of the track chunk. Otherwise they remain orphaned in the project)

@nofishonfriday
Copy link
Collaborator

@nofishonfriday nofishonfriday commented Nov 10, 2019

fixed/merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants