File: shape.alg

package info (click to toggle)
audacity 1.2.4b-2.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 24,136 kB
  • ctags: 20,445
  • sloc: ansic: 139,567; cpp: 55,998; sh: 24,963; lisp: 3,772; makefile: 1,683; python: 272
file content (33 lines) | stat: -rw-r--r-- 1,441 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(SHAPE-ALG
        (NAME "shape") 
        (ARGUMENTS ("sound_type" "sin") ("sound_type" "fn") 
                ("double" "origin"))
        (START (MIN sin))	
        (TABLE "fn")
        (NOT-IN-INNER-LOOP "fn")
        (STATE 
               ("double" "time_to_index" "fn->sr")
               ("double" "origin" "origin")
               ("table_type" "the_table" "sound_to_table(fn)")
               ("sample_type *" "fcn_table" "susp->the_table->samples")		
           ("double" "table_len" "susp->the_table->length") )
        (TERMINATE (MIN sin))
        (LOGICAL-STOP (MIN sin))
        (INNER-LOOP "
                register double offset, x1;
                register long table_index;
                register double phase = sin;
                if (phase > 1.0) phase = 1.0;
                else if (phase < -1.0) phase = -1.0;
                offset = (phase + origin) * time_to_index;
                table_index = (long) offset;
                if (table_index < 0) table_index = 0;
                if (table_index >= table_len) table_index = ((long) table_len) - 1;
                    x1 = fcn_table[table_index];
                    output = (sample_type) (x1 + (offset - table_index) * 
                        (fcn_table[table_index + 1] - x1));
        ")
        (ALWAYS-SCALE sin)
        (CONSTANT "table_len" "time_to_index" "origen" "fcn_table" "the_table")
        (FINALIZATION "table_unref(susp->the_table);")
)