Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Cpnnecting and controlling severaly USB Midi Host Devices on same USB cable?

  1. #1
    Junior Member
    Join Date
    Feb 2020
    Posts
    9

    Cpnnecting and controlling severaly USB Midi Host Devices on same USB cable?

    Hello. I have been struggling on getting to send MIDI information to my Launchkey. On Digital Audo Workstations it shows up as two devices (from the same Midi Keyboard). I cannot figure out how to get information about what MIDI devices are connected? I have no problem reading notes and knob from the "primary"? Device with NoteOn, Controller, and such...but cant figure out how to send info to the "second" device? (and even if it gets connected?)

    Here is the debug Output that USBHost_T36 shows when disconnecting/connecting the MIDI keyboard. I don't get if the seconde interface is ignored? Or what all "ignored" means?


    START
    USB2 PLL running
    reset waited 6
    USBHS_ASYNCLISTADDR = 0
    USBHS_PERIODICLISTBASE = 20004000
    periodictable = 20004000
    port change: 10001803
    connect
    port change: 1C00100A
    disconnect
    disconnect_Device:
    USBDriver (available_drivers) list: 20003960 -> 20002460 -> 20002B60 -> 20003260
    USBDriver (dev->drivers) list: 20001D60
    disconnect driver 20001D60
    USBDriver (available_drivers) list: 20001D60 -> 20003960 -> 20002460 -> 20002B60 -> 20003260
    delete_Pipe 20003500
    Free transfers
    * 536888576 * remove * free
    Free transfers attached to QH
    * 536888512
    * Delete Pipe completed
    delete_Pipe 200034A0
    Free transfers
    Free transfers attached to QH
    * 536888640
    * Delete Pipe completed
    delete_Pipe 20004400
    shut down async schedule
    Free transfers
    Free transfers attached to QH
    * 536884960
    * Delete Pipe completed
    removed Device_t from devlist
    disable
    *** Device midi1 - disconnected ***
    port change: 10001803
    connect
    begin reset
    port change: 10001005
    port enabled
    end recovery
    new_Device: 12 Mbit/sec
    new_Pipe
    enumeration:
    enumeration:
    enumeration:
    Device Descriptor:
    12 01 10 01 00 00 00 40 35 12 7B 00 00 00 01 02 00 01
    VendorID = 1235, ProductID = 007B, Version = 0000
    Class/Subclass/Protocol = 0 / 0 / 0
    Number of Configurations = 1
    enumeration:
    enumeration:
    Manufacturer: Focusrite A.E. Ltd
    enumeration:
    Product: Launchkey MK2 25
    enumeration:
    Config data length = 99
    enumeration:
    Configuration Descriptor:
    09 02 63 00 02 01 00 80 32
    NumInterfaces = 2
    ConfigurationValue = 1
    09 04 00 00 00 01 01 00 03
    Interface = 0
    Number of endpoints = 0
    Class/Subclass/Protocol = 1 / 1 / 0
    09 24 01 00 01 09 00 01 01
    09 04 01 00 02 01 03 00 03
    Interface = 1
    Number of endpoints = 2
    Class/Subclass/Protocol = 1 / 3 / 0
    07 24 01 00 01 3F 00
    06 24 02 01 01 04
    06 24 02 01 04 05
    09 24 03 01 02 01 01 01 04
    09 24 03 01 03 01 02 02 05
    07 05 81 03 40 00 01
    Endpoint = 1 IN
    Type = Interrupt
    Max Size = 64
    Polling Interval = 1
    06 25 01 02 02 03
    07 05 02 03 40 00 01
    Endpoint = 2 OUT
    Type = Interrupt
    Max Size = 64
    Polling Interval = 1
    06 25 01 02 01 04
    enumeration:
    USBHub memory usage = 960
    USBHub claim_device this=20003960
    Descriptor 4 = INTERFACE
    MIDIDevice claim this=20001D60
    len = 90
    Interface is unknown (might be Yahama)
    type: 36, len: 9
    MIDI Header (ignored)
    type: 4, len: 9
    MIDIDevice claim this=20002460
    len = 90
    Interface is unknown (might be Yahama)
    type: 36, len: 9
    MIDI Header (ignored)
    type: 4, len: 9
    MIDIDevice claim this=20002B60
    len = 90
    Interface is unknown (might be Yahama)
    type: 36, len: 9
    MIDI Header (ignored)
    type: 4, len: 9
    MIDIDevice claim this=20003260
    len = 90
    Interface is unknown (might be Yahama)
    type: 36, len: 9
    MIDI Header (ignored)
    type: 4, len: 9
    Descriptor 36 = ???
    Descriptor 4 = INTERFACE
    MIDIDevice claim this=20001D60
    len = 72
    Interface is MIDI
    type: 36, len: 7
    MIDI Header (ignored)
    type: 36, len: 6
    MIDI IN Jack (ignored)
    type: 36, len: 6
    MIDI IN Jack (ignored)
    type: 36, len: 9
    MIDI OUT Jack (ignored)
    type: 36, len: 9
    MIDI OUT Jack (ignored)
    type: 5, len: 7
    MIDI Endpoint: 81
    rx_size = 64
    type: 37, len: 6
    MIDI Endpoint Jack Association (ignored)
    type: 5, len: 7
    MIDI Endpoint: 2
    tx_size = 64
    type: 37, len: 6
    MIDI Endpoint Jack Association (ignored)
    new_Pipe
    allocate_interrupt_pipe_bandwidth
    best_bandwidth = 5, at offset = 0, shift= 0
    new_Pipe
    allocate_interrupt_pipe_bandwidth
    best_bandwidth = 7, at offset = 0, shift= 1
    Descriptor 36 = ???
    Descriptor 36 = ???
    Descriptor 36 = ???
    Descriptor 36 = ???
    Descriptor 36 = ???
    Descriptor 5 = ENDPOINT
    Descriptor 37 = ???
    Descriptor 5 = ENDPOINT
    Descriptor 37 = ???
    *** Device midi1 1235:7b - connected ***
    manufacturer: Focusrite A.E. Ltd
    product: Launchkey MK2 25

  2. #2
    Junior Member
    Join Date
    Feb 2020
    Posts
    9
    This is how it (One Midi Keyboard Connected) shows up in Reaper:

    Click image for larger version. 

Name:	fromReaper.PNG 
Views:	3 
Size:	43.3 KB 
ID:	28378

    ...so I need to reach both devices but cannot figure out how?

  3. #3
    Junior Member
    Join Date
    Feb 2020
    Posts
    9
    Now with some more digging I might have wanted to change the title and contents of my original post to clarify the issue, but I cannot find out how to do this?

    It might be that the MIDI device (Novation Launchkey MK2) connected connected to the USB Host (USBHost_t36) on Teensy 4.1, shows up as one Device but with 2 different MIDI ports? Still a bit unsure if it shows up as two UDB MIDI devices, or one MIDI Device with two ports (all with channels 1-16).

    Still struggling to get this information out of USBHost_t36, also unsure of this is part of a USB problem or MIDI problem?

    Any help in pointing towards "How-To-Guides" or Tutorials on the topics (USB Host (Enumeration?), USB HOST MIDI (several ports in one device), ...) would be really helpful.

    I have full control of "the first" MIDI Port/Unit, but cannot figure out how to reach "the second" port/Virtaul Device? to send to Channel 16, to be able to control lights on buttons?

    Thanks in advance!

    /Niklas

  4. #4
    Junior Member
    Join Date
    Feb 2020
    Posts
    9
    This is the simplest code I could produce that I beleived would be enough, but apparently not?
    This code works fine when sending midi between two separate MIDI devices connected with a USB Hub to the USB host. Any channel played on my Midi Controller Keyboard plays a note on channel 16 on my electric piano

    ....but this is not working to send anything (internally?) between the 2 midi ports/devices within the Novation Launchkey 25?

    Code:
    #include <USBHost_t36.h> // access to USB MIDI devices (plugged into 2nd USB port)
    
    USBHost myusb;
    USBHub hub1(myusb);
    
    MIDIDevice midi01(myusb);
    MIDIDevice midi02(myusb);
    
    byte sendChannel = 16;
    
    void setup() {
      delay(1500);
      myusb.begin();
    }
    
    void loop() {
      if (midi01.read()) { 
        midi02.send(midi01.getType(), midi01.getData1(), midi01.getData2(), sendChannel);
      }
    }

  5. #5
    Junior Member
    Join Date
    Feb 2020
    Posts
    9
    After some deep digging in the library I found that it was easier than I could beleive.

    This is the shortest code I could produce that simply shows what need to be done to read from (any) port/cable/channel and send to a specific channel and port:

    Code:
    #include <USBHost_t36.h> // access to USB MIDI devices (plugged into 2nd USB port)
    
    USBHost myusb;
    USBHub hub1(myusb);
    
    MIDIDevice midi01(myusb);
    
    byte sendChannel = 16;
    byte sendCable = 1;
    
    void setup() {
      delay(1500);
      myusb.begin();
    }
    
    void loop() {
      if (midi01.read()) { 
        midi01.send(midi01.getType(), midi01.getData1(), midi01.getData2(), sendChannel, sendCable);
      }
    }

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •