dagargo / overwitch

JACK client for Overbridge devices
GNU General Public License v3.0
120 stars 14 forks source link

Add support for MKI devices #4

Open dagargo opened 3 years ago

dagargo commented 3 years ago

I think Analog Heat MKI could work with the same configuration as the MKII because the number of tracks and the bit depth are the same (4x4 and 24 bits). We just need to replicate the configuration.

But for Analog Rytm MKI, Analog Four MKI and Analog Keys the amount of tracks is user configurable and so is the bit depth. So, without reverse engineering how those are configured, we can only give it a try for now.

Assuming the blocks have the same structure for 24 bits values, we need to know if the track and bit depth configuration is stored in the machines. If this is the case, we could set the tracks configuration to be 4 device outputs (better if we use here the 4 output tracks) and 2 device inputs (better if we use here the main output) using Overbridge and then use it on Overwitch.

If the Overbridge block structure is the same as in the Digitakt and we're using 24 bit values, we can define the Analog Keys MKI as follows.

static const struct overbridge_device_desc AKMK1_DESC = {
  .pid = AFMK1_PID,
  .name = "Analog Four MKI",
  .inputs = 2,
  .outputs = 4,
  .input_track_names = {"Main L", "Main R"}
  .output_track_names = {"Track 1", "Track 2", "Track 3", "Track 4"},
};

And add it to the OB_DEVICE_DESCS array.

If all the above constraints are fulfilled, it could work.

dagargo commented 2 years ago

I can confirm that all Overbridge 1 devices (Analog Four MKI, Analog Keys and Analog Rytm MKI) work in a different way than Overbridge 2 devices. BTW, Both Analog Heat MKI and MKII are Overbridge 2 compatible and currently supported by Overwitch, at least theoretically.

This is the USB device definition of Analog Four MKI.

$ lsusb -d 1935:0004 -v 2> /dev/null

Bus 003 Device 007: ID 1935:0004 Elektron Music Machines Elektron Analog Four
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x1935 Elektron Music Machines
  idProduct          0x0004 
  bcdDevice            0.03
  iManufacturer           1 Elektron Music Machines
  iProduct                2 Elektron Analog Four
  iSerial                 3 000000000001
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0156
    bNumInterfaces          5
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                6mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0006  1x 6 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x00ca  1x 202 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       3
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x012c  1x 300 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       4
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x018e  1x 398 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       5
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0252  1x 594 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       6
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0316  1x 790 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       7
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0378  1x 888 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0068  1x 104 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x012c  1x 300 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       3
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x018e  1x 398 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       4
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x01f0  1x 496 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       5
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x02b4  1x 692 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       6
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0378  1x 888 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       7
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x03da  1x 986 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0MKI
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
Device Status:     0x0100
  (Bus Powered)

The most interesting parts are that the endpoints are different and MKI devices use isochronous USB transfers while MKII use interrupt USB transfers.

With this change, at least Overwitch should start although it won't work, But I haven't tested myself.

$ git diff src/overbridge.c
diff --git a/src/overbridge.c b/src/overbridge.c
index 2a4cb26..d7e663c 100644
--- a/src/overbridge.c
+++ b/src/overbridge.c
@@ -522,7 +522,7 @@ overbridge_init_priv (struct overbridge *ob, char *device_name)
     {
       return OB_CANT_CLAIM_IF;
     }
-  ret = libusb_set_interface_alt_setting (ob->device, 1, 3);
+  ret = libusb_set_interface_alt_setting (ob->device, 0, 7);
   if (LIBUSB_SUCCESS != ret)
     {
       return OB_CANT_SET_ALT_SETTING;
@@ -532,7 +532,7 @@ overbridge_init_priv (struct overbridge *ob, char *device_name)
     {
       return OB_CANT_CLAIM_IF;
     }
-  ret = libusb_set_interface_alt_setting (ob->device, 2, 2);
+  ret = libusb_set_interface_alt_setting (ob->device, 1, 7);
   if (LIBUSB_SUCCESS != ret)
     {
       return OB_CANT_SET_ALT_SETTING;
dRAT3 commented 1 year ago

Overwitch is compiling, it connects to Jack but doesn't see the Rytm. I still have to make a devices.json file, I don't know what to put in it since in/out is user configurable.

dRAT3 commented 1 year ago

Maybe this will help?

[user@Laptop ~]$ lsusb -d 1935:0008 -v
Couldn't open device, some information will be missing
Bus 003 Device 002: ID 1935:0008 Elektron Music Machines Elektron Analog Rytm
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x1935 Elektron Music Machines
  idProduct          0x0008 
  bcdDevice            0.03
  iManufacturer           1 Elektron Music Machines
  iProduct                2 Elektron Analog Rytm
  iSerial                 3 000000000001
  bNumConfigurations      2
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x019e
    bNumInterfaces          5
    bConfigurationValue     2
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                6mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         3
      bFunctionClass        255 Vendor Specific Class
      bFunctionSubClass       0 
      bFunctionProtocol       0 
      iFunction               0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0006  1x 6 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x00ca  1x 202 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       3
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x012c  1x 300 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       4
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x018e  1x 398 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       5
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0252  1x 594 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       6
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0316  1x 790 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       7
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0378  1x 888 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0068  1x 104 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x012c  1x 300 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       3
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x018e  1x 398 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       4
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x01f0  1x 496 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       5
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x02b4  1x 692 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       6
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0378  1x 888 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       7
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x03da  1x 986 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         3
      bInterfaceCount         3
      bFunctionClass        255 Vendor Specific Class
      bFunctionSubClass       0 
      bFunctionProtocol       0 
      iFunction               0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength       0x0009
        bInCollection           1
        baInterfaceNr(0)        4
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      3 MIDI Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      MIDIStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength       0x0041
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                 2
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                 3
        bNrInputPins            1
        baSourceID( 0)          2
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                 4
        bNrInputPins            1
        baSourceID( 0)          1
        BaSourcePin( 0)         1
        iJack                   0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (Invalid)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       1
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (Invalid)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       3
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0156
    bNumInterfaces          5
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                6mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0006  1x 6 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x00ca  1x 202 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       3
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x012c  1x 300 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       4
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x018e  1x 398 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       5
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0252  1x 594 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       6
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0316  1x 790 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       7
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0378  1x 888 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0068  1x 104 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x012c  1x 300 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       3
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x018e  1x 398 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       4
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x01f0  1x 496 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       5
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x02b4  1x 692 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       6
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0378  1x 888 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       7
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x03da  1x 986 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
dagargo commented 1 year ago

Of course! We are working on the AF but the AR won't work on this branch just yet.

I'm taking a look right now at the lsusb output and looks like the enpoints, and therefore the code, are quite similar.

I've just pushed a commit adding the AR to the list of devices.

In order to make the AR to work, could configure your AR in the Overbridge panel to transmit 2 inputs and 4 outputs in 24 bits and try again?

dRAT3 commented 1 year ago

I did the overbridge thing, 2 in, 4 out, didn't work. Then I checked the OB_DEVICE def and saw it was wrong, I changed it and built again but it still doesn't see the AR. Change below.

index 8ac574d..d9ef459 100644
--- a/src/overwitch.c
+++ b/src/overwitch.c
@@ -154,7 +154,7 @@ static const struct ow_device_desc_static AFMKI_DESC = {
   .output_track_names = {"Track 1", "Track 2", "Track 3", "Track 4"}
 };

-static const struct ow_device_desc_static AFMKI_DESC = {
+static const struct ow_device_desc_static ARMKI_DESC = {
   .pid = ARMK1_PID,
   .name = "Analog Rytm MKI",
   .inputs = 2,
@@ -167,7 +167,7 @@ static const struct ow_device_desc_static AFMKI_DESC = {
 static const struct ow_device_desc_static *OB_DEVICE_DESCS[] = {
   // &DIGITAKT_DESC, &DIGITONE_DESC, &AFMK2_DESC, &ARMK2_DESC, &DKEYS_DESC,
   // &AHMK1_DESC, &AHMK2_DESC, &STAKT_DESC, NULL
-  &AFMKI_DESC, &AFMKI_DESC, NULL
+  &AFMKI_DESC, &ARMKI_DESC, NULL
 };
 #endif
dagargo commented 1 year ago

That's right, of course.

What happens if you remove the reference to AF on line 171?

dagargo commented 1 year ago

BTW, don't forget to set your device in Over bridge mode.

dRAT3 commented 1 year ago

Device is in OB Mode, I had forgot to install the udev rules, it's done now, I rebooted but alas overwitch doesn't see the device, neither does overwitch-cli and I removed the reference.

dagargo commented 1 year ago

Pushed a commit to fix the previous compilation error. Really sorry. I have to be more careful.

A couple of things. You haven't posted the output of overwitch-cli -vv or maybe there is no output at all. Quite possibly, the reason for this is that the project is configured to read the JSON files instead of the C files. (You were using the JSON devices file and we added no changes there.) Besides this, let's focus on the CLI for now.

Compile it without JSON support by running these commands and post the output of overwitch-cli -vv.

$ ./configure CLI_ONLY=yes JSON_DEVS_FILE=no
$ make && sudo make install

With this, MIDI thru Overbridge should work.

dRAT3 commented 1 year ago

Woohoo, progress!

[user@Laptop overwitch]$ overwitch-cli -vv
DEBUG:overwitch.c:249:(ow_get_usb_device_list): Found Analog Rytm MKI (bus 001, address 005, ID 1935:0008)
DEBUG:engine.c:621:(ow_detach_driver): No kernel driver active on interface 0
DEBUG:engine.c:621:(ow_detach_driver): No kernel driver active on interface 1
DEBUG:engine.c:621:(ow_detach_driver): No kernel driver active on interface 2
DEBUG:engine.c:621:(ow_detach_driver): No kernel driver active on interface 3
DEBUG:engine.c:621:(ow_detach_driver): No kernel driver active on interface 4
DEBUG:engine.c:537:(ow_engine_init_mem): o2p: USB in frame size: 16 B
DEBUG:engine.c:538:(ow_engine_init_mem): p2o: USB out frame size: 8 B
DEBUG:engine.c:547:(ow_engine_init_mem): o2p: USB in block size: 144 B
DEBUG:engine.c:549:(ow_engine_init_mem): p2o: USB out block size: 88 B
DEBUG:engine.c:557:(ow_engine_init_mem): o2p: audio transfer size: 224 B
DEBUG:engine.c:559:(ow_engine_init_mem): p2o: audio transfer size: 112 B
DEBUG:jclient.c:102:(jclient_set_buffer_size_cb): JACK buffer size: 1024
DEBUG:resampler.c:539:(ow_resampler_set_buffer_size): resampler buffer size: 1024
DEBUG:resampler.c:161:(ow_resampler_reset_dll): Resetting the DLL...
DEBUG:dll.c:114:(ow_dll_primary_reset): Target delay: 32.6 ms (1564 frames)
DEBUG:jclient.c:112:(jclient_set_sample_rate_cb): JACK sample rate: 48000
DEBUG:resampler.c:552:(ow_resampler_set_samplerate): resampler sample rate: 48000
DEBUG:resampler.c:161:(ow_resampler_reset_dll): Resetting the DLL...
DEBUG:dll.c:114:(ow_dll_primary_reset): Target delay: 32.6 ms (1564 frames)
DEBUG:jclient.c:112:(jclient_set_sample_rate_cb): JACK sample rate: 48000
DEBUG:jclient.c:502:(jclient_run): Using RT priority 5...
DEBUG:engine.c:1152:(ow_engine_start): Starting p2o MIDI thread...
DEBUG:engine.c:1165:(ow_engine_start): Starting audio and o2p MIDI thread...
DEBUG:jclient.c:102:(jclient_set_buffer_size_cb): JACK buffer size: 1024
DEBUG:resampler.c:348:(ow_resampler_compute_ratios): Booting Overbridge side...
DEBUG:resampler.c:359:(ow_resampler_compute_ratios): Starting up resampler...
Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 7.223693, avg. 5.054345
DEBUG:resampler.c:407:(ow_resampler_compute_ratios): Tuning resampler...
Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 7.303035, avg. 7.239380
Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 7.665807, avg. 7.465781
Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 8.136931, avg. 7.904599
Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 8.569360, avg. 8.366774
...

Tried to use sherlock midi inspector to see if any MIDI data was going out, for now no luck, have to check my settings/ how to send midi on the AR

dagargo commented 1 year ago

Finally we're seeing some progress!

And you're having audio too! But it isn't working well just yet. The ratio should be around 1.0 as both JACK and the AR at working at 48 KHz.

Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 7.223693, avg. 5.054345
Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 7.303035, avg. 7.239380
Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 7.665807, avg. 7.465781
Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 8.136931, avg. 7.904599
Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 8.569360, avg. 8.366774

I'm taking a look at the ratios issue ATM. If it's increasing is because we are providing the JACK client with less samples than agreed.

In the meantime, could you check it this patch works?

$ git diff
diff --git a/src/engine.c b/src/engine.c
index 6ccc831..c6e6a25 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -62,9 +62,7 @@ ow_engine_init_name (struct ow_engine *engine, uint8_t bus, uint8_t address)
 {
   snprintf (engine->name, OW_LABEL_MAX_LEN, "%s@%03d,%03d",
            engine->device_desc.name, bus, address);
-  // ow_engine_load_overbridge_name (engine);
-  strncpy (engine->overbridge_name, "Analog Four MKI",
-          strlen ("Analog Four MKI") + 1);
+  ow_engine_load_overbridge_name (engine);
 }

The goal of this patch is to check if the control transfers work after solving the driver issues we had a few days ago. We are just restoring the code we had on the master branch. If so, you'll be able to get and set the custom Overbridge device name.

dRAT3 commented 1 year ago

I can confirm midi is working, audio doesn't come through when hooking up the outputs to playback or into ardour/other audio tools.

Edit: Haven't done the patch yet, will do now

dagargo commented 1 year ago

I've checked the new isochronous transfer code and changed a few things to perhaps fix the audio support.

Could you check this out?

As a side note, we'll need to check if we can use other descriptors to decrease the size of wMaxPacketSize at some point.

Haven't done the patch yet, will do now

Any luck with the path, @dRAT3?

dRAT3 commented 1 year ago

I cloned the new version and get the following error:

ERROR:engine.c:350:(cb_xfr_audio_in): o2p: Error on USB audio transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:371:(cb_xfr_audio_out): p2o: Error on USB audio transfer: LIBUSB_TRANSFER_TIMED_OUT

And the patch works, it now shows up as analog Rytm in Jack

dRAT3 commented 1 year ago

In between the Errors it gives the usual messages, the ratio has been close to one sometimes, then the other time it goes all the way to an average of 16. But no sound ever


[user@Laptop overwitch]$ overwitch-cli -n 0 -v
DEBUG:overwitch.c:247:(ow_get_usb_device_list): Found Analog Rytm MKI (bus 003, address 003, ID
1935:0008)
DEBUG:engine.c:623:(ow_detach_driver): No kernel driver active on interface 0
DEBUG:engine.c:623:(ow_detach_driver): No kernel driver active on interface 1
DEBUG:engine.c:623:(ow_detach_driver): No kernel driver active on interface 2
DEBUG:engine.c:623:(ow_detach_driver): No kernel driver active on interface 3
DEBUG:engine.c:623:(ow_detach_driver): No kernel driver active on interface 4
DEBUG:engine.c:1329:(ow_engine_load_overbridge_name): USB control in data (32 B): Analog Rytm
DEBUG:engine.c:1349:(ow_engine_load_overbridge_name): USB control in data (16 B): 0134       1.61E
DEBUG:resampler.c:539:(ow_resampler_set_buffer_size): resampler buffer size: 1024
DEBUG:resampler.c:552:(ow_resampler_set_samplerate): resampler sample rate: 48000
DEBUG:jclient.c:502:(jclient_run): Using RT priority 5...
DEBUG:engine.c:1154:(ow_engine_start): Starting p2o MIDI thread...
DEBUG:engine.c:1167:(ow_engine_start): Starting audio and o2p MIDI thread...
ERROR:engine.c:348:(cb_xfr_audio_in): o2p: Error on USB audio transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:369:(cb_xfr_audio_out): p2o: Error on USB audio transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:348:(cb_xfr_audio_in): o2p: Error on USB audio transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:369:(cb_xfr_audio_out): p2o: Error on USB audio transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:348:(cb_xfr_audio_in): o2p: Error on USB audio transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:369:(cb_xfr_audio_out): p2o: Error on USB audio transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:348:(cb_xfr_audio_in): o2p: Error on USB audio transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:369:(cb_xfr_audio_out): p2o: Error on USB audio transfer: LIBUSB_TRANSFER_TIMED_OUT
^C
Analog Rytm MKI@003,003: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.003424, avg. 0.000000
...
dagargo commented 1 year ago

I've just pushed some changes. Definitely there were some wrong things in the USB callbacks.

Does this make audio to work?

dRAT3 commented 1 year ago

Audio still not working, but output seems better:

[user@Laptop overwitch]$ overwitch-cli -n 0 -vv
DEBUG:overwitch.c:258:(ow_get_usb_device_list): Found Analog Rytm MKI (bus 003, address 002, ID
1935:0008)
DEBUG:engine.c:705:(ow_detach_driver): No kernel driver active on interface 0
DEBUG:engine.c:705:(ow_detach_driver): No kernel driver active on interface 1
DEBUG:engine.c:705:(ow_detach_driver): No kernel driver active on interface 2
DEBUG:engine.c:698:(ow_detach_driver): Kernel driver active on interface 3. Detaching...
DEBUG:engine.c:698:(ow_detach_driver): Kernel driver active on interface 4. Detaching...
DEBUG:engine.c:621:(ow_engine_init_mem): o2p: USB in frame size: 16 B
DEBUG:engine.c:622:(ow_engine_init_mem): p2o: USB out frame size: 8 B
DEBUG:engine.c:631:(ow_engine_init_mem): o2p: USB in block size: 144 B
DEBUG:engine.c:633:(ow_engine_init_mem): p2o: USB out block size: 88 B
DEBUG:engine.c:641:(ow_engine_init_mem): o2p: audio transfer size: 2688 B
DEBUG:engine.c:643:(ow_engine_init_mem): p2o: audio transfer size: 1344 B
DEBUG:engine.c:1444:(ow_engine_load_overbridge_name): USB control in data (32 B): Analog Rytm
DEBUG:engine.c:1464:(ow_engine_load_overbridge_name): USB control in data (16 B): 0134       1.61E
DEBUG:jclient.c:102:(jclient_set_buffer_size_cb): JACK buffer size: 1024
DEBUG:resampler.c:539:(ow_resampler_set_buffer_size): resampler buffer size: 1024
DEBUG:resampler.c:161:(ow_resampler_reset_dll): Resetting the DLL...
DEBUG:dll.c:114:(ow_dll_primary_reset): Target delay: 39.0 ms (1872 frames)
DEBUG:jclient.c:112:(jclient_set_sample_rate_cb): JACK sample rate: 48000
DEBUG:resampler.c:552:(ow_resampler_set_samplerate): resampler sample rate: 48000
DEBUG:resampler.c:161:(ow_resampler_reset_dll): Resetting the DLL...
DEBUG:dll.c:114:(ow_dll_primary_reset): Target delay: 39.0 ms (1872 frames)
DEBUG:jclient.c:112:(jclient_set_sample_rate_cb): JACK sample rate: 48000
DEBUG:jclient.c:502:(jclient_run): Using RT priority 5...
DEBUG:engine.c:1269:(ow_engine_start): Starting p2o MIDI thread...
DEBUG:engine.c:1282:(ow_engine_start): Starting audio and o2p MIDI thread...
DEBUG:jclient.c:102:(jclient_set_buffer_size_cb): JACK buffer size: 1024
DEBUG:resampler.c:348:(ow_resampler_compute_ratios): Booting Overbridge side...
ERROR:engine.c:436:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:405:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:436:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:405:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:436:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:405:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:436:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:405:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:436:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:405:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:436:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:405:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:436:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:405:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:436:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:405:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
DEBUG:resampler.c:359:(ow_resampler_compute_ratios): Starting up resampler...
Analog Rytm MKI@003,002: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999746, avg. 1.000086
DEBUG:resampler.c:407:(ow_resampler_compute_ratios): Tuning resampler...
Analog Rytm MKI@003,002: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000028, avg. 0.999989
Analog Rytm MKI@003,002: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000040, avg. 1.000059
Analog Rytm MKI@003,002: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms,
...

It keeps repeating with a stable ratio of around 1

P.S. you forgot to include errno.h in overwitch.c

dagargo commented 1 year ago

It keeps repeating with a stable ratio of around 1

This is very good news as the required sample count is the same as the provided one. The synchronization, which is provided by the USB controller, is working well.

I'll take another look at the code just in case the data is not copied properly to and from the buffers.

P.S. you forgot to include errno.h in overwitch.c

This is weird. It's been reported already in #42 but couldn't replicate the error. I'll take a deeper look.

dRAT3 commented 1 year ago

Might be something wrong on my end, btw I run a non systemd system. So not all the udev stuff was installed properly, could that have sonething to do with no audio? I'm going to move back to regular arch one of these days though cause I need the bitwig from the aur instead of the flatpak

dagargo commented 1 year ago

could that have sonething to do with no audio?

No idea but I'd say it's unlikely. I guess you already have a working audio interface, don't you? OTOH, if MIDI is working, I don't think it's a permission or configuration issue as the same USB device is used.

You'll need to patch the JACK client outputs to some inputs into your audio device. But surely you knew this already.

Code looks nice. :disappointed:

BTW, the mki branch now is compatible with Overbridge 1 and 2 devices (it works with my Digitakt). And it's possible for you to run ./configure without any parameter and run the GUI.

dagargo commented 1 year ago

As we don't know exactly what's going on under the hood, I've just added a not very intrusive error log when the block header is not the expected one.

This will allow us to check if the data JACK is receiving follows the Overbridge protocol specs. This will only apply to audio from the Overbridge device to the computer.

This is a simulation of the error.

ERROR:engine.c:207:(ow_engine_read_usb_input_blocks): o2p: Unexpected block header

Are you seeing any of these?

dRAT3 commented 1 year ago

Yes, I see a bunch of them before the ratio comes up

dagargo commented 1 year ago

But when the ratio stabilizes around 1.0 (it should be very close), you don't see any, right?

Could you post here the output until the reaches 1.0?

This is my output with -v. Don't use -vv.

$ overwitch-cli -v 
DEBUG:overwitch.c:358:(ow_get_device_desc_from_vid_pid): Failed to open file “/home/david/.config/overwitch/devices.json”: No such file or directory
DEBUG:overwitch.c:364:(ow_get_device_desc_from_vid_pid): Falling back to /usr/local/share/overwitch/devices.json...
DEBUG:overwitch.c:423:(ow_get_device_desc_from_vid_pid): Device with PID 12 found
DEBUG:overwitch.c:257:(ow_get_usb_device_list): Found Digitakt (bus 001, address 093, ID 1935:000c)
DEBUG:overwitch.c:358:(ow_get_device_desc_from_vid_pid): Failed to open file “/home/david/.config/overwitch/devices.json”: No such file or directory
DEBUG:overwitch.c:364:(ow_get_device_desc_from_vid_pid): Falling back to /usr/local/share/overwitch/devices.json...
DEBUG:overwitch.c:423:(ow_get_device_desc_from_vid_pid): Device with PID 12 found
DEBUG:engine.c:712:(ow_detach_driver): No kernel driver active on interface 0
[...]
DEBUG:engine.c:712:(ow_detach_driver): No kernel driver active on interface 5
DEBUG:engine.c:1451:(ow_engine_load_overbridge_name): USB control in data (32 B): Digitakt
DEBUG:engine.c:1471:(ow_engine_load_overbridge_name): USB control in data (16 B): 0073       1.40A
DEBUG:resampler.c:539:(ow_resampler_set_buffer_size): resampler buffer size: 64
DEBUG:resampler.c:552:(ow_resampler_set_samplerate): resampler sample rate: 48000
DEBUG:jclient.c:502:(jclient_run): Using RT priority 5...
DEBUG:engine.c:1276:(ow_engine_start): Starting p2o MIDI thread...
DEBUG:engine.c:1289:(ow_engine_start): Starting audio and o2p MIDI thread...
Digitakt@001,093: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000026, avg. 0.999896
Digitakt@001,093: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999900, avg. 0.999924
Digitakt@001,093: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999894, avg. 0.999890
Digitakt@001,093: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999884, avg. 0.999882
Digitakt@001,093: o2p latency:  0.8 ms, max.  1.5 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999886, avg. 0.999887
Digitakt@001,093: o2p latency:  0.4 ms, max.  1.6 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999882, avg. 0.999886
Digitakt@001,093: o2p latency:  0.8 ms, max.  1.6 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999882, avg. 0.999882
Digitakt@001,093: o2p latency:  0.4 ms, max.  1.6 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999881, avg. 0.999880
Digitakt@001,093: o2p latency:  0.8 ms, max.  1.6 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999879, avg. 0.999879
Digitakt@001,093: o2p latency:  0.5 ms, max.  1.6 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999877, avg. 0.999879
^CDigitakt@001,093: o2p latency:  0.4 ms, max.  1.6 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999879, avg. 0.999879
DEBUG:jclient.c:604:(jclient_run): Exiting...

Do you get to a point where o2p latency is a positive value? This would mean the system is stable enough to run. Once this point is reached no other errors should appear.

dagargo commented 1 year ago

P.S. you forgot to include errno.h in overwitch.c

Fixed in 4b9d3d197a1e49a65d12ff6512085561beecbd1c.

dRAT3 commented 1 year ago

o2p latency starts at -1ms then goes to 0ms and stays there, p2o latency stays at -1ms

dagargo commented 1 year ago

o2p latency starts at -1ms then goes to 0ms and stays there, p2o latency stays at -1ms

Not greater than 0 ms?

Overwitch uses audio from the device to the computer to calculate the resampling ratio, this is why o2p latency is what is used to indicate that the audio is flowing. OTOH, audio in the opposite direction flows only if there is something connected to the client inputs (this saves some computations if the inputs are not used) so it's perfectly right if it says -1.0 ms.

What it happens is that it takes a few seconds to the ratio to be stable enough to really push the audio data thru the internal buffers. The samples in the internal buffers are the measure of the latency at certain moment.

This is the moment, the audio is starting to flow.

Digitakt@001,093: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999884, avg. 0.999882
Digitakt@001,093: o2p latency:  0.8 ms, max.  1.5 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999886, avg. 0.999887

Yes, I see a bunch of them before the ratio comes up

I think I misunderstood this before.

Please, post the output of overwitch-cli -v to check if everything looks right.

dRAT3 commented 1 year ago

DEBUG:overwitch.c:358:(ow_get_device_desc_from_vid_pid): Failed to open file “/home/user/.config/overwitch/devices.json”: No such file or directory
DEBUG:overwitch.c:364:(ow_get_device_desc_from_vid_pid): Falling back to /usr/local/share/overwitch/devices.json...
DEBUG:overwitch.c:423:(ow_get_device_desc_from_vid_pid): Device with PID 8 found
DEBUG:overwitch.c:257:(ow_get_usb_device_list): Found Analog Rytm MKI (bus 001, address 005, ID 1935:0008)
DEBUG:overwitch.c:358:(ow_get_device_desc_from_vid_pid): Failed to open file “/home/user/.config/overwitch/devices.json”: No such file or directory
DEBUG:overwitch.c:364:(ow_get_device_desc_from_vid_pid): Falling back to /usr/local/share/overwitch/devices.json...
DEBUG:overwitch.c:423:(ow_get_device_desc_from_vid_pid): Device with PID 8 found
DEBUG:engine.c:712:(ow_detach_driver): No kernel driver active on interface 0
DEBUG:engine.c:712:(ow_detach_driver): No kernel driver active on interface 1
DEBUG:engine.c:712:(ow_detach_driver): No kernel driver active on interface 2
DEBUG:engine.c:712:(ow_detach_driver): No kernel driver active on interface 3
DEBUG:engine.c:712:(ow_detach_driver): No kernel driver active on interface 4
DEBUG:engine.c:1451:(ow_engine_load_overbridge_name): USB control in data (32 B): Analog Rytm
DEBUG:engine.c:1471:(ow_engine_load_overbridge_name): USB control in data (16 B): 0134       1.61E
DEBUG:resampler.c:539:(ow_resampler_set_buffer_size): resampler buffer size: 1024
DEBUG:resampler.c:552:(ow_resampler_set_samplerate): resampler sample rate: 48000
DEBUG:jclient.c:502:(jclient_run): Using RT priority 5...
DEBUG:engine.c:1276:(ow_engine_start): Starting p2o MIDI thread...
DEBUG:engine.c:1289:(ow_engine_start): Starting audio and o2p MIDI thread...
ERROR:engine.c:443:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:412:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:443:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:412:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:443:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:412:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:443:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:412:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:443:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:412:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:443:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:412:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:443:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:412:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:443:(cb_xfr_audio_out): p2o: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
ERROR:engine.c:412:(cb_xfr_audio_in): o2p: Error on transfer: LIBUSB_TRANSFER_TIMED_OUT
Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999983, avg. 1.000115
Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000005, avg. 1.000011
Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000022, avg. 1.000018
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000022, avg. 1.000021
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000008, avg. 1.000016
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000000, avg. 1.000003
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000011, avg. 1.000007
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000010, avg. 1.000009
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000001, avg. 1.000007
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000007, avg. 1.000005
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000005, avg. 1.000004
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000012, avg. 1.000009
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000010, avg. 1.000009
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000012, avg. 1.000010
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000010, avg. 1.000013
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000005, avg. 1.000007
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 0.999998, avg. 1.000001
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000006, avg. 1.000002
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000008, avg. 1.000006
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000008, avg. 1.000010
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000006, avg. 1.000008
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000010, avg. 1.000006
^CAnalog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000010, avg. 1.000006```
dagargo commented 1 year ago
Analog Rytm MKI@001,005: o2p latency: -1.0 ms, max. -1.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000022, avg. 1.000018
Analog Rytm MKI@001,005: o2p latency:  0.0 ms, max.  0.0 ms; p2o latency: -1.0 ms, max. -1.0 ms, o2p ratio: 1.000022, avg. 1.000021

Thanks, this makes it a lot clearer to me.

The ratios are OK, so are the transfers. It's just that there are no audio samples in there. I'll take another look at the code because it seems that it's my bad

dagargo commented 1 year ago

Definitely, there is a timeout when receiving the USB data and this is causing to not resubmit the transfers.

I've increased the timeout and resubmit the transfers even in case of error.

Could you try this and post the output with -vv?

cpacejo commented 8 months ago

Hi, I have an Analog Rytm MKI and I'd love to help get it working with overwitch. (I do have extensive C coding experience, though no experience with USB.) I did try just now with the mki branch, I just get a whole mess of ERROR:engine.c:207:(ow_engine_read_usb_input_blocks): o2p: Unexpected block header errors and glitchy sounds from the Rytm whether I play or record:

$ overwitch-record -n 0 -v
DEBUG:overwitch.c:359:(ow_get_device_desc_from_vid_pid): Failed to open file “/home/chris/.config/overwitch/devices.json”: No such file or directory
DEBUG:overwitch.c:365:(ow_get_device_desc_from_vid_pid): Falling back to /usr/local/share/overwitch/devices.json...
DEBUG:overwitch.c:424:(ow_get_device_desc_from_vid_pid): Device with PID 8 found
DEBUG:overwitch.c:258:(ow_get_usb_device_list): Found Analog Rytm MKI (bus 003, address 020, ID 1935:0008)
DEBUG:overwitch.c:359:(ow_get_device_desc_from_vid_pid): Failed to open file “/home/chris/.config/overwitch/devices.json”: No such file or directory
DEBUG:overwitch.c:365:(ow_get_device_desc_from_vid_pid): Falling back to /usr/local/share/overwitch/devices.json...
DEBUG:overwitch.c:424:(ow_get_device_desc_from_vid_pid): Device with PID 8 found
DEBUG:engine.c:710:(ow_detach_driver): No kernel driver active on interface 0
DEBUG:engine.c:710:(ow_detach_driver): No kernel driver active on interface 1
DEBUG:engine.c:710:(ow_detach_driver): No kernel driver active on interface 2
DEBUG:engine.c:710:(ow_detach_driver): No kernel driver active on interface 3
DEBUG:engine.c:710:(ow_detach_driver): No kernel driver active on interface 4
DEBUG:engine.c:1449:(ow_engine_load_overbridge_name): USB control in data (32 B): Analog Rytm
DEBUG:engine.c:1469:(ow_engine_load_overbridge_name): USB control in data (16 B): 0134       1.61E
DEBUG:main-record.c:279:(run_record): Creating sample (4 channels)...
DEBUG:engine.c:1287:(ow_engine_start): Starting audio and o2p MIDI thread...
ERROR:engine.c:207:(ow_engine_read_usb_input_blocks): o2p: Unexpected block header
ERROR:engine.c:207:(ow_engine_read_usb_input_blocks): o2p: Unexpected block header
ERROR:engine.c:207:(ow_engine_read_usb_input_blocks): o2p: Unexpected block header
ERROR:engine.c:207:(ow_engine_read_usb_input_blocks): o2p: Unexpected block header
ERROR:engine.c:207:(ow_engine_read_usb_input_blocks): o2p: Unexpected block header
ERROR:engine.c:207:(ow_engine_read_usb_input_blocks): o2p: Unexpected block header
ERROR:engine.c:207:(ow_engine_read_usb_input_blocks): o2p: Unexpected block header
dagargo commented 8 months ago

I've just rebased the mki branch to update the code to the latest commits from master.

I don't remember exactly were we left this. So, in no particular order let me mention a few things.


So, first thing to do would be to check if the transfers share the same structure.

To do so, I'd recommend you to work with the smallest possible configuration for your device. For instance, set up your Overbridge device to use 2 input tracks and 4 output tracks and 24 bits depth Do this via Overbridge on a PC or Mac.

Ideally, you'll want to capture some USB packets (transfers) with Wireshark on a PC or Mac while Overbridge is running. As USB transfers are always controlled by the host this can not be done on Overwitch. Once you get some packets, let's check that the packet size and structure match the MKII.

I suspect that being the USB bandwidth a known issue with MKI devices, samples will not use 32 bits as in the MKII case. But this is just a wild guess.

https://github.com/dagargo/overwitch/blob/1689d715f46d3ae5c6f297b162711c37f2ad4147/src/engine.h#L45-L69

I'm open to questions but I'm no expert on Wireshark so you'll probably need to figure a few things on your own.

Once we had verified this, we could move to properly send the transfers to the USB controller, which I know it was never verified.