11. Line16 Scheme Functions
11.1. Line16 Scheme Loader
The top-level scheme loader is called s9_load_line16
.
void s9_load_line16(void);
<<line16_scheme_functions>>
static S9_PRIM line16_primitives[] = {
<<line16_scheme_entries>>
{NULL}
};
void s9_load_line16(void)
{
add_primitives("monolith", line16_primitives);
}
11.2. Create Line16 Page
A new line16 page is created with monolith:line16-new
.
{"monolith:line16-new", pp_line16_new, 1, 1, {STR, ___, ___}},
static cell pp_line16_new(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_newpage(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not create line16 page (maybe it already exists?)",
car(x));
}
page_line16(pg);
return UNSPECIFIC;
}
11.3. Point Value
Used to set/get the value of a particular point of a particular line.
The first three arguments to these functions are the name of the page, the selected line, and the point index. If there is a fourth argument, it is a real value (in range 0-1).
11.3.1. DONE line16-point-val-set
CLOSED: [2019-08-18 Sun 06:37]
{
"monolith:line16-point-val-set",
pp_line16_point_val_set,
4, 4,
{S9_T_STRING, S9_T_INTEGER, S9_T_INTEGER}
},
static cell pp_line16_point_val_set(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int line;
int pos;
page_line16_d *l;
GFFLT val;
char name[] = "monolith:line16-point-val-set";
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
x = cdr(x);
line = integer_value(name, car(x));
x = cdr(x);
pos = integer_value(name, car(x));
if(pos < 0 || pos > 15) {
return error("Position is out of range", car(x));
}
x = cdr(x);
val = REAL2FLOAT(car(x));
if(val < 0 || val > 1) {
return error("Value is out of range", car(x));
}
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
l = monolith_page_data_get(pg);
line16_point_val_set(l, line, pos, val);
return S9_UNSPECIFIC;
}
11.3.2. DONE line16-point-val-get
CLOSED: [2019-08-18 Sun 07:17]
{
"monolith:line16-point-val-get",
pp_line16_point_val_get,
3, 3,
{S9_T_STRING, S9_T_INTEGER, S9_T_INTEGER}
},
static cell pp_line16_point_val_get(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int line;
int pos;
page_line16_d *l;
GFFLT val;
char name[] = "monolith:line16-point-val-get";
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
x = cdr(x);
line = integer_value(name, car(x));
x = cdr(x);
pos = integer_value(name, car(x));
if(pos < 0 || pos > 15) {
return error("Position is out of range", car(x));
}
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
l = monolith_page_data_get(pg);
val = line16_point_val_get(l, line, pos);
return FLOAT2REAL(val, 4);
}
11.4. Point Duration
Changes the duration. Argument scheme closely resembles
point-val-set
and point-val-get
, only for duration.
A friendly reminder that duration is a normalized value, and must be scaled by the min/max ranges in order to see the unit in seconds.
11.4.1. DONE line16-point-dur-set
CLOSED: [2019-08-18 Sun 07:42]
{
"monolith:line16-point-dur-set",
pp_line16_point_dur_set,
4, 4,
{S9_T_STRING, S9_T_INTEGER, S9_T_INTEGER}
},
static cell pp_line16_point_dur_set(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int line;
int pos;
page_line16_d *l;
GFFLT dur;
char name[] = "monolith:line16-point-dur-set";
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
x = cdr(x);
line = integer_value(name, car(x));
x = cdr(x);
pos = integer_value(name, car(x));
if(pos < 0 || pos > 15) {
return error("Position is out of range", car(x));
}
x = cdr(x);
dur = REAL2FLOAT(car(x));
if(dur < 0 || dur > 1) {
return error("Duration is out of range", car(x));
}
l = monolith_page_data_get(pg);
line16_point_dur_set(l, line, pos, dur);
return S9_UNSPECIFIC;
}
11.4.2. DONE line16-point-dur-get
CLOSED: [2019-08-18 Sun 07:45]
{
"monolith:line16-point-dur-get",
pp_line16_point_dur_get,
3, 3,
{S9_T_STRING, S9_T_INTEGER, S9_T_INTEGER}
},
static cell pp_line16_point_dur_get(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int line;
int pos;
page_line16_d *l;
GFFLT dur;
char name[] = "monolith:line16-point-dur-get";
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
x = cdr(x);
line = integer_value(name, car(x));
x = cdr(x);
pos = integer_value(name, car(x));
if(pos < 0 || pos > 15) {
return error("Position is out of range", car(x));
}
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
l = monolith_page_data_get(pg);
dur = line16_point_dur_get(l, line, pos);
return FLOAT2REAL(dur, 4);
}
11.5. Point Rate Set
11.5.1. DONE line16-point-rate-set
CLOSED: [2019-08-25 Sun 05:16]
{
"monolith:line16-point-rate-set",
pp_line16_point_rate_set,
4, 4,
{S9_T_STRING, S9_T_INTEGER, S9_T_INTEGER}
},
static cell pp_line16_point_rate_set(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int line;
int pos;
page_line16_d *l;
GFFLT rate;
char name[] = "monolith:line16-point-rate-set";
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
x = cdr(x);
line = integer_value(name, car(x));
x = cdr(x);
pos = integer_value(name, car(x));
if(pos < 0 || pos > 15) {
return error("Position is out of range", car(x));
}
x = cdr(x);
rate = REAL2FLOAT(car(x));
if(rate < 0) {
return error("Point rate is out of range", car(x));
}
l = monolith_page_data_get(pg);
line16_point_rate_set(l, line, pos, rate);
return S9_UNSPECIFIC;
}
11.5.2. DONE line16-point-rate-get
CLOSED: [2019-08-25 Sun 06:46]
{
"monolith:line16-point-rate-get",
pp_line16_point_rate_get,
3, 3,
{S9_T_STRING, S9_T_INTEGER, S9_T_INTEGER}
},
static cell pp_line16_point_rate_get(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int line;
int pos;
page_line16_d *l;
GFFLT rate;
char name[] = "monolith:line16-point-rate-get";
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
x = cdr(x);
line = integer_value(name, car(x));
x = cdr(x);
pos = integer_value(name, car(x));
if(pos < 0 || pos > 15) {
return error("Position is out of range", car(x));
}
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
l = monolith_page_data_get(pg);
rate = line16_point_rate_get(l, line, pos);
return FLOAT2REAL(rate, 4);
}
11.6. Duration Ranges
Sets the minimum and maximum range for the line segment durations.
11.6.1. DONE line16-dur-min-set
CLOSED: [2019-08-18 Sun 09:47]
{
"monolith:line16-dur-min-set",
pp_line16_dur_min_set,
2, 2,
{S9_T_STRING, S9_T_REAL, S9_T_ANY}
},
static cell pp_line16_dur_min_set(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
page_line16_d *l;
GFFLT mn;
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
x = cdr(x);
mn = REAL2FLOAT(car(x));
l = monolith_page_data_get(pg);
line16_dur_min_set(l, mn);
return S9_UNSPECIFIC;
}
11.6.2. DONE line16-dur-min-get
CLOSED: [2019-08-18 Sun 09:47]
{
"monolith:line16-dur-min-get",
pp_line16_min_get,
1, 1,
{S9_T_STRING, S9_T_ANY, S9_T_ANY}
},
static cell pp_line16_min_get(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
page_line16_d *l;
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
l = monolith_page_data_get(pg);
return FLOAT2REAL(line16_dur_min_get(l), 5);
}
11.6.3. DONE line16-dur-max-set
CLOSED: [2019-08-18 Sun 09:53]
{
"monolith:line16-dur-max-set",
pp_line16_dur_max_set,
2, 2,
{S9_T_STRING, S9_T_REAL, S9_T_ANY}
},
static cell pp_line16_dur_max_set(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
page_line16_d *l;
GFFLT mx;
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
x = cdr(x);
mx = REAL2FLOAT(car(x));
l = monolith_page_data_get(pg);
line16_dur_max_set(l, mx);
return S9_UNSPECIFIC;
}
11.6.4. DONE line16-dur-max-get
CLOSED: [2019-08-18 Sun 09:53]
{
"monolith:line16-dur-max-get",
pp_line16_max_get,
1, 1,
{S9_T_STRING, S9_T_ANY, S9_T_ANY}
},
static cell pp_line16_max_get(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
page_line16_d *l;
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
l = monolith_page_data_get(pg);
return FLOAT2REAL(line16_dur_max_get(l), 5);
}
11.7. Point Auxiliary Values
11.7.1. line16-point-aux-set
{
"monolith:line16-point-aux-set",
pp_line16_point_aux_set,
5, 5,
{S9_T_STRING, S9_T_INTEGER, S9_T_INTEGER}
},
static cell pp_line16_point_aux_set(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int line;
int pos;
int aux;
page_line16_d *l;
GFFLT val;
char name[] = "monolith:line16-point-aux-set";
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
x = cdr(x);
line = integer_value(name, car(x));
x = cdr(x);
pos = integer_value(name, car(x));
if(pos < 0 || pos > 15) {
return error("Position is out of range", car(x));
}
x = cdr(x);
aux = integer_value(name, car(x));
if(aux < 0 || aux > 1) {
return error("Position is out of range", car(x));
}
x = cdr(x);
val = REAL2FLOAT(car(x));
if(val < 0 || val > 1) {
return error("Duration is out of range", car(x));
}
l = monolith_page_data_get(pg);
line16_point_aux_set(l, line, pos, aux, val);
return S9_UNSPECIFIC;
}
11.7.2. line16-point-aux-get
{
"monolith:line16-point-aux-get",
pp_line16_point_aux_get,
4, 4,
{S9_T_STRING, S9_T_INTEGER, S9_T_INTEGER}
},
static cell pp_line16_point_aux_get(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int line;
int pos;
page_line16_d *l;
GFFLT val;
int aux;
char name[] = "monolith:line16-point-dur-get";
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
x = cdr(x);
line = integer_value(name, car(x));
x = cdr(x);
pos = integer_value(name, car(x));
if(pos < 0 || pos > 15) {
return error("Position is out of range", car(x));
}
x = cdr(x);
aux = integer_value(name, car(x));
if(aux < 0 || aux > 1) {
return error("Position is out of range", car(x));
}
l = monolith_page_data_get(pg);
val = line16_point_aux_get(l, line, pos, aux);
return FLOAT2REAL(val, 4);
}
11.8. Point Status
11.8.1. DONE line16-point-status-set
CLOSED: [2019-08-24 Sat 07:32]
{
"monolith:line16-point-status-set",
pp_line16_point_status_set,
4, 4,
{S9_T_STRING, S9_T_INTEGER, S9_T_INTEGER}
},
static cell pp_line16_point_status_set(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int line;
int pos;
page_line16_d *l;
int status;
char name[] = "monolith:line16-point-status-set";
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
x = cdr(x);
line = integer_value(name, car(x));
x = cdr(x);
pos = integer_value(name, car(x));
if(pos < 0 || pos > 15) {
return error("Position is out of range", car(x));
}
x = cdr(x);
status = integer_value(name, car(x));
l = monolith_page_data_get(pg);
line16_point_status_set(l, line, pos, status);
return S9_UNSPECIFIC;
}
11.8.2. DONE line16-point-status-get
CLOSED: [2019-08-24 Sat 07:32]
{
"monolith:line16-point-status-get",
pp_line16_point_status_get,
3, 3,
{S9_T_STRING, S9_T_INTEGER, S9_T_INTEGER}
},
static cell pp_line16_point_status_get(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int line;
int pos;
page_line16_d *l;
int status;
char name[] = "monolith:line16-point-status-get";
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
x = cdr(x);
line = integer_value(name, car(x));
x = cdr(x);
pos = integer_value(name, car(x));
if(pos < 0 || pos > 15) {
return error("Position is out of range", car(x));
}
l = monolith_page_data_get(pg);
status = line16_point_status_get(l, line, pos);
return s9_make_integer(status);
}
11.9. Point Type
11.9.1. DONE line16-point-type-set
CLOSED: [2019-08-24 Sat 07:39]
{
"monolith:line16-point-type-set",
pp_line16_point_type_set,
4, 4,
{S9_T_STRING, S9_T_INTEGER, S9_T_INTEGER}
},
static cell pp_line16_point_type_set(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int line;
int pos;
page_line16_d *l;
int type;
char name[] = "monolith:line16-point-type-set";
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
x = cdr(x);
line = integer_value(name, car(x));
x = cdr(x);
pos = integer_value(name, car(x));
if(pos < 0 || pos > 15) {
return error("Position is out of range", car(x));
}
x = cdr(x);
type = integer_value(name, car(x));
l = monolith_page_data_get(pg);
line16_point_type_set(l, line, pos, type);
return S9_UNSPECIFIC;
}
11.9.2. DONE line16-point-type-get
CLOSED: [2019-08-24 Sat 07:40]
{
"monolith:line16-point-type-get",
pp_line16_point_type_get,
3, 3,
{S9_T_STRING, S9_T_INTEGER, S9_T_INTEGER}
},
static cell pp_line16_point_type_get(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int line;
int pos;
page_line16_d *l;
int type;
char name[] = "monolith:line16-point-type-get";
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
x = cdr(x);
line = integer_value(name, car(x));
x = cdr(x);
pos = integer_value(name, car(x));
if(pos < 0 || pos > 15) {
return error("Position is out of range", car(x));
}
l = monolith_page_data_get(pg);
type = line16_point_type_get(l, line, pos);
return s9_make_integer(type);
}
11.10. Playback Rate
This manages the global playback rate of the line.
11.10.1. DONE line16-rate-set
CLOSED: [2019-08-18 Sun 09:31]
{
"monolith:line16-rate-set",
pp_line16_rate_set,
2, 2,
{S9_T_STRING, S9_T_REAL, S9_T_ANY}
},
static cell pp_line16_rate_set(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
page_line16_d *l;
GFFLT rate;
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
x = cdr(x);
rate = REAL2FLOAT(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
l = monolith_page_data_get(pg);
line16_rate_set(l, rate);
return S9_UNSPECIFIC;
}
11.10.2. DONE line16-rate-get
CLOSED: [2019-08-18 Sun 09:31]
{
"monolith:line16-rate-get",
pp_line16_rate_get,
1, 1,
{S9_T_STRING, S9_T_ANY, S9_T_ANY}
},
static cell pp_line16_rate_get(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
page_line16_d *l;
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
l = monolith_page_data_get(pg);
return FLOAT2REAL(line16_rate_get(l), 5);
}
11.11. Select a Point
Selects a point for editing on the current line.
11.11.1. DONE select point
CLOSED: [2019-08-18 Sun 11:07]
{
"monolith:line16-select-point",
pp_line16_select_point,
2, 2,
{S9_T_STRING, S9_T_INTEGER, S9_T_ANY}
},
static cell pp_line16_select_point(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int point;
page_line16_d *l;
char name[] = "monolith:line16-select-point";
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
l = monolith_page_data_get(pg);
x = cdr(x);
point = integer_value(name, car(x));
if(point < 0 || point > 15) {
return error("Point out of range", car(x));
}
line16_select_point(l, point);
return S9_UNSPECIFIC;
}
11.11.2. DONE line16-select-point-get
CLOSED: [2019-08-18 Sun 11:17] Gets the selected point.
{
"monolith:line16-select-point-get",
pp_line16_select_point_get,
1, 1,
{S9_T_STRING, S9_T_ANY, S9_T_ANY}
},
static cell pp_line16_select_point_get(cell x)
{
const char *str;
monolith_d *m;
monolith_dict *dict;
monolith_page *pg;
int rc;
int point;
page_line16_d *l;
m = monolith_data_get();
dict = monolith_dict_get(m);
str = string(car(x));
rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
if(!rc) {
return error(
"Could not find line16 page",
car(x));
}
l = monolith_page_data_get(pg);
x = cdr(x);
point = line16_select_point_get(l);
return s9_make_integer(point);
}
prev | home | next