File: quantize.alg

package info (click to toggle)
nyquist 3.12%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 58,036 kB
  • sloc: ansic: 74,355; lisp: 20,485; java: 9,390; cpp: 6,695; sh: 207; xml: 58; makefile: 40
file content (18 lines) | stat: -rw-r--r-- 453 bytes parent folder | download | duplicates (3)
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 ("double" "factor" "s1->scale * steps;
    scale_factor = (sample_type) (1.0 / steps);"))
  (INNER-LOOP "{
\t\tfloat x = s1 * factor;
\t\tlong xx;
\t\tx = (x > 0.0F ? x + 0.5F : x - 0.5F);
\t\txx = (long) x;
\t\toutput = (float) xx;
\t    }")
  (TERMINATE (MIN s1))
  (CONSTANT "factor")
  (LOGICAL-STOP (MIN s1))
)