File: quantize.alg

package info (click to toggle)
nyquist 3.20%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 58,008 kB
  • sloc: ansic: 74,743; lisp: 17,929; java: 10,723; cpp: 6,690; sh: 171; xml: 58; makefile: 40; python: 15
file content (18 lines) | stat: -rw-r--r-- 504 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(QUANTIZE-ALG
  (NAME "quantize")
  (ARGUMENTS ("sound_type" "s1") ("long" "steps"))
  (INTERNAL-SCALING s1)
  (START (MIN s1))
  (STATE ("sample_type" "factor" "s1->scale * steps;
    scale_factor = (sample_type) (1.0 / steps);"))
  (INNER-LOOP "{
            float x = s1 * factor;
            long xx;
            x = (x > 0.0F ? x + 0.5F : x - 0.5F);
            xx = (long) x;
            output = (float) xx;
            }")
  (TERMINATE (MIN s1))
  (CONSTANT "factor")
  (LOGICAL-STOP (MIN s1))
)