reaper-oss / sws

The SWS extension is a collection of features that seamlessly integrate into REAPER, the Digital Audio Workstation (DAW) software by Cockos, Inc
https://www.sws-extension.org/
MIT License
445 stars 85 forks source link

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 6 years ago

veto-gh commented 6 years ago

@Devs: This line prevents mapping channels during recording: https://github.com/reaper-oss/sws/blob/400c3c13949805afc37b87627a0c8664f436508f/SnM/SnM_ChunkParserPatcher.h#L260

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 commented 6 years ago

The GetPlayState check was added in 9f2726a056137a679ee91a62e74f2780b9b33747:

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 c1a4f8f987cfd743ad4d31546d6269671c9659d9 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 commented 6 years ago

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 commented 6 years ago

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

edit: Justin replied.

veto-gh commented 6 years ago

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:

nofishonfriday commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

Indeed, I´d be very interested if you could do a Reascript for that? That´d be fantastic.

Jurek (OP)

Am 26.10.2017 um 10:54 schrieb veto-gh notifications@github.com:

I'm pretty much a noob 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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/reaper-oss/sws/issues/913#issuecomment-339598154, or mute the thread https://github.com/notifications/unsubscribe-auth/AfhQY2Karsd19Dsm3tq59CtaJcQ9sjLXks5swEi8gaJpZM4QD6Bo.

veto-gh commented 6 years ago

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 commented 6 years ago

Hey, I just had a chance to test it, works like a charm! Thank you so much!

Jurek

Am 02.11.2017 um 21:30 schrieb veto-gh notifications@github.com:

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 https://github.com/reaper-oss/sws/files/1439283/Map.selected.tracks.MIDI.input.to.channel.1.lua.zip — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/reaper-oss/sws/issues/913#issuecomment-341548789, or mute the thread https://github.com/notifications/unsubscribe-auth/AfhQY86A0nNmm5FfgxkZZVY38KreaioNks5syiZ5gaJpZM4QD6Bo.

nofishonfriday commented 6 years ago

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.