ref: 0a4745da16ef9463d5fa01eedd7778dcca039288
parent: e93003292b1c6bceed680831cffeae5329bb0104
author: Sigrid Haflínudóttir <[email protected]>
date: Mon Dec 30 07:48:06 EST 2019
rename ui element types and update readme
--- a/README.md
+++ b/README.md
@@ -19,10 +19,10 @@
% cd `{cat clone}
# check the A oscillator frequency
-# the order is: type key value initial min max step
+# the order is: type value initial min max step
# it's different for different UI elements
% cat K*/a/frequency/ctl
-vslider 0 100.000000 100.000000 10.000000 200.000000 5.000000
+vslider 100.000000 100.000000 10.000000 200.000000 5.000000
# raise frequency to 160Hz
% echo 160 > K*/a/f*/ctl
@@ -49,9 +49,10 @@
can be read from it. The format is raw stream of `float`.
Each DSP instance, in addition to the mentioned files, provides a file
-tree that reflects the UI elements. UI elements may provide `ctl`
-file to read initial and current, maximum and minimum, step, and may
-be used to write a new value to it.
+tree that reflects the UI elements. UI elements provide `ctl` file to
+read initial and current, maximum and minimum, step, and may be used
+to write a new value to it. `metadata` is provided to read/write
+UI-specific metadata key/values.
Several DSPs may be connected by chaining their `data` interfaces
together. If some parameters need to be changed dynamically during
--- a/aux.h
+++ b/aux.h
@@ -5,14 +5,14 @@
Xdsp,
Xdspctl,
Xdspdata,
- UITBox,
- UIHBox,
- UIVBox,
+ UITGroup,
+ UIHGroup,
+ UIVGroup,
UIButton,
- UICheck,
+ UICheckBox,
UIVSlider,
UIHSlider,
- UINum,
+ UINEntry,
UIHBarGraph,
UIVBarGraph,
Xuictl,
--- a/uiglue.c
+++ b/uiglue.c
@@ -20,14 +20,14 @@
if (type == Xuictl) {
switch (a->type) {
- case UITBox: snprint(s, sz, "tbox\n"); return s;
- case UIHBox: snprint(s, sz, "hbox\n"); return s;
- case UIVBox: snprint(s, sz, "vbox\n"); return s;
+ case UITGroup: snprint(s, sz, "tgroup\n"); return s;
+ case UIHGroup: snprint(s, sz, "hgroup\n"); return s;
+ case UIVGroup: snprint(s, sz, "vgroup\n"); return s;
case UIButton: snprint(s, sz, "button\t%d\n", !!*ui->zone); return s;
- case UICheck: snprint(s, sz, "check\t%d\n", !!*ui->zone); return s;
+ case UICheckBox: snprint(s, sz, "checkbox\t%d\n", !!*ui->zone); return s;
case UIVSlider: snprint(s, sz, "vslider\t%f\t%f\t%f\t%f\t%f\n", *ui->zone, ui->init, ui->min, ui->max, ui->step); return s;
case UIHSlider: snprint(s, sz, "hslider\t%f\t%f\t%f\t%f\t%f\n", *ui->zone, ui->init, ui->min, ui->max, ui->step); return s;
- case UINum: snprint(s, sz, "num\t%f\t%f\t%f\t%f\t%f\n", *ui->zone, ui->init, ui->min, ui->max, ui->step); return s;
+ case UINEntry: snprint(s, sz, "nentry\t%f\t%f\t%f\t%f\t%f\n", *ui->zone, ui->init, ui->min, ui->max, ui->step); return s;
case UIHBarGraph: snprint(s, sz, "hbargraph\t%f\t%f\t%f\n", *ui->zone, ui->min, ui->max); return s;
case UIVBarGraph: snprint(s, sz, "vbargraph\t%f\t%f\t%f\n", *ui->zone, ui->min, ui->max); return s;
default: sysfatal("unknown ui type %d", a->type);
@@ -69,7 +69,7 @@
}
if (ui->zone != nil) {
- if (a->type == UIButton || a->type == UICheck)
+ if (a->type == UIButton || a->type == UICheckBox)
v = !!v;
else if (*ui->zone < ui->min)
v = ui->min;
@@ -113,25 +113,25 @@
}
static void
-ui_tbox(void *f, const char *label)
+ui_tgroup(void *f, const char *label)
{
- newui(f, label, UITBox);
+ newui(f, label, UITGroup);
}
static void
-ui_hbox(void *f, const char *label)
+ui_hgroup(void *f, const char *label)
{
- newui(f, label, UIHBox);
+ newui(f, label, UIHGroup);
}
static void
-ui_vbox(void *f, const char *label)
+ui_vgroup(void *f, const char *label)
{
- newui(f, label, UIVBox);
+ newui(f, label, UIVGroup);
}
static void
-ui_close(void *file)
+ui_close_group(void *file)
{
File *f;
@@ -160,9 +160,9 @@
}
static void
-ui_check(void *f, const char *label, FAUSTFLOAT *zone)
+ui_checkbox(void *f, const char *label, FAUSTFLOAT *zone)
{
- ui_define(f, UICheck, label, zone);
+ ui_define(f, UICheckBox, label, zone);
}
static void
@@ -190,11 +190,11 @@
}
static void
-ui_num(void *f, const char *label, FAUSTFLOAT *zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
+ui_nentry(void *f, const char *label, FAUSTFLOAT *zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
{
UI *ui;
- ui = ui_define(f, UINum, label, zone);
+ ui = ui_define(f, UINEntry, label, zone);
ui->init = init;
ui->min = min;
ui->max = max;
@@ -236,15 +236,15 @@
}
UIGlue uiglue = {
- .openTabBox = ui_tbox,
- .openHorizontalBox = ui_hbox,
- .openVerticalBox = ui_vbox,
- .closeBox = ui_close,
+ .openTabBox = ui_tgroup,
+ .openHorizontalBox = ui_hgroup,
+ .openVerticalBox = ui_vgroup,
+ .closeBox = ui_close_group,
.addButton = ui_button,
- .addCheckButton = ui_check,
+ .addCheckButton = ui_checkbox,
.addVerticalSlider = ui_vslider,
.addHorizontalSlider = ui_hslider,
- .addNumEntry = ui_num,
+ .addNumEntry = ui_nentry,
.addHorizontalBargraph = ui_hbargraph,
.addVerticalBargraph = ui_vbargraph,
.declare = ui_declare,