Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Feature Requests

Reply
 
Thread Tools Display Modes
Old 09-20-2018, 12:06 PM   #1
Thunderclash
Human being with feelings
 
Thunderclash's Avatar
 
Join Date: Jun 2011
Location: Sweden
Posts: 46
Default Make MIDI channel input mapping available as actions

Hi!

I have nice little feature request that's hopefully not that time consuming to implement. It would be awesome to have "Map input to channel", from the MIDI input menu, available as actions so we can bind them to shortcuts. It would be a nice way to switch between MIDI channels quickly.

Cheers!
Thunderclash is offline   Reply With Quote
Old 09-20-2018, 09:28 PM   #2
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

SWS/S&M: Set selected tracks MIDI input to channel X
mpl is offline   Reply With Quote
Old 09-21-2018, 05:54 AM   #3
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by mpl View Post
SWS/S&M: Set selected tracks MIDI input to channel X
I suggested OP to request for native actions as the SWS ones seem to give trouble.

https://forum.cockos.com/showpost.ph...postcount=2477
nofish is offline   Reply With Quote
Old 09-21-2018, 06:47 AM   #4
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

My bad. I firstly posted lua code using native API, then found SWS action.
mpl is offline   Reply With Quote
Old 09-21-2018, 06:54 AM   #5
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by mpl View Post
My bad. I firstly posted lua code using native API, then found SWS action.
We can do this via native API? (I looked and didn't find anything.)
This may then be an alternative to chunk manipulation SWS uses currently.
nofish is offline   Reply With Quote
Old 09-21-2018, 11:05 AM   #6
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

Code:
MIDIInput = 6

for i = 1, reaper.CountSelectedTracks(0) do
  local tr = reaper.GetSelectedTrack(0,i-1)
  local RecInput = reaper.GetMediaTrackInfo_Value( tr, 'I_RECINPUT' )
  local isMIDI = RecInput&4096 ==4096
  if isMIDI then
    local cur_MIDIInput = RecInput&31
    reaper.SetMediaTrackInfo_Value( tr, 'I_RECINPUT' , RecInput - cur_MIDIInput + MIDIInput)
  end
end

Last edited by mpl; 09-21-2018 at 01:55 PM.
mpl is offline   Reply With Quote
Old 09-21-2018, 01:20 PM   #7
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Thanks. Missed this in the API doc.
nofish is offline   Reply With Quote
Old 09-21-2018, 02:22 PM   #8
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

On checking your script more closely, this seems to set the input channel right ?
What's requested here though is the 'Map input to channel' functionality.



For this we don't have an API way as far as I could see or do we?
nofish is offline   Reply With Quote
Old 09-21-2018, 03:17 PM   #9
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

Sorry!

Yes, it is 'MIDI_INPUT_CHANMAP' variable and there is no way to change it from API without chunking.

So

Code:
MIDI_MapInput = 15 -- from 0 to 15

for i = 1, reaper.CountSelectedTracks(0) do
  local tr = reaper.GetSelectedTrack(0,i-1)
  local ret, chunk = reaper.GetTrackStateChunk(tr, '',true)
  if chunk:match('MIDI_INPUT_CHANMAP') then
    chunk = chunk:gsub('MIDI_INPUT_CHANMAP%s%d+', 'MIDI_INPUT_CHANMAP '..MIDI_MapInput)
   else  
    chunk = chunk:gsub('NAME', 'MIDI_INPUT_CHANMAP '..MIDI_MapInput..'\nNAME') 
  end
  reaper.SetTrackStateChunk(tr, chunk,true)
end
mpl is offline   Reply With Quote
Old 09-21-2018, 03:46 PM   #10
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Thanks for confirming.
Chunking (I like that word ) is also what SWS uses currently.

https://github.com/reaper-oss/sws/bl...rack.cpp#L1038

and which seems to give problems for OP (I imagine when having to parse through a lot of tracks with large track chunks could lead to short freeze as he mentions).

So we're back to the original FR:
Either native actions or a way via API (without chunking) to set input channel mapping would be nice.

Last edited by nofish; 09-21-2018 at 09:20 PM.
nofish is offline   Reply With Quote
Old 04-27-2020, 01:28 PM   #11
Zapatero
Human being with feelings
 
Join Date: Oct 2018
Posts: 26
Default

Quote:
Originally Posted by nofish View Post
[...]
So we're back to the original FR:
Either native actions or a way via API (without chunking) to set input channel mapping would be nice.
Please developers, please consider implementing a way that allows "map (all) MIDI input to MIDI channel #" natively.

This would be immensely helpful, because when working with large templates or tracks with several sample library instrument articulations loaded, currently Reaper freezes for several seconds while scripts/SWS actions achieve the channel mapping in a hacky way.

If a MIDI device doesn't allow for MIDI output channel selection (or if it is a cumbersome feat), such a feature could come quite handy.
Zapatero is online now   Reply With Quote
Old 04-27-2020, 08:41 PM   #12
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

As temporary workaround - maybe ix/MIDI_Router JSFX help?
mpl is offline   Reply With Quote
Old 04-29-2020, 06:56 PM   #13
Zapatero
Human being with feelings
 
Join Date: Oct 2018
Posts: 26
Default

Quote:
Originally Posted by mpl View Post
As temporary workaround - maybe ix/MIDI_Router JSFX help?
Thank you for the good suggestion! It gave me an idea for a solution that might be convenient, perhaps even for other users. As soon as I get it to work properly, I will post details.
Zapatero is online now   Reply With Quote
Old 05-11-2020, 07:45 AM   #14
Zapatero
Human being with feelings
 
Join Date: Oct 2018
Posts: 26
Default

As promised, I return with something I created for my purpose and want to share it as it might help others with similar problems.

For the time being one can freely use and modify my Knob GUI Lua script to quickly change MIDI in/out channel-mapping for the currently selected track until there is a better solution, perhaps natively implemented.

See my forum post for the Lua script:

https://forum.cockos.com/showthread....42#post2285942

Thanks mpl for the suggestion!
Zapatero is online now   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 01:31 PM.


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