mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-28 16:20:12 +01:00
Update Nyquist to v3.09.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include "cext.h"
|
||||
#include "siosc.h"
|
||||
|
||||
void siosc_free();
|
||||
void siosc_free(snd_susp_type a_susp);
|
||||
|
||||
|
||||
typedef struct siosc_susp_struct {
|
||||
@@ -102,8 +102,9 @@ long siosc_table_update(siosc_susp_type susp, long cur)
|
||||
}
|
||||
|
||||
|
||||
void siosc_s_fetch(register siosc_susp_type susp, snd_list_type snd_list)
|
||||
void siosc_s_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
siosc_susp_type susp = (siosc_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
int togo;
|
||||
int n;
|
||||
@@ -139,6 +140,7 @@ void siosc_s_fetch(register siosc_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;
|
||||
}
|
||||
|
||||
@@ -150,6 +152,7 @@ void siosc_s_fetch(register siosc_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) {
|
||||
@@ -186,9 +189,9 @@ void siosc_s_fetch(register siosc_susp_type susp, snd_list_type snd_list)
|
||||
s_fm_ptr_reg = susp->s_fm_ptr;
|
||||
out_ptr_reg = out_ptr;
|
||||
if (n) do { /* the inner sample computation loop */
|
||||
long table_index;
|
||||
long table_index;
|
||||
double xa, xb;
|
||||
table_index = (long) phase_reg;
|
||||
table_index = (long) phase_reg;
|
||||
xa = table_a_samps_reg[table_index];
|
||||
xb = table_b_samps_reg[table_index];
|
||||
*out_ptr_reg++ = (sample_type)
|
||||
@@ -230,8 +233,9 @@ void siosc_s_fetch(register siosc_susp_type susp, snd_list_type snd_list)
|
||||
} /* siosc_s_fetch */
|
||||
|
||||
|
||||
void siosc_i_fetch(register siosc_susp_type susp, snd_list_type snd_list)
|
||||
void siosc_i_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
siosc_susp_type susp = (siosc_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
int togo;
|
||||
int n;
|
||||
@@ -271,6 +275,7 @@ void siosc_i_fetch(register siosc_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;
|
||||
}
|
||||
|
||||
@@ -282,6 +287,7 @@ void siosc_i_fetch(register siosc_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) {
|
||||
@@ -319,7 +325,7 @@ void siosc_i_fetch(register siosc_susp_type susp, snd_list_type snd_list)
|
||||
s_fm_x1_sample_reg = susp->s_fm_x1_sample;
|
||||
out_ptr_reg = out_ptr;
|
||||
if (n) do { /* the inner sample computation loop */
|
||||
long table_index;
|
||||
long table_index;
|
||||
double xa, xb;
|
||||
if (s_fm_pHaSe_ReG >= 1.0) {
|
||||
/* fixup-depends s_fm */
|
||||
@@ -330,7 +336,7 @@ void siosc_i_fetch(register siosc_susp_type susp, snd_list_type snd_list)
|
||||
susp_check_term_log_samples_break(s_fm, s_fm_ptr, s_fm_cnt, s_fm_x1_sample_reg);
|
||||
s_fm_x1_sample_reg = susp_current_sample(s_fm, s_fm_ptr);
|
||||
}
|
||||
table_index = (long) phase_reg;
|
||||
table_index = (long) phase_reg;
|
||||
xa = table_a_samps_reg[table_index];
|
||||
xb = table_b_samps_reg[table_index];
|
||||
*out_ptr_reg++ = (sample_type)
|
||||
@@ -373,8 +379,9 @@ void siosc_i_fetch(register siosc_susp_type susp, snd_list_type snd_list)
|
||||
} /* siosc_i_fetch */
|
||||
|
||||
|
||||
void siosc_r_fetch(register siosc_susp_type susp, snd_list_type snd_list)
|
||||
void siosc_r_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
siosc_susp_type susp = (siosc_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
sample_type s_fm_val;
|
||||
int togo;
|
||||
@@ -425,6 +432,7 @@ void siosc_r_fetch(register siosc_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;
|
||||
}
|
||||
|
||||
@@ -436,6 +444,7 @@ void siosc_r_fetch(register siosc_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) {
|
||||
@@ -471,9 +480,9 @@ void siosc_r_fetch(register siosc_susp_type susp, snd_list_type snd_list)
|
||||
ampslope_reg = susp->ampslope;
|
||||
out_ptr_reg = out_ptr;
|
||||
if (n) do { /* the inner sample computation loop */
|
||||
long table_index;
|
||||
long table_index;
|
||||
double xa, xb;
|
||||
table_index = (long) phase_reg;
|
||||
table_index = (long) phase_reg;
|
||||
xa = table_a_samps_reg[table_index];
|
||||
xb = table_b_samps_reg[table_index];
|
||||
*out_ptr_reg++ = (sample_type)
|
||||
@@ -514,11 +523,9 @@ void siosc_r_fetch(register siosc_susp_type susp, snd_list_type snd_list)
|
||||
} /* siosc_r_fetch */
|
||||
|
||||
|
||||
void siosc_toss_fetch(susp, snd_list)
|
||||
register siosc_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
{
|
||||
long final_count = susp->susp.toss_cnt;
|
||||
void siosc_toss_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
siosc_susp_type susp = (siosc_susp_type) a_susp;
|
||||
time_type final_time = susp->susp.t0;
|
||||
long n;
|
||||
|
||||
@@ -533,19 +540,21 @@ void siosc_toss_fetch(susp, snd_list)
|
||||
susp->s_fm_ptr += n;
|
||||
susp_took(s_fm_cnt, n);
|
||||
susp->susp.fetch = susp->susp.keep_fetch;
|
||||
(*(susp->susp.fetch))(susp, snd_list);
|
||||
(*(susp->susp.fetch))(a_susp, snd_list);
|
||||
}
|
||||
|
||||
|
||||
void siosc_mark(siosc_susp_type susp)
|
||||
void siosc_mark(snd_susp_type a_susp)
|
||||
{
|
||||
siosc_susp_type susp = (siosc_susp_type) a_susp;
|
||||
if (susp->lis) mark(susp->lis);
|
||||
sound_xlmark(susp->s_fm);
|
||||
}
|
||||
|
||||
|
||||
void siosc_free(siosc_susp_type susp)
|
||||
void siosc_free(snd_susp_type a_susp)
|
||||
{
|
||||
siosc_susp_type susp = (siosc_susp_type) a_susp;
|
||||
table_unref(susp->table_a_ptr);
|
||||
table_unref(susp->table_b_ptr_ptr);
|
||||
sound_unref(susp->s_fm);
|
||||
@@ -553,8 +562,9 @@ void siosc_free(siosc_susp_type susp)
|
||||
}
|
||||
|
||||
|
||||
void siosc_print_tree(siosc_susp_type susp, int n)
|
||||
void siosc_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
siosc_susp_type susp = (siosc_susp_type) a_susp;
|
||||
indent(n);
|
||||
stdputstr("s_fm:");
|
||||
sound_print_tree_1(susp->s_fm, n);
|
||||
@@ -587,6 +597,12 @@ sound_type snd_make_siosc(LVAL lis, rate_type sr, double hz, time_type t0, sound
|
||||
susp->ph_incr = hz * susp->table_len / sr;
|
||||
s_fm->scale = (sample_type) (s_fm->scale * (susp->table_len / sr));
|
||||
|
||||
/* make sure no sample rate is too high */
|
||||
if (s_fm->sr > sr) {
|
||||
sound_unref(s_fm);
|
||||
snd_badsr();
|
||||
}
|
||||
|
||||
/* select a susp fn based on sample rates */
|
||||
interp_desc = (interp_desc << 2) + interp_style(s_fm, sr);
|
||||
switch (interp_desc) {
|
||||
@@ -605,8 +621,8 @@ sound_type snd_make_siosc(LVAL lis, rate_type sr, double hz, time_type t0, sound
|
||||
/* 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 = siosc_toss_fetch;
|
||||
susp->susp.keep_fetch = susp->susp.fetch;
|
||||
susp->susp.fetch = siosc_toss_fetch;
|
||||
}
|
||||
|
||||
/* initialize susp state */
|
||||
|
||||
Reference in New Issue
Block a user