1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-27 15:50:10 +01:00

Update Nyquist to v3.09.

This commit is contained in:
Leland Lucius
2015-04-07 22:10:17 -05:00
parent f88b27e6d8
commit 9fb0ce5b82
358 changed files with 26327 additions and 7043 deletions

View File

@@ -9,7 +9,7 @@
#include "cext.h"
#include "delaycc.h"
void delay_free();
void delay_free(snd_susp_type a_susp);
typedef struct delay_susp_struct {
@@ -27,8 +27,9 @@ typedef struct delay_susp_struct {
} delay_susp_node, *delay_susp_type;
void delay_n_fetch(register delay_susp_type susp, snd_list_type snd_list)
void delay_n_fetch(snd_susp_type a_susp, snd_list_type snd_list)
{
delay_susp_type susp = (delay_susp_type) a_susp;
int cnt = 0; /* how many samples computed */
int togo;
int n;
@@ -58,6 +59,7 @@ void delay_n_fetch(register delay_susp_type susp, snd_list_type snd_list)
if (susp->terminate_cnt != UNKNOWN &&
susp->terminate_cnt <= susp->susp.current + cnt + togo) {
togo = susp->terminate_cnt - (susp->susp.current + cnt);
if (togo < 0) togo = 0; /* avoids rounding errros */
if (togo == 0) break;
}
@@ -68,9 +70,9 @@ void delay_n_fetch(register delay_susp_type susp, snd_list_type snd_list)
input_ptr_reg = susp->input_ptr;
out_ptr_reg = out_ptr;
if (n) do { /* the inner sample computation loop */
*out_ptr_reg++ = *delayptr_reg;
*delayptr_reg = (sample_type) (*delayptr_reg * feedback_reg) + *input_ptr_reg++;
if (++delayptr_reg >= endptr_reg) delayptr_reg = susp->delaybuf;;
*out_ptr_reg++ = *delayptr_reg;
*delayptr_reg = (sample_type) (*delayptr_reg * feedback_reg) + *input_ptr_reg++;
if (++delayptr_reg >= endptr_reg) delayptr_reg = susp->delaybuf;
} while (--n); /* inner loop */
susp->delayptr = delayptr_reg;
@@ -91,11 +93,9 @@ void delay_n_fetch(register delay_susp_type susp, snd_list_type snd_list)
} /* delay_n_fetch */
void delay_toss_fetch(susp, snd_list)
register delay_susp_type susp;
snd_list_type snd_list;
{
long final_count = susp->susp.toss_cnt;
void delay_toss_fetch(snd_susp_type a_susp, snd_list_type snd_list)
{
delay_susp_type susp = (delay_susp_type) a_susp;
time_type final_time = susp->susp.t0;
long n;
@@ -110,25 +110,29 @@ void delay_toss_fetch(susp, snd_list)
susp->input_ptr += n;
susp_took(input_cnt, n);
susp->susp.fetch = susp->susp.keep_fetch;
(*(susp->susp.fetch))(susp, snd_list);
(*(susp->susp.fetch))(a_susp, snd_list);
}
void delay_mark(delay_susp_type susp)
void delay_mark(snd_susp_type a_susp)
{
delay_susp_type susp = (delay_susp_type) a_susp;
sound_xlmark(susp->input);
}
void delay_free(delay_susp_type susp)
void delay_free(snd_susp_type a_susp)
{
free(susp->delaybuf); sound_unref(susp->input);
delay_susp_type susp = (delay_susp_type) a_susp;
free(susp->delaybuf);
sound_unref(susp->input);
ffree_generic(susp, sizeof(delay_susp_node), "delay_free");
}
void delay_print_tree(delay_susp_type susp, int n)
void delay_print_tree(snd_susp_type a_susp, int n)
{
delay_susp_type susp = (delay_susp_type) a_susp;
indent(n);
stdputstr("input:");
sound_print_tree_1(susp->input, n);
@@ -140,7 +144,6 @@ sound_type snd_make_delay(sound_type input, time_type delay, double feedback)
register delay_susp_type susp;
rate_type sr = input->sr;
time_type t0 = input->t0;
int interp_desc = 0;
sample_type scale_factor = 1.0F;
time_type t0_min = t0;
/* combine scale factors of linear inputs (INPUT) */
@@ -165,8 +168,8 @@ sound_type snd_make_delay(sound_type input, time_type delay, double feedback)
/* how many samples to toss before t0: */
susp->susp.toss_cnt = (long) ((t0 - t0_min) * sr + 0.5);
if (susp->susp.toss_cnt > 0) {
susp->susp.keep_fetch = susp->susp.fetch;
susp->susp.fetch = delay_toss_fetch;
susp->susp.keep_fetch = susp->susp.fetch;
susp->susp.fetch = delay_toss_fetch;
}
/* initialize susp state */