diff options
author | Thomas White <taw@physics.org> | 2019-06-26 09:18:22 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2019-06-27 23:02:59 +0200 |
commit | e07e0540e7b599e09fa009a4e2c165b01a7a34e3 (patch) | |
tree | b1d2f1e3d4ce812a4eac4493f051eae09c16a465 /src/nanolight.c | |
parent | c269b1fa9eaa247ef2b863367c249b996b4a01be (diff) |
New way of doing attributes
The program now has its own view of what it wants ("this position",
"this gobo" etc), and the fixture class contains instructions on how to
turn that view into DMX values.
Diffstat (limited to 'src/nanolight.c')
-rw-r--r-- | src/nanolight.c | 153 |
1 files changed, 67 insertions, 86 deletions
diff --git a/src/nanolight.c b/src/nanolight.c index 4751feb..cf6114c 100644 --- a/src/nanolight.c +++ b/src/nanolight.c @@ -48,7 +48,6 @@ static struct fixture *create_fixture(struct nanolight *nl, struct fixture_class const char *label, int universe, int base_addr) { struct fixture *fix; - int i; if ( nl->n_fixtures == nl->max_fixtures ) { struct fixture *fixtures_new; @@ -63,18 +62,25 @@ static struct fixture *create_fixture(struct nanolight *nl, struct fixture_class fix->universe = universe; fix->base_addr = base_addr; fix->cls = cls; - fix->attr_vals = calloc(cls->n_attrs, sizeof(int)); - fix->attr_vals_start = calloc(cls->n_attrs, sizeof(int)); - if ( (fix->attr_vals == NULL) - || (fix->attr_vals_start == NULL) ) - { - nl->n_fixtures--; - return NULL; - } - for ( i=0; i<cls->n_attrs; i++ ) { - fix->attr_vals[i] = cls->attrs[i].home; - } + fix->intensity = 0.0; + fix->cyan = 0.0; + fix->magenta = 0.0; + fix->yellow = 0.0; + fix->red = 0.0; + fix->green = 0.0; + fix->blue = 0.0; + fix->pan = 0.0; + fix->tilt = 0.0; + fix->gobo = 0; + fix->gobo_rotation = 0.5; + fix->gobo_spin = 0.0; + fix->prism = 0; + fix->prism_rotation = 0.5; + fix->prism_spin = 0.5; + fix->focus = 0.5; + fix->zoom = 0.5; + fix->frost = 0.0; return fix; } @@ -91,7 +97,6 @@ int main(int argc, char *argv[]) { struct nanolight nl; struct fixture_class cls; - struct attribute attrs[128]; int c; gtk_init(&argc, &argv); @@ -126,78 +131,54 @@ int main(int argc, char *argv[]) textdomain("nanolight"); /* Set up data structures */ - cls.name = "Dummy fixture"; - cls.n_attrs = 12; - cls.attrs = attrs; - - cls.attrs[0].cls = ATT_INTENSITY; - cls.attrs[0].props = 0; - cls.attrs[0].addr_offset = 49; - cls.attrs[0].home = 0; - - cls.attrs[1].cls = ATT_PAN; - cls.attrs[1].props = ATTR_16BIT; - cls.attrs[1].addr_offset = 0; - cls.attrs[1].home = 32768; - - cls.attrs[2].cls = ATT_TILT; - cls.attrs[2].props = ATTR_16BIT; - cls.attrs[2].addr_offset = 2; - cls.attrs[2].home = 32768; - - cls.attrs[3].cls = ATT_STROBE; - cls.attrs[3].props = 0; - cls.attrs[3].addr_offset = 48; - cls.attrs[3].home = 32; - - cls.attrs[4].cls = ATT_CYAN; - cls.attrs[4].props = ATTR_16BIT; - cls.attrs[4].addr_offset = 8; - cls.attrs[4].home = 0; - - cls.attrs[5].cls = ATT_MAGENTA; - cls.attrs[5].props = ATTR_16BIT; - cls.attrs[5].addr_offset = 10; - cls.attrs[5].home = 0; - - cls.attrs[6].cls = ATT_YELLOW; - cls.attrs[6].props = ATTR_16BIT; - cls.attrs[6].addr_offset = 12; - cls.attrs[6].home = 0; - - int rgobo_stops[] = {0, 6, 10, 15, 19, 24, 28}; - cls.attrs[7].cls = ATT_RGOBO; - cls.attrs[7].props = ATTR_STOP; - cls.attrs[7].addr_offset = 24; - cls.attrs[7].home = 0; - cls.attrs[7].stops = rgobo_stops; - cls.attrs[7].n_stops = 7; - - cls.attrs[8].cls = ATT_ZOOM; - cls.attrs[8].props = ATTR_16BIT; - cls.attrs[8].addr_offset = 32; - cls.attrs[8].home = 0; - - cls.attrs[9].cls = ATT_FOCUS; - cls.attrs[9].props = ATTR_16BIT; - cls.attrs[9].addr_offset = 34; - cls.attrs[9].home = 0; - - int gobo_stops[] = {0, 67, 73, 78, 84, 89, 95, 100, 106}; - cls.attrs[10].cls = ATT_GOBO; - cls.attrs[10].props = ATTR_STOP; - cls.attrs[10].addr_offset = 22; - cls.attrs[10].home = 0; - cls.attrs[10].stops = gobo_stops; - cls.attrs[10].n_stops = 9; - - int prism_stops[] = {0, 50}; - cls.attrs[11].cls = ATT_PRISM; - cls.attrs[11].props = ATTR_STOP; - cls.attrs[11].addr_offset = 27; - cls.attrs[11].home = 0; - cls.attrs[11].stops = prism_stops; - cls.attrs[11].n_stops = 2; + cls.name = "Robe Robin DL7S Profile Mode 1"; + cls.attributes = INTENSITY | COL_CMY | PANTILT | FOCUS | ZOOM + | FROST | IRIS; + cls.attributes16 = INTENSITY | COL_CMY | PANTILT | FOCUS | ZOOM + | FROST | IRIS; + + cls.intensity_offset = 49; + cls.pan_offset = 0; + cls.tilt_offset = 2; + cls.cyan_offset = 8; + cls.magenta_offset = 10; + cls.yellow_offset = 12; + cls.focus_offset = 34; + cls.zoom_offset = 32; + + int magic_chans[] = {48}; + int magic_vals[] = {32}; + cls.magic_chans = magic_chans; + cls.magic_vals = magic_vals; + cls.n_magic = 1; + + int gobo_chans[] = {24, 22}; + int gobo_vals[] = { 0, 0, + 6, 0, + 10, 0, + 15, 0, + 19, 0, + 24, 0, + 28, 0, + 0, 67, + 0, 73, + 0, 78, + 0, 84, + 0, 89, + 0, 95, + 0, 100, + 0, 106 }; + cls.n_gobos = 15; + cls.n_gobo_chans = 2; + cls.gobo_chans = gobo_chans; + cls.gobo_vals = gobo_vals; + + int prism_chans[] = {27}; + int prism_vals[] = {0, 50}; + cls.n_prisms = 15; + cls.n_prism_chans = 1; + cls.prism_chans = prism_chans; + cls.prism_vals = prism_vals; nl.fixture_width = 80.0; nl.fixtures = NULL; @@ -206,7 +187,7 @@ int main(int argc, char *argv[]) nl.cmdline[0] = '\0'; nl.cursor_idx = 0; nl.n_sel = 0; - nl.sel_attr = ATT_INTENSITY; + nl.sel_attr = INTENSITY; nl.dragging = 0; nl.go_lock = 0; nl.sb_lock = 0; |