1(AMOSC-ALG 2(NAME "amosc") 3(ARGUMENTS ("sound_type" "input") ("double" "step") ("rate_type" "sr") 4 ("double" "hz") ("time_type" "t0") ("sound_type" "amod") 5 ("double" "phase")) 6(TABLE "input") 7(NOT-IN-INNER-LOOP "input") 8(START (MIN input)) 9(STATE 10 ("double" "ph_incr" "0") 11 ("table_type" "the_table" "sound_to_table(input)") 12 ("sample_type *" "table_ptr" "susp->the_table->samples") 13 ("double" "table_len" "susp->the_table->length") 14 ("double" "phase" "compute_phase(phase, step, (long) susp->table_len, 15 input->sr, sr, hz, &susp->ph_incr)") ) 16(ALWAYS-SCALE amod) 17(TERMINATE (MIN amod)) 18(LOGICAL-STOP (MIN amod)) 19(INNER-LOOP "{ 20\t\tlong table_index = (long) phase; 21\t\tdouble x1 = (double) (table_ptr[table_index]); 22\t\toutput = (sample_type) ((x1 + (phase - table_index) * 23\t\t (table_ptr[table_index + 1] - x1)) * amod); 24\t\tphase += ph_incr; 25\t\twhile (phase > table_len) phase -= table_len; 26\t }") 27(CONSTANT "ph_incr" "table_len" "table_ptr" "the_table") 28(SAMPLE-RATE "sr") 29(FINALIZATION " table_unref(susp->the_table);\n") 30) 31 32