New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual device #41

Merged
merged 122 commits into from Oct 2, 2017
Commits
Jump to file or symbol
Failed to load files and symbols.
+55 −1
Diff settings

Always

Just for now

Viewing a subset of changes. View all

s2mk2: add slider static info

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
  • Loading branch information...
harryhaaren committed Sep 7, 2017
commit 7c78c004677b3154557e8f22f84007407222ee13
Copy path View file
@@ -35,6 +35,7 @@ CTLRA_DEVICE_DECL(ni_maschine_jam);
CTLRA_DEVICE_DECL(akai_apc);
CTLRA_DEVICE_DECL(avtka);
CTLRA_DEVICE_INFO(ni_kontrol_s2_mk2);
CTLRA_DEVICE_INFO(ni_kontrol_z1);
CTLRA_DEVICE_INFO(ni_maschine_mikro_mk2);
@@ -244,7 +245,8 @@ ctlra_dev_match_usb_hid(struct ctlra_dev_id_t *id)
int vendor = id->usb_hid.vendor_id;
int device = id->usb_hid.device_id;
/* TODO: iter registered static info structs, return if match */
return &CTLRA_DEVICE_INFO_NAME(ni_kontrol_z1);
return &CTLRA_DEVICE_INFO_NAME(ni_kontrol_s2_mk2);
//return &CTLRA_DEVICE_INFO_NAME(ni_kontrol_z1);
//return &CTLRA_DEVICE_INFO_NAME(ni_maschine_mikro_mk2);
}
@@ -185,6 +185,40 @@ static const struct ni_kontrol_s2_mk2_ctlra_t sliders[] = {
};
#define SLIDERS_SIZE (sizeof(sliders) / sizeof(sliders[0]))
#define DIAL_CENTER (CTLRA_ITEM_DIAL | CTLRA_ITEM_CENTER_NOTCH)
static struct ctlra_item_info_t sliders_info[] = {
/* crossfader, pitch L, pitch R */
{.x = 195, .y = 285, .w = 50, .h = 20, .flags = CTLRA_ITEM_FADER},
{.x = 10, .y = 230, .w = 20, .h = 80, .flags = CTLRA_ITEM_FADER},
{.x = 410, .y = 230, .w = 20, .h = 80, .flags = CTLRA_ITEM_FADER},
/* cue mix, remix, main level, level (back panel) */
{.x = 330, .y = 330, .w = 14, .h = 14, .flags = DIAL_CENTER},
{.x = 210, .y = 102, .w = 18, .h = 18, .flags = DIAL_CENTER},
{.x = 210, .y = 60, .w = 18, .h = 18, .flags = CTLRA_ITEM_DIAL},
{.x = 195, .y = 5, .w = 18, .h = 18, .flags = CTLRA_ITEM_DIAL},
/* Fader L, fader R */
{.x = 170, .y = 220, .w = 20, .h = 50, .flags = CTLRA_ITEM_FADER},
{.x = 250, .y = 220, .w = 20, .h = 50, .flags = CTLRA_ITEM_FADER},
/* FX L Dry, 1, 2, 3 */
{.x = 15, .y = 60, .w = 18, .h = 18, .flags = DIAL_CENTER},
{.x = 50, .y = 60, .w = 18, .h = 18, .flags = DIAL_CENTER},
{.x = 82, .y = 60, .w = 18, .h = 18, .flags = DIAL_CENTER},
{.x = 115, .y = 60, .w = 18, .h = 18, .flags = DIAL_CENTER},
/* FX R Dry, 1, 2, 3 */
{.x = 315, .y = 60, .w = 18, .h = 18, .flags = DIAL_CENTER},
{.x = 350, .y = 60, .w = 18, .h = 18, .flags = DIAL_CENTER},
{.x = 382, .y = 60, .w = 18, .h = 18, .flags = DIAL_CENTER},
{.x = 415, .y = 60, .w = 18, .h = 18, .flags = DIAL_CENTER},
/* EQ L Hi, Mid, Low */
{.x = 172, .y = 102, .w = 18, .h = 18, .flags = DIAL_CENTER},
{.x = 172, .y = 134, .w = 18, .h = 18, .flags = DIAL_CENTER},
{.x = 172, .y = 166, .w = 18, .h = 18, .flags = DIAL_CENTER},
/* EQ L Hi, Mid, Low */
{.x = 250, .y = 102, .w = 18, .h = 18, .flags = DIAL_CENTER},
{.x = 250, .y = 134, .w = 18, .h = 18, .flags = DIAL_CENTER},
{.x = 250, .y = 166, .w = 18, .h = 18, .flags = DIAL_CENTER},
};
static const struct ni_kontrol_s2_mk2_ctlra_t buttons[] = {
{NI_KONTROL_S2_MK2_BTN_DECKB_PLAY , 9, 0x01},
{NI_KONTROL_S2_MK2_BTN_DECKB_CUE , 9, 0x02},
@@ -539,6 +573,8 @@ ctlra_ni_kontrol_s2_mk2_connect(ctlra_event_func event_func,
dev->base.info.control_count[CTLRA_EVENT_BUTTON] = BUTTONS_SIZE;
dev->base.info.control_count[CTLRA_EVENT_SLIDER] = SLIDERS_SIZE;
dev->base.info.control_info[CTLRA_EVENT_SLIDER] = &sliders_info,
dev->base.info.get_name = ni_kontrol_s2_mk2_control_get_name;
int err = ctlra_dev_impl_usb_open(&dev->base,NI_VENDOR,
@@ -570,3 +606,19 @@ ctlra_ni_kontrol_s2_mk2_connect(ctlra_event_func event_func,
return 0;
}
struct ctlra_dev_info_t ctlra_ni_kontrol_s2_mk2_info = {
.vendor = "Native Instruments",
.device = "Kontrol S2 Mk2",
.vendor_id = NI_VENDOR,
.device_id = NI_KONTROL_S2_MK2,
.size_x = 440,
.size_y = 370, /* includes back and front panels */
.control_count[CTLRA_EVENT_BUTTON] = BUTTONS_SIZE,
.control_count[CTLRA_EVENT_SLIDER] = SLIDERS_SIZE,
//.control_info[CTLRA_EVENT_BUTTON] = &buttons_info,
.control_info[CTLRA_EVENT_SLIDER] = &sliders_info,
.get_name = ni_kontrol_s2_mk2_control_get_name,
};
ProTip! Use n and p to navigate between commits in a pull request.