summaryrefslogtreecommitdiff
path: root/tran/partial.alg
diff options
context:
space:
mode:
Diffstat (limited to 'tran/partial.alg')
-rw-r--r--tran/partial.alg20
1 files changed, 20 insertions, 0 deletions
diff --git a/tran/partial.alg b/tran/partial.alg
new file mode 100644
index 0000000..45a1999
--- /dev/null
+++ b/tran/partial.alg
@@ -0,0 +1,20 @@
+(PARTIAL-ALG
+(NAME "partial")
+(ARGUMENTS ("rate_type" "sr") ("double" "hz") ("sound_type" "env"))
+(SUPPORT-FUNCTIONS "
+#include \"sine.h\"
+")
+(START (MIN env))
+(STATE ("long" "phase" "0")
+ ("long" "ph_incr" "round((hz * SINE_TABLE_LEN) * (1 << SINE_TABLE_SHIFT) / sr)"))
+(TERMINATE (MIN env))
+(LOGICAL-STOP (MIN env))
+(INNER-LOOP "output = sine_table[phase >> SINE_TABLE_SHIFT] * env;
+ phase += ph_incr;
+ phase &= SINE_TABLE_MASK;")
+(MAINTAIN ("phase"
+ "susp->phase = (susp->phase + susp->ph_incr * togo) & SINE_TABLE_MASK"))
+(CONSTANT "ph_incr")
+(SAMPLE-RATE "sr")
+)
+