Old 04-13-2019, 11:55 PM   #1
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 391
Default Set Input routing on specific track via script

I found the actions 'Track: Set track record mode to input' and 'Track: Set track record mode to none (monitoring only)' and I got their command IDS.

I assumed they must affect the selected track, but they don't seem to do anything.

What's the method for doing this from a script?

Okay, I discovered they ARE working on the selected track...

But what I'd actually like to do is toggle the input (not the mode) from OFF to some pair of hardware inputs. I see lots of commands for setting the outputs, but nothing for the inputs.... although maybe theres some other (simpler?) way to mute the hardware input to a track?
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 04-14-2019, 12:00 AM   #2
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,461
Default

You already asked it https://forum.cockos.com/showthread....68#post2028668

Set input to none looks like this:
Code:
function SetMidiInput_None()
  local tr = reaper.GetSelectedTrack(0,0)
  if not tr then return end
  reaper.SetMediaTrackInfo_Value( tr, 'I_RECINPUT',-1)
end


SetMidiInput_None()
For making toggle see ReaTeam templates repo for deeper examples.
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate

Last edited by mpl; 04-14-2019 at 12:06 AM.
mpl is offline   Reply With Quote
Old 04-14-2019, 12:08 AM   #3
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 391
Default

That code is for MIDI inputs. How do I change it for audio inputs?

Edit:I'll go look at those templates.

Also, I don't want to change the track selection. Is there a way to specify the track?
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 04-14-2019, 12:28 AM   #4
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,461
Default

You didn`t mention anywhere about Audio input specifically

Code:
is_stereo = true


function SetAudioInput(is_stereo, dev_name)
  if is_stereo==true then is_stereo = 1024 else is_stereo = 0 end
  local tr = reaper.GetSelectedTrack(0,0)
  if not tr then return end
  for i = 1,  reaper.GetNumAudioInputs() do
    nameout =  reaper.GetInputChannelName( i-1 )
    if nameout:lower():match(dev_name:lower()) then dev_id = i-1 end
  end
  if not dev_id then return end
  reaper.SetMediaTrackInfo_Value( tr, 'I_RECINPUT',is_stereo + dev_id)
end

SetAudioInput( is_stereo, 'lambda guitar' )
Quote:
Originally Posted by woodslanding View Post
Also, I don't want to change the track selection. Is there a way to specify the track?
Yes, you can use various ways to specify a track (by name, by ID, by current mouse pointer position), see API Help for related functions.
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate
mpl is offline   Reply With Quote
Old 04-14-2019, 12:42 AM   #5
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 391
Default

Quote:
Originally Posted by mpl View Post
You didn`t mention anywhere about Audio input specifically


Yes, you can use various ways to specify a track (by name, by ID, by current mouse pointer position), see API Help for related functions.

Oh, guess 'hardware' could refer to either kind, you are right, sorry!

I see the method now for specifying a track, sweet, thank you!!!
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 04-14-2019, 03:13 AM   #6
Reno.thestraws
Human being with feelings
 
Reno.thestraws's Avatar
 
Join Date: Nov 2009
Location: Belgium
Posts: 9,620
Default

use cycle action editor reaconsole with i

http://www.sws-extension.org/reaconsole.php
Reno.thestraws 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:19 AM.


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