Skip to content

Instantly share code, notes, and snippets.

@chiepomme
Last active July 2, 2019 14:27
Show Gist options
  • Save chiepomme/dd32d421457a4cb577f6527a18ced164 to your computer and use it in GitHub Desktop.
Save chiepomme/dd32d421457a4cb577f6527a18ced164 to your computer and use it in GitHub Desktop.
currentProject, _ = reaper.EnumProjects(-1, "") -- -1 is current currentProjectect
for midiIndex = 0,64,1
do
exists, name = reaper.GetMIDIInputName(midiIndex, "")
if (exists and (name == "A" or name == "B" or name == "C" or name == "D"))
then
for channelIndex = 0,15,1
do
trackIndex = reaper.GetNumTracks()
reaper.InsertTrackAtIndex(trackIndex, true)
track = reaper.GetTrack(currentProject, trackIndex);
reaper.SetMediaTrackInfo_Value(track, "I_RECARM", 1) -- recording
channel = channelIndex + 1
inputBits = channel + (midiIndex << 5)
reaper.SetMediaTrackInfo_Value(track, "I_RECINPUT", 4096 + inputBits)
reaper.GetSetMediaTrackInfo_String(track, "P_NAME", name .. tostring(channel), true)
reaper.SetMediaTrackInfo_Value(track, "I_RECMON", 1) -- monitoring
reaper.SetMediaTrackInfo_Value(track, "I_RECMODE", 2) -- record: disabled
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment