1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-22 16:41:18 +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 "alpass.h"
void alpass_free();
void alpass_free(snd_susp_type a_susp);
typedef struct alpass_susp_struct {
@@ -27,8 +27,9 @@ typedef struct alpass_susp_struct {
} alpass_susp_node, *alpass_susp_type;
void alpass_n_fetch(register alpass_susp_type susp, snd_list_type snd_list)
void alpass_n_fetch(snd_susp_type a_susp, snd_list_type snd_list)
{
alpass_susp_type susp = (alpass_susp_type) a_susp;
int cnt = 0; /* how many samples computed */
int togo;
int n;
@@ -58,6 +59,7 @@ void alpass_n_fetch(register alpass_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,11 +70,11 @@ void alpass_n_fetch(register alpass_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 */
register sample_type y, z;
y = *delayptr_reg;
*delayptr_reg++ = z = (sample_type) (feedback_reg * y + *input_ptr_reg++);
*out_ptr_reg++ = (sample_type) (y - feedback_reg * z);
if (delayptr_reg >= endptr_reg) delayptr_reg = susp->delaybuf;;
register sample_type y, z;
y = *delayptr_reg;
*delayptr_reg++ = z = (sample_type) (feedback_reg * y + *input_ptr_reg++);
*out_ptr_reg++ = (sample_type) (y - feedback_reg * z);
if (delayptr_reg >= endptr_reg) delayptr_reg = susp->delaybuf;
} while (--n); /* inner loop */
susp->delayptr = delayptr_reg;
@@ -93,11 +95,9 @@ register sample_type y, z;
} /* alpass_n_fetch */
void alpass_toss_fetch(susp, snd_list)
register alpass_susp_type susp;
snd_list_type snd_list;
{
long final_count = susp->susp.toss_cnt;
void alpass_toss_fetch(snd_susp_type a_susp, snd_list_type snd_list)
{
alpass_susp_type susp = (alpass_susp_type) a_susp;
time_type final_time = susp->susp.t0;
long n;
@@ -112,25 +112,28 @@ void alpass_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 alpass_mark(alpass_susp_type susp)
void alpass_mark(snd_susp_type a_susp)
{
alpass_susp_type susp = (alpass_susp_type) a_susp;
sound_xlmark(susp->input);
}
void alpass_free(alpass_susp_type susp)
void alpass_free(snd_susp_type a_susp)
{
alpass_susp_type susp = (alpass_susp_type) a_susp;
free(susp->delaybuf); sound_unref(susp->input);
ffree_generic(susp, sizeof(alpass_susp_node), "alpass_free");
}
void alpass_print_tree(alpass_susp_type susp, int n)
void alpass_print_tree(snd_susp_type a_susp, int n)
{
alpass_susp_type susp = (alpass_susp_type) a_susp;
indent(n);
stdputstr("input:");
sound_print_tree_1(susp->input, n);
@@ -142,7 +145,6 @@ sound_type snd_make_alpass(sound_type input, time_type delay, double feedback)
register alpass_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) */
@@ -167,8 +169,8 @@ sound_type snd_make_alpass(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 = alpass_toss_fetch;
susp->susp.keep_fetch = susp->susp.fetch;
susp->susp.fetch = alpass_toss_fetch;
}
/* initialize susp state */