summaryrefslogtreecommitdiff
path: root/tran/quantize.alg
blob: fc268bd29d5362915ba71bd42c4287841fe4a877 (plain)
1
2
3
4
5
6
7
8
9
10
11
(QUANTIZE-ALG
  (NAME "quantize")
  (ARGUMENTS ("sound_type" "s1") ("long" "steps"))
  (INTERNAL-SCALING s1)
  (START (MIN s1))
  (STATE ("double" "factor" "s1->scale * steps; scale_factor = (sample_type) (1.0 / steps);"))
  (INNER-LOOP "register long xx = (long) (s1 * factor); output = (float) xx;")
  (TERMINATE (MIN s1))
  (CONSTANT "factor")
  (LOGICAL-STOP (MIN s1))
)