1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 07:43:54 +02: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 "quantize.h"
void quantize_free();
void quantize_free(snd_susp_type a_susp);
typedef struct quantize_susp_struct {
@@ -24,8 +24,9 @@ typedef struct quantize_susp_struct {
} quantize_susp_node, *quantize_susp_type;
void quantize_n_fetch(register quantize_susp_type susp, snd_list_type snd_list)
void quantize_n_fetch(snd_susp_type a_susp, snd_list_type snd_list)
{
quantize_susp_type susp = (quantize_susp_type) a_susp;
int cnt = 0; /* how many samples computed */
int togo;
int n;
@@ -53,6 +54,7 @@ void quantize_n_fetch(register quantize_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;
}
@@ -64,6 +66,7 @@ void quantize_n_fetch(register quantize_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) {
@@ -86,7 +89,13 @@ void quantize_n_fetch(register quantize_susp_type susp, snd_list_type snd_list)
s1_ptr_reg = susp->s1_ptr;
out_ptr_reg = out_ptr;
if (n) do { /* the inner sample computation loop */
register long xx = (long) (*s1_ptr_reg++ * factor_reg); *out_ptr_reg++ = (float) xx;;
{
float x = *s1_ptr_reg++ * factor_reg;
long xx;
x = (x > 0.0F ? x + 0.5 : x - 0.5);
xx = (long) x;
*out_ptr_reg++ = (float) xx;
};
} while (--n); /* inner loop */
/* using s1_ptr_reg is a bad idea on RS/6000: */
@@ -112,11 +121,9 @@ register long xx = (long) (*s1_ptr_reg++ * factor_reg); *out_ptr_reg++ = (float)
} /* quantize_n_fetch */
void quantize_toss_fetch(susp, snd_list)
register quantize_susp_type susp;
snd_list_type snd_list;
{
long final_count = susp->susp.toss_cnt;
void quantize_toss_fetch(snd_susp_type a_susp, snd_list_type snd_list)
{
quantize_susp_type susp = (quantize_susp_type) a_susp;
time_type final_time = susp->susp.t0;
long n;
@@ -131,25 +138,28 @@ void quantize_toss_fetch(susp, snd_list)
susp->s1_ptr += n;
susp_took(s1_cnt, n);
susp->susp.fetch = susp->susp.keep_fetch;
(*(susp->susp.fetch))(susp, snd_list);
(*(susp->susp.fetch))(a_susp, snd_list);
}
void quantize_mark(quantize_susp_type susp)
void quantize_mark(snd_susp_type a_susp)
{
quantize_susp_type susp = (quantize_susp_type) a_susp;
sound_xlmark(susp->s1);
}
void quantize_free(quantize_susp_type susp)
void quantize_free(snd_susp_type a_susp)
{
quantize_susp_type susp = (quantize_susp_type) a_susp;
sound_unref(susp->s1);
ffree_generic(susp, sizeof(quantize_susp_node), "quantize_free");
}
void quantize_print_tree(quantize_susp_type susp, int n)
void quantize_print_tree(snd_susp_type a_susp, int n)
{
quantize_susp_type susp = (quantize_susp_type) a_susp;
indent(n);
stdputstr("s1:");
sound_print_tree_1(susp->s1, n);
@@ -161,11 +171,11 @@ sound_type snd_make_quantize(sound_type s1, long steps)
register quantize_susp_type susp;
rate_type sr = s1->sr;
time_type t0 = s1->t0;
int interp_desc = 0;
sample_type scale_factor = 1.0F;
time_type t0_min = t0;
falloc_generic(susp, quantize_susp_node, "snd_make_quantize");
susp->factor = s1->scale * steps; scale_factor = (sample_type) (1.0 / steps);;
susp->factor = s1->scale * steps;
scale_factor = (sample_type) (1.0 / steps);;
susp->susp.fetch = quantize_n_fetch;
susp->terminate_cnt = UNKNOWN;
/* handle unequal start times, if any */
@@ -175,8 +185,8 @@ sound_type snd_make_quantize(sound_type s1, long steps)
/* 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 = quantize_toss_fetch;
susp->susp.keep_fetch = susp->susp.fetch;
susp->susp.fetch = quantize_toss_fetch;
}
/* initialize susp state */