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

Reply
 
Thread Tools Display Modes
Old 04-04-2019, 07:04 AM   #1
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default Identification of USB Midi devices

When unplugging and re-plugging an USB Midi device, it often gets a new ID number. This is more likely when different socket is used, but I seem to remember that is sometimes happened just "on the fly". This of course is not a problem generated by Reaper, but by the OS (Windows 7 in my case).

This is a very annoying reason of problems "on the road".

Now some USB devices seem to keep their ID even when connected to a different socket.

In fact each Midi device (be it USB or virtual, e.g. by LoopMidi) provides (and in Reaper is shown with) a dedicated name. I don't have multiple identical USB hardware devices, so I can't know if they will get the same name, but this special case supposedly is of lesser significance.

But as the names are different, it should be possible to tag an internal ID number to a dedicated name and with that keep the connection in the projects intact, even if the OS Midi device ID number changes.

-Michael

Last edited by mschnell; 04-06-2019 at 04:47 AM.
mschnell is online now   Reply With Quote
Old 04-06-2019, 04:46 AM   #2
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

... bump ...
mschnell is online now   Reply With Quote
Old 04-13-2019, 09:49 AM   #3
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

Seems like kind of a bug is involved...
see -> https://forum.cockos.com/showthread....53#post2121253
-Michael
mschnell is online now   Reply With Quote
Old 04-14-2019, 09:41 PM   #4
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

I would need either an option to make Reaper generally ignore the "number plus dash plus blank" characters the Windows OS (or whoever) adds to the start of certain Midi device name (resulting in multiple identical hardware devices not being usable at the same time - in the same time like e.g. multiple "Audio 6" devices (the instances of which get exactly the name name by the OS), or some intelligent way to have the user manage this situation.

-Michael
mschnell is online now   Reply With Quote
Old 05-05-2019, 09:36 AM   #5
airon
Human being with feelings
 
airon's Avatar
 
Join Date: Aug 2006
Location: Berlin
Posts: 11,817
Default

I renamed my two otherwise identical Midi Fighter Twister units. That enabled me to search for that new name and find the correct midi id.


Lua code I use to change banks on my MFT.

Code:
local m_com = {
-- m_com[k].target_devnum will hold the devices number for each command
          {   device = "Twister2", -- will be replaced with  target device number+16 for actual command
              midicmd = '0x9'..string.format("%x", 3), -- NoteOn on midi channel 0-15
              midinotecc = 3 , -- bank no.4
              vel = 127 }, -- velocity or CC value
}
-- end of command list

local target_devices = {}
local i,k = 0 , 0
local target_devnum = {} -- array to collect device numbers
local mdev_outno = reaper.GetNumMIDIOutputs() -- grab number of midi outputs in Reaper
msgclr()
msg("Midi Outs Reaper: " .. mdev_outno)
msg("Stepping through devices...")

-- collect device ids for each command
for k=1, #m_com, 1 do
  target_devices[k] = m_com[k].device
end

for k=1, #target_devices, 1 do
  for i=1, mdev_outno, 1 do
    retval, mdev_name = reaper.GetMIDIOutputName(i, "")
    if retval then
      if string.find(mdev_name,target_devices[k]) then -- check for target device name(s)
        m_com[k].target_devnum = i -- add device number to command list
        msg("Device found. No." .. i .. " " .. mdev_name .." matches " .. target_devices[k])
      end
    end
  end
end

-- Send out commands
for i=1, #m_com, 1 do
  reaper.StuffMIDIMessage( tonumber(m_com[i].target_devnum)+16 , m_com[i].midicmd, m_com[i].midinotecc, m_com[i].vel )
  msg("Sent note to " ..m_com[i].device )
end
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10
Website
"My ego comes pre-shrunk" - Randy Thom
airon is offline   Reply With Quote
Old 05-05-2019, 02:27 PM   #6
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

Quote:
Originally Posted by airon View Post
I renamed my two otherwise identical Midi Fighter Twister units. That enabled me to search for that new name and find the correct midi id.
How have you been able to do this ?

-Michael
mschnell is online now   Reply With Quote
Old 05-06-2019, 06:19 AM   #7
airon
Human being with feelings
 
airon's Avatar
 
Join Date: Aug 2006
Location: Berlin
Posts: 11,817
Default

Quote:
Originally Posted by mschnell View Post
How have you been able to do this ?

-Michael

This is just for inside Reaper.


Preferences / Midi Devices
Right-click on a device entry. At the top of the dialogue box you can set an Alias name.


"X-TOUCH MINI" became "Xmini1" for example. That's the name Reaper then uses. It's what my code looks for.


"Midi Fighter Twister" (for both units) became "Twister1" for the first plugged in unit, and "Twister2" for the second.
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10
Website
"My ego comes pre-shrunk" - Randy Thom
airon is offline   Reply With Quote
Old 05-06-2019, 06:49 AM   #8
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

Maybe giving the same alias name to "multiple" devices that got different names in Windows due to plugging the same hardware to a different USB socket, might solve the original issue ...
-Michael
mschnell 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 02:20 AM.


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