快速登录:  

Forum: Old versions

话题: HID Definition implementation - Page: 2

由于该帖子的部分内容已年深日久,可能包含陈旧过时或描述错误的信息。

technzPRO InfinityMember since 2011
Used what?
 

发表时间 Thu 24 Jan 13 @ 5:37 pm
technzPRO InfinityMember since 2011
ignore my previous message, my phone thought that it would have some fun and hide all the tags and theoir content from me
 

发表时间 Thu 24 Jan 13 @ 10:22 pm
i noticed u have an HID and MIDI defs for the S2, so does VDJ let you use both at the same time? both use 1 mapper? how does it work?
 

发表时间 Fri 25 Jan 13 @ 2:00 pm
technzPRO InfinityMember since 2011
yeah, thats an interesting one.

they are actually two completely separate mappers and definitions.

HID identifies using VID and PID and has the name "Traktor Kontrol S2 HID"
and
MIDI identifies with device name and has the name "Traktor Kontrol S2 MIDI"

so VDJ allows both because as far as it thinks, each definition file is for a different device.
 

发表时间 Fri 25 Jan 13 @ 4:35 pm
Pretty interesting technique, but why split it like this? Is the control response much better with HID?

I'm working on this HID def. myself because the MIDI protocol on this particular device does not carry the advanced lighting control like the HID protocol does.
 

发表时间 Fri 25 Jan 13 @ 5:54 pm
technzPRO InfinityMember since 2011
I use HID for all the input because it in theory has a lower latency and allows me to use my sliders/knobs and jog wheels at a much higher resolution than traditional midi will allow.

Also it allows for many inputs to be sent at once without saturating the connection

also HID allows for out of the box use of the controller without the need for any changes in the NI controller manager.
 

发表时间 Fri 25 Jan 13 @ 6:09 pm
technzPRO InfinityMember since 2011
i have noticed that there seems to be a difference in the way that mac handles HID compared to PC.
mac seems to be taking the full report, even the first first 8 bits that PC seems to be ignoring.
eg the first input starts at 0x08 instead of 0x00.

and with PC it seems to omit the first 8 bits, so the first input starts at 0x00.

has anybody else noticed this, or has a remedy for it without having to map every function twice using is_pc and is_mac?
 

发表时间 Mon 28 Jan 13 @ 12:36 am
Normally it should be exactly the same for both PC and Mac, so a HID definition created on PC will work on Mac and vice-versa without any modifications. It's possible that the device you are using behaves differently when connected to a Mac, especially if it is a device that was designed/intended for exclusive use with a particular DJ software package.
 

发表时间 Mon 28 Jan 13 @ 4:41 am
technzPRO InfinityMember since 2011
im not sosure it does,whenever i sniff it with a tool such as usblyzer, the first 2 bytes are there... and when viewed in HID trace, they are gone.
 

发表时间 Mon 28 Jan 13 @ 4:52 am
HIDtrace only shows the actual data of the page that VirtualDJ acts on and you would define in your definition.

Using another tool will show the entire raw HID data.
 

发表时间 Mon 28 Jan 13 @ 5:30 am
Well, I'm slowly making progress with my project here, implementing HID is tough work :(

I stuck at the Jog Wheels...

X| 01234567 89ABCDEF
___________________
0| 00000001 00000000
1| 10000000 10000000
2| 11111100 11111111
...

Bits in RED correspond to the JogWheel, when I apply the ENDIAN command to fix the order of the MSB/LSB I end up with this:

11111111 11111100

so that looks good except that what do I do with the 00 to the right?

If I write this:
<jog bit="0x20" size="word" endian="little" min="4" max="65532" full="2430" deck="1" name="JOG" />

the system will process all 16-bits of the JOGWHEEL data but since the LSB are always zero isn't that effectively cutting the JOG resolution by 2 bits?

So... Would this be the normal behaviour and those 2 LSB are just too small to actually make any difference to be taken into consideration by the software?

Or otherwise how do I filter only the 14-bits that change and still achieve the swap of the MSB/LSB? With 14 bits the JOG resolution range will drop to 1-16383 but it should still be good right?

Please advise...
 

发表时间 Mon 28 Jan 13 @ 2:24 pm
technzPRO InfinityMember since 2011
from memory when i defined the jogs on the S2, i just pulles the smallest continual section section and used that, it provided the same sensitivity as using all of it, but didnt require any modification of the data

my definition has
<jog name="JOGWHEEL" bit="0x00" nbbits="8" deck="1" full="1120" />

i would recommend
<jog name="JOGWHEEL" bit="0x02" nbbits="8" deck="1" />
 

发表时间 Mon 28 Jan 13 @ 2:31 pm
humm, if I take the smallest chunk of continuos bits I would end up with only 6 bits of resolution since the last 2 bits never change. At 6 bits = max value of 63, that is just not enough steps to complete a single turn of the Jog. Based on my observations on this controller I would need at least 2394 steps to complete a single rotation.

What does ENDIAN="big" do?
 

发表时间 Mon 28 Jan 13 @ 6:55 pm
technzPRO InfinityMember since 2011
The amount of bits doesn't make it more accurate. Its the frequency of updates.
So if you use 4 bits or 10 bits. As long as they both update at the same time. Thy will both be as accurate.

Keeping in mind that the full rotation just counts incrimental steps. Not max value
 

发表时间 Mon 28 Jan 13 @ 6:57 pm
I'll play with the small chunk of bits tonight, I'll just have to zero-in the full="" value, otherwise 1 physical rotation on the wheel will not match the rotation in the software.
 

发表时间 Mon 28 Jan 13 @ 7:29 pm
technzPRO InfinityMember since 2011
i just got mac support working for the S2 using HID, no more stressing over it.

i feel so free now
 

发表时间 Tue 29 Jan 13 @ 2:01 am
After hours of poking around last night I figured out how to make those Jogs work properly, and I noticed a peculiar behaviour. I ended up using all 16 bits of resolution and what I noticed is that when the Jog is moved at low speed, the software focuses on the LSB for accurate response on slow movements and then it seems to read off he MSB when rotating the Jog at high speed. When using the bytes separately the Jogs just do not track properly. The key for me was finding the correct full rotation value (full="")

And now I'm stuck at the next brickwall, here is data:


X| 01234567 89ABCDEF
____________________
0| 00000011 00000000
1| 10000000 00000000
2| 11111100 11111111
3| 00000000 00000000
4| 10000000 00000000
5| 11111100 11111111
6| 00000000 00000000
7| 11111111 00000011


<page type="in">
<constant byte="0x00" value="0x03" />

<button bit="0x16" deck="1" name="JOG_TOUCH" />
<jog bit="0x20" size="word" ... deck="1" name="JOG" />

<button bit="0x46" deck="2" name="JOG_TOUCH" />
<jog bit="0x50" size="word" ... deck="2" name="JOG" />

<button bit="0x16" deck="3" name="JOG_TOUCH" />
<jog bit="0x20" size="word" ... deck="3" name="JOG" />

<button bit="0x46" deck="4" name="JOG_TOUCH" />
<jog bit="0x50" size="word" ... deck="4" name="JOG" />

<slider word="0x7" endian="little" max="0x03FF" name="CROSSFADER" />

</page>

All this data is in HID page 0x03 (brown bits)
Purple bits control decks A/C: bit order 10 for Deck A, 01 for Deck C
Pink bits control decks B/D: bit order 10 for Deck B, 01 for Deck D
Dark blue (2 bytes) control left JOG
Blue (2 bytes) control right JOG
Green (2 bytes) is the XFADER

I can't figure out the CONSTANT logic to activate each of the JOGs based how the bits controlling each individual deck are layered out. For example, in the code above, JOGs A and C will move simultaneously and so will B and D. If I make separate pages for A/B and C/D the code always executes the 1st page for A/B but never changes to the C/D page as the CONSTANT condition will always match for the 1st page even when the controller is set to Deck C/D. If I make a single page per JOG then it just cycles between the first 2 JOG pages in the order I put them in the XML.

<page type="in">
<constant byte="0x00" value="0x03" />
<constant bit="0x10" nbbits="1" value="0x1" />
<constant bit="0x40" nbbits="1" value="0x1" />

<button bit="0x16" deck="1" name="JOG_TOUCH" />
<jog bit="0x20" size="word" ... deck="1" name="JOG" />

<button bit="0x46" deck="2" name="JOG_TOUCH" />
<jog bit="0x50" size="word" ... deck="2" name="JOG" />

<slider word="0x7" endian="little" max="0x03FF" name="CROSSFADER" />

</page>

<page type="in">
<constant byte="0x00" value="0x03" />
<constant bit="0x10" nbbits="1" value="0x0" />
<constant bit="0x40" nbbits="1" value="0x0" />

<button bit="0x16" deck="3" name="JOG_TOUCH" />
<jog bit="0x20" size="word" ... deck="3" name="JOG" />

<button bit="0x46" deck="4" name="JOG_TOUCH" />
<jog bit="0x50" size="word" ... deck="4" name="JOG" />

<slider word="0x7" endian="little" max="0x03FF" name="CROSSFADER" />

</page>


Please help....
 

发表时间 Tue 29 Jan 13 @ 12:59 pm
humm... I must have been very tired last night, as I was typing the above I thought of the following...

<page type="in">
<constant byte="0x00" value="0x03" />
<constant bit="0x10" nbbits="2" value="0x2" />
<constant bit="0x40" nbbits="2" value="0x2" />
JOG A
JOG B
</page>

<page type="in">
<constant byte="0x00" value="0x03" />
<constant bit="0x10" nbbits="2" value="0x1" />
<constant bit="0x40" nbbits="2" value="0x2" />
JOG C
JOG B
</page>

<page type="in">
<constant byte="0x00" value="0x03" />
<constant bit="0x10" nbbits="2" value="0x2" />
<constant bit="0x40" nbbits="2" value="0x1" />
JOG A
JOG D
</page>

<page type="in">
<constant byte="0x00" value="0x03" />
<constant bit="0x10" nbbits="2" value="0x1" />
<constant bit="0x40" nbbits="2" value="0x1" />
JOG C
JOG D
</page>

I think that will work, will try again tonite. I guess it does help share your thoughts...
 

发表时间 Tue 29 Jan 13 @ 1:17 pm
ahh... the above worked like a charm. HID pages no longer overwrite each other. All buttons and controls are finished. Working on the indicators tonite. I'm hoping to be done by the weekend...
 

发表时间 Wed 30 Jan 13 @ 11:54 am
well, I am just 1 hurdle from finishing my definition file project and I need help...

I cannot get the DECK A/C and DECK B/D buttons to control the switchable decks (on the controller) and perform the deck_skin assign at the same time, it's either one or the other...

X| 01234567 89ABCDEF
____________________
0| 00000001 00000000
1| 10000000 00000000

Green = Constant bits for Deck on left
Red = Deck A/C buttons
Deck A bit order: 10*
Deck C bit order: 01*
(*both bits change at the same time)
I assigned the bit on the left as part of the CONSTANT to define DECK A on "1" and DECK C on "0" and attempted to use second bit to control the "leftdeck" function.


If I do the following:
<page type="in" >
<button bit="0x11" inverted="true" deck="1" name="SELECT_L" />
<button bit="0x11" deck="3" name="SELECT_L" />

</page>
<page type="in">
<constant byte="0x00" value="0x01" />
<constant bit="0x10" value="0x1" />


<button bit="0x18" deck="1" name="PLAY" />
<button bit="0x19" deck="1" name="CUE" />
...
</page>

The Deck A/C works perfectly and function "SELECT_L" is sent successfully to the mapper. However, the deck controls do not work because execution never leaves the root HID page.


If I do this instead:
<page type="in">
<constant byte="0x00" value="0x01" />
<constant bit="0x10" value="0x1" />


<button bit="0x11" inverted="true" deck="1" name="SELECT_L" />

<button bit="0x18" deck="1" name="PLAY" />
<button bit="0x19" deck="1" name="CUE" />
...
</page>

The deck controls work fine but the "SELECT_L" functions never makes it to the mapper. I suspect this is because the button element never sees a change of state on the bit because when there is change it also leaves the HID page.

Is there a way to fix this? Of is it simply that the design on this controller does not permit to have both functions.
 

发表时间 Wed 06 Feb 13 @ 3:14 am
53%