summaryrefslogtreecommitdiff
path: root/src/libs/sig/sig.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-02-04 17:17:15 -0800
committerVito Caputo <vcaputo@pengaru.com>2020-02-04 18:07:38 -0800
commit64a0fe99038b9c58a815a92db2eb2ded1fd2801a (patch)
treeafe3d6f56df7e39aba85529984dd810092d84fb3 /src/libs/sig/sig.h
parent0b4c227a210dd5edc6186c0050a1d67baf958b98 (diff)
libs/sig: square wave; sig_ops_sqr / sig_new_sqr()
This builds minimally upon the existing sine wave code, just use the sign to drive the signal high or low. Wikipedia shows a third state for 0 values, but that's for a -1..+1 signal. I'm producing all 0-1 signals as it's more convenient for this application, but it seems like it would be awkward to return .5f for the 0 case. So 0 is being treated as just another positive value; high.
Diffstat (limited to 'src/libs/sig/sig.h')
-rw-r--r--src/libs/sig/sig.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libs/sig/sig.h b/src/libs/sig/sig.h
index e905ba0..917dbc4 100644
--- a/src/libs/sig/sig.h
+++ b/src/libs/sig/sig.h
@@ -37,16 +37,17 @@ sig_t * sig_new_rand(void);
sig_t * sig_new_round(sig_t *x);
sig_t * sig_new_scale(sig_t *x, sig_t *min, sig_t *max);
sig_t * sig_new_sin(sig_t *hz);
+sig_t * sig_new_sqr(sig_t *hz);
sig_t * sig_new_sub(sig_t *a, sig_t *b);
extern sig_ops_t sig_ops_const;
extern sig_ops_t sig_ops_rand;
extern sig_ops_t sig_ops_sin;
+extern sig_ops_t sig_ops_sqr;
/* TODO:
extern sig_ops_t sig_ops_tri;
extern sig_ops_t sig_ops_saw;
-extern sig_ops_t sig_ops_sqr;
*/
extern sig_ops_t sig_ops_abs;
© All Rights Reserved