mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-10 16:43:33 +02:00
Update Nyquist to v3.09.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include "cext.h"
|
||||
#include "reson.h"
|
||||
|
||||
void reson_free();
|
||||
void reson_free(snd_susp_type a_susp);
|
||||
|
||||
|
||||
typedef struct reson_susp_struct {
|
||||
@@ -31,8 +31,9 @@ typedef struct reson_susp_struct {
|
||||
} reson_susp_node, *reson_susp_type;
|
||||
|
||||
|
||||
void reson_n_fetch(register reson_susp_type susp, snd_list_type snd_list)
|
||||
void reson_n_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
reson_susp_type susp = (reson_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
int togo;
|
||||
int n;
|
||||
@@ -64,6 +65,7 @@ void reson_n_fetch(register reson_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;
|
||||
}
|
||||
|
||||
@@ -75,6 +77,7 @@ void reson_n_fetch(register reson_susp_type susp, snd_list_type snd_list)
|
||||
* AND cnt > 0 (we're not at the beginning of the
|
||||
* output block).
|
||||
*/
|
||||
if (to_stop < 0) to_stop = 0; /* avoids rounding errors */
|
||||
if (to_stop < togo) {
|
||||
if (to_stop == 0) {
|
||||
if (cnt) {
|
||||
@@ -101,9 +104,9 @@ void reson_n_fetch(register reson_susp_type susp, snd_list_type snd_list)
|
||||
s_ptr_reg = susp->s_ptr;
|
||||
out_ptr_reg = out_ptr;
|
||||
if (n) do { /* the inner sample computation loop */
|
||||
{ double y0 = c1_reg * *s_ptr_reg++ + c2_reg * y1_reg - c3_reg * y2_reg;
|
||||
*out_ptr_reg++ = (sample_type) y0;
|
||||
y2_reg = y1_reg; y1_reg = y0; };
|
||||
{ double y0 = c1_reg * *s_ptr_reg++ + c2_reg * y1_reg - c3_reg * y2_reg;
|
||||
*out_ptr_reg++ = (sample_type) y0;
|
||||
y2_reg = y1_reg; y1_reg = y0; };
|
||||
} while (--n); /* inner loop */
|
||||
|
||||
susp->y1 = y1_reg;
|
||||
@@ -131,8 +134,9 @@ void reson_n_fetch(register reson_susp_type susp, snd_list_type snd_list)
|
||||
} /* reson_n_fetch */
|
||||
|
||||
|
||||
void reson_s_fetch(register reson_susp_type susp, snd_list_type snd_list)
|
||||
void reson_s_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
reson_susp_type susp = (reson_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
int togo;
|
||||
int n;
|
||||
@@ -165,6 +169,7 @@ void reson_s_fetch(register reson_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;
|
||||
}
|
||||
|
||||
@@ -176,6 +181,7 @@ void reson_s_fetch(register reson_susp_type susp, snd_list_type snd_list)
|
||||
* AND cnt > 0 (we're not at the beginning of the
|
||||
* output block).
|
||||
*/
|
||||
if (to_stop < 0) to_stop = 0; /* avoids rounding errors */
|
||||
if (to_stop < togo) {
|
||||
if (to_stop == 0) {
|
||||
if (cnt) {
|
||||
@@ -202,9 +208,9 @@ void reson_s_fetch(register reson_susp_type susp, snd_list_type snd_list)
|
||||
s_ptr_reg = susp->s_ptr;
|
||||
out_ptr_reg = out_ptr;
|
||||
if (n) do { /* the inner sample computation loop */
|
||||
{ double y0 = c1_reg * (s_scale_reg * *s_ptr_reg++) + c2_reg * y1_reg - c3_reg * y2_reg;
|
||||
*out_ptr_reg++ = (sample_type) y0;
|
||||
y2_reg = y1_reg; y1_reg = y0; };
|
||||
{ double y0 = c1_reg * (s_scale_reg * *s_ptr_reg++) + c2_reg * y1_reg - c3_reg * y2_reg;
|
||||
*out_ptr_reg++ = (sample_type) y0;
|
||||
y2_reg = y1_reg; y1_reg = y0; };
|
||||
} while (--n); /* inner loop */
|
||||
|
||||
susp->y1 = y1_reg;
|
||||
@@ -232,11 +238,9 @@ void reson_s_fetch(register reson_susp_type susp, snd_list_type snd_list)
|
||||
} /* reson_s_fetch */
|
||||
|
||||
|
||||
void reson_toss_fetch(susp, snd_list)
|
||||
register reson_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
{
|
||||
long final_count = susp->susp.toss_cnt;
|
||||
void reson_toss_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
reson_susp_type susp = (reson_susp_type) a_susp;
|
||||
time_type final_time = susp->susp.t0;
|
||||
long n;
|
||||
|
||||
@@ -251,25 +255,28 @@ void reson_toss_fetch(susp, snd_list)
|
||||
susp->s_ptr += n;
|
||||
susp_took(s_cnt, n);
|
||||
susp->susp.fetch = susp->susp.keep_fetch;
|
||||
(*(susp->susp.fetch))(susp, snd_list);
|
||||
(*(susp->susp.fetch))(a_susp, snd_list);
|
||||
}
|
||||
|
||||
|
||||
void reson_mark(reson_susp_type susp)
|
||||
void reson_mark(snd_susp_type a_susp)
|
||||
{
|
||||
reson_susp_type susp = (reson_susp_type) a_susp;
|
||||
sound_xlmark(susp->s);
|
||||
}
|
||||
|
||||
|
||||
void reson_free(reson_susp_type susp)
|
||||
void reson_free(snd_susp_type a_susp)
|
||||
{
|
||||
reson_susp_type susp = (reson_susp_type) a_susp;
|
||||
sound_unref(susp->s);
|
||||
ffree_generic(susp, sizeof(reson_susp_node), "reson_free");
|
||||
}
|
||||
|
||||
|
||||
void reson_print_tree(reson_susp_type susp, int n)
|
||||
void reson_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
reson_susp_type susp = (reson_susp_type) a_susp;
|
||||
indent(n);
|
||||
stdputstr("s:");
|
||||
sound_print_tree_1(susp->s, n);
|
||||
@@ -312,8 +319,8 @@ sound_type snd_make_reson(sound_type s, double hz, double bw, int normalization)
|
||||
/* 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 = reson_toss_fetch;
|
||||
susp->susp.keep_fetch = susp->susp.fetch;
|
||||
susp->susp.fetch = reson_toss_fetch;
|
||||
}
|
||||
|
||||
/* initialize susp state */
|
||||
|
Reference in New Issue
Block a user