ref: 0f9bc249e79a9181613b46effd008f15d9bc7904
parent: 3a3b446c59acabc34e39d73af846ecb37a8dff77
author: Paul Batchelor <[email protected]>
date: Sun Feb 7 03:16:08 EST 2021
added sp_phasor_reset
--- a/h/phasor.h
+++ b/h/phasor.h
@@ -11,3 +11,4 @@
int sp_phasor_destroy(sp_phasor **p);
int sp_phasor_init(sp_data *sp, sp_phasor *p, SPFLOAT iphs);
int sp_phasor_compute(sp_data *sp, sp_phasor *p, SPFLOAT *in, SPFLOAT *out);
+int sp_phasor_reset(sp_data *sp, sp_phasor *p, SPFLOAT iphs);
--- a/modules/data/phasor.lua
+++ b/modules/data/phasor.lua
@@ -11,6 +11,19 @@
destroy = "sp_phasor_destroy",
init = "sp_phasor_init",
compute = "sp_phasor_compute",
+ other = {
+ sp_phasor_reset = {
+ description = "resets the phase to a value.",
+ args = {
+ {
+ name = "value",
+ type = "SPFLOAT",
+ description = "value to reset to.",
+ default = 0
+ },
+ }
+ }
+ }
},
params = {
--- a/modules/phasor.c
+++ b/modules/phasor.c
@@ -43,3 +43,9 @@
*out = sk_phasor_tick(p->phasor);
return SP_OK;
}
+
+int sp_phasor_reset(sp_data *sp, sp_phasor *p, SPFLOAT iphs)
+{
+ sk_phasor_reset(p->phasor, iphs);
+ return SP_OK;
+}
--- a/tangled/phasor.c
+++ b/tangled/phasor.c
@@ -37,4 +37,10 @@
return out;
}
+#line 164 "phasor.org"
+void sk_phasor_reset(sk_phasor *phs, SKFLT val)
+{
+ if (val >= 0) phs->phs = val;
+ else phs->phs = 0;
+}
#line 49 "phasor.org"
--- a/tangled/phasor.h
+++ b/tangled/phasor.h
@@ -15,6 +15,8 @@
void sk_phasor_freq(sk_phasor *ph, SKFLT freq);
#line 113 "phasor.org"
SKFLT sk_phasor_tick(sk_phasor *ph);
+#line 159 "phasor.org"
+void sk_phasor_reset(sk_phasor *phs, SKFLT val);
#line 41 "phasor.org"
#ifdef SK_PHASOR_PRIV
#line 70 "phasor.org"