dagargo / overwitch

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

Add input and output MIDI ports for the Overbridge message protocol #44

Open dagargo opened 1 year ago

dagargo commented 1 year ago

Perhaps it's useful for other people have access to what it looks like the internal Overbridge message protocol.

Audio and MIDI are already available thru their respective ports. What we are talking about here is the data needed to synchronize the Overbridge plugins with the devices such as knob position or active step.

The unknown bytes in the USB blocks can be easily arranged in blocks of 128 bytes. Here you see 2 consecutive blocks from my Digitakt while being stopped.

e0 00 23 aa e9 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 00 32 00  00 32 00 00 32 00 00 32
00 00 32 00 00 32 00 00  32 00 00 32 00 00 32 00
00 32 00 00 32 00 00 32  00 00 32 00 00 32 00 00
32 00 00 32 00 00 00 00  00 00 00 00 00 00 00 ef
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 

e0 00 23 aa ea 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 01 00 00  00 00 00 00 00 00 00 32
00 00 32 00 00 32 00 00  32 00 00 32 00 00 32 00
00 32 00 00 32 00 00 32  00 00 32 00 00 32 00 00
32 00 00 32 00 00 00 00  00 00 00 00 00 00 00 ef
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 

Looks like there is an e0 xx yy zz tt header, where xx yy zz tt is a 4 bytes counter.

Data is only 80 bytes long (ending with a ef) and the last 48 bytes are zeros.

You can print these values with this patch.

$ git diff
diff --git a/src/engine.c b/src/engine.c
index e972c71..c3a2c60 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -206,6 +206,10 @@ ow_engine_read_usb_input_blocks (struct ow_engine *engine)
        {
          error_print ("o2p: Unexpected block header\n");
        }
+      for (int w = 0; w < OB_PADDING_LEN; w++) {
+              printf("%02x ", blk->padding[w]);
+      }
+      printf("\n");
       s = blk->data;
       for (int j = 0; j < OB_FRAMES_PER_BLOCK; j++)
        {

It's not sure if this would be implemented as we need to know what's really going on under. But we can create a branch.

These two blocks are with the Digitakt playing.

e0 00 60 f7 c8 19 73 00  00 00 00 00 00 00 00 43
78 00 00 00 00 01 00 00  00 00 00 00 00 00 00 4f
00 00 4f 00 00 4f 00 00  4f 00 00 4f 00 00 4f 00
00 4f 00 00 4f 00 00 4f  00 00 4f 00 00 4f 00 00
4f 00 00 4f 00 00 00 d4  00 00 00 00 00 00 00 ef
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00

e0 00 60 f7 c9 19 82 00  00 00 00 00 00 00 00 43
9f 00 00 00 00 00 50 00  00 50 00 00 50 00 00 50
00 00 50 00 00 50 00 00  50 00 00 50 00 00 50 00
00 50 00 00 50 00 00 50  00 00 50 00 00 50 00 00
50 00 00 50 00 00 00 d2  00 00 00 00 00 00 00 ef
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00