mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
This fixes a problem with nyquist's TRIGGER retaining samples (see comment 2, Bug #2698). This version of samples.c was accidentally omitted from an earlier commit.
This commit is contained in:
parent
f1395ff621
commit
91a557d838
@ -13,6 +13,7 @@
|
|||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "falloc.h"
|
#include "falloc.h"
|
||||||
#include "samples.h"
|
#include "samples.h"
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
|
||||||
LVAL s_next = NULL;
|
LVAL s_next = NULL;
|
||||||
@ -115,10 +116,16 @@ LVAL snd_samples(sound_type s, int64_t len)
|
|||||||
long vx = 0;
|
long vx = 0;
|
||||||
int blocklen;
|
int blocklen;
|
||||||
register double scale_factor = s->scale;
|
register double scale_factor = s->scale;
|
||||||
len = (long) snd_length(s, len);
|
len = snd_length(s, len);
|
||||||
s = sound_copy(s);
|
s = sound_copy(s);
|
||||||
|
|
||||||
xlsave1(v);
|
xlsave1(v);
|
||||||
|
|
||||||
|
// xlisp's maximum vector size is limited. If we exceed the limit,
|
||||||
|
// we'll return a shorter array of samples than requested.
|
||||||
|
if (len > INT_MAX / sizeof(LVAL)) {
|
||||||
|
len = INT_MAX / sizeof(LVAL);
|
||||||
|
}
|
||||||
v = newvector(len);
|
v = newvector(len);
|
||||||
|
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
|
@ -48,7 +48,7 @@ the previous value so re-reading will not re-trigger.)
|
|||||||
#include "cext.h"
|
#include "cext.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
|
|
||||||
#define TRIGGERDBG 1
|
#define TRIGGERDBG 0
|
||||||
#define D if (TRIGGERDBG)
|
#define D if (TRIGGERDBG)
|
||||||
|
|
||||||
/* Note: this structure is identical to an add_susp structure up
|
/* Note: this structure is identical to an add_susp structure up
|
||||||
|
@ -668,7 +668,7 @@ loop
|
|||||||
(ny:error "SAMPLER" 2 '((SOUND) "modulation") modulation))
|
(ny:error "SAMPLER" 2 '((SOUND) "modulation") modulation))
|
||||||
(ny:assert-sample "SAMPLER" 3 "table" sample)
|
(ny:assert-sample "SAMPLER" 3 "table" sample)
|
||||||
(ny:typecheck (not (integerp npoints))
|
(ny:typecheck (not (integerp npoints))
|
||||||
(ny:error "BUZZ" 3 '((INTEGER) "npoints") npoints))
|
(ny:error "SAMPLER" 3 '((INTEGER) "npoints") npoints))
|
||||||
(let ((samp (car sample))
|
(let ((samp (car sample))
|
||||||
(samp-pitch (cadr sample))
|
(samp-pitch (cadr sample))
|
||||||
(samp-loop-start (caddr sample))
|
(samp-loop-start (caddr sample))
|
||||||
|
@ -199,9 +199,8 @@
|
|||||||
;; a more helpful stack trace for SAL.
|
;; a more helpful stack trace for SAL.
|
||||||
(defmacro trigger (input beh)
|
(defmacro trigger (input beh)
|
||||||
`(let* ((nyq%environment (nyq:the-environment))
|
`(let* ((nyq%environment (nyq:the-environment))
|
||||||
(gate%signal (force-srate *sound-srate* ,input))
|
(s%rate *sound-srate*))
|
||||||
(s%rate (snd-srate gate%signal)))
|
(snd-trigger (force-srate *sound-srate* ,input)
|
||||||
(snd-trigger gate%signal
|
|
||||||
#'(lambda (t0) (eval-seq-behavior ,beh "TRIGGER")))))
|
#'(lambda (t0) (eval-seq-behavior ,beh "TRIGGER")))))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user