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

Several SWS actions don't work during recording - under discussion (was: "SWS/S&M: Map selected tracks MIDI input to channel x" doesn´t work during recording) #913

Open
jurek123 opened this issue Oct 24, 2017 · 11 comments

Comments

@jurek123
Copy link

No description provided.

@veto-gh
Copy link

veto-gh commented Oct 24, 2017

@devs:
This line prevents mapping channels during recording:

if (!(GetPlayStateEx(NULL) & 4) && !SNM_GetSetObjectState(m_reaObject, m_chunk)) {

So it has to be with all actions which involve chunk editing.
Alas I have no clue why Jeffos added this check, but I suppose he had a good reason. Probably for safety reasons to not possibly crash the project during recording.

@jurek123:
Thanks for the report. This action makes use of "chunk editing" as a method to modify the reaper project, which probably could be risky under certain circumstances (Reaper could crash). To prevent loss it is disabled during recording.
I guess what you could do is ask the Reaper developers for a dedicated API function to map MIDI input channels which we could make use of or just use a plugin as input FX (e.g. the JS script IX Midi_Tool).
Maybe you could also ask a Reascript developer to re-implement this action, I suppose Reascript has some more checks to not make Reaper crash in case of a corrupt chunk.

@cfillion
Copy link
Member

cfillion commented Oct 24, 2017

The GetPlayState check was added in 9f2726a:

Global "Safety" update (temporary, I hope): many S&M actions will have no effect while recording.
See http://forum.cockos.com/showthread.php?t=52002 for tech. details

Until c1a4f8f there was a comment saying:

// note: global protections here (temporary, I hope). In REAPER v3.66, it's safer NOT to
// patch while recording and to remove all ids before patching, see http://forum.cockos.com/showthread.php?t=52002

@veto-gh
Copy link

veto-gh commented Oct 24, 2017

Nice, thanks for the additional info @cfillion !

The last Post in this 2010 thread makes me tend to remove the check but I'm sure Jeffos still had very good reasons to leave it in up until last year.
I would leave it in too, but maybe we could rename relevant actions adding "... (no-op during recording)". Not sure how many that would be though..

@nofishonfriday
Copy link
Collaborator

nofishonfriday commented Oct 25, 2017

Asked Justin about it, let's see what he says...
https://www.askjf.com/index.php?q=3889s

edit:
Justin replied.

@veto-gh
Copy link

veto-gh commented Oct 25, 2017

Thank you. Going to test on linux with the check disabled, though I'm probably not of any help here (never recorded anything at all).

I realized the Call Hierarchy of ParsePatch(), which I guess is the main method for chunk patching, is huge. Jeffos (and others) made good use of his swiss army knife tool.
These are a couple of things I found after a quick search that are effected by this check:

  • Midi CC lane actions and Reascript functions
  • Send/Receive/Cue Buss actions and Reascript functions
  • many Item & Track FX actions
  • Reassign MIDI learned channels of ...
  • Show/Hide take vol/pan/mute/pitch envelope
  • actions involving Track Templates
  • functions used by SNM Resources and Live Configs
  • ...

@nofishonfriday
Copy link
Collaborator

nofishonfriday commented Oct 25, 2017

Thanks for checking veto.

Seeing it affects so much (and it would be a huge task to test this all with the check disabled during recording) I'd say safety first and leave the check in (so the issue would be a "Live with it.")
But that's just me of course...

@veto-gh
Copy link

veto-gh commented Oct 26, 2017

I'm pretty much a beginner but I still tend to leave it in too (at least for the older actions/functions).
Maybe a long or separate beta would make sense too.

Concerning the OP, if he doesn't like the JSFX approach, I'm ready to do it by Reascript for him.

@jurek123
Copy link
Author

jurek123 commented Nov 2, 2017 via email

@veto-gh
Copy link

veto-gh commented Nov 2, 2017

Hi Jurek,
for different channels duplicate the script, change the file name and edit the source (look for the "user settings" part).
If you set CHANNEL to 0 you can map MIDI to the source channel.

File: Map selected tracks MIDI input to channel 1.lua.zip

@jurek123
Copy link
Author

jurek123 commented Nov 5, 2017 via email

@nofishonfriday nofishonfriday changed the title "SWS/S&M: Map selected tracks MIDI input to channel x" doesn´t work during recording Several SWS actions don't work during recording - under discussion (was: "SWS/S&M: Map selected tracks MIDI input to channel x" doesn´t work during recording) Nov 11, 2017
@nofishonfriday
Copy link
Collaborator

nofishonfriday commented Nov 11, 2017

Since OP's original issue sounds solved (thanks Veto) I took the liberty to rename the title to reflect the broader topic going on here.

edit:
For further discussion also note Jeff0S' comment in #683.

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

No branches or pull requests

4 participants