File tree 4 files changed +12
-6
lines changed
lib-src/libnyquist/nyquist/nyqsrc
4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 13
13
#include "sound.h"
14
14
#include "falloc.h"
15
15
#include "samples.h"
16
+ #include <limits.h>
16
17
17
18
18
19
LVAL s_next = NULL ;
@@ -115,10 +116,16 @@ LVAL snd_samples(sound_type s, int64_t len)
115
116
long vx = 0 ;
116
117
int blocklen ;
117
118
register double scale_factor = s -> scale ;
118
- len = ( long ) snd_length (s , len );
119
+ len = snd_length (s , len );
119
120
s = sound_copy (s );
120
121
121
122
xlsave1 (v );
123
+
124
+ // xlisp's maximum vector size is limited. If we exceed the limit,
125
+ // we'll return a shorter array of samples than requested.
126
+ if (len > INT_MAX / sizeof (LVAL )) {
127
+ len = INT_MAX / sizeof (LVAL );
128
+ }
122
129
v = newvector (len );
123
130
124
131
while (len > 0 ) {
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ the previous value so re-reading will not re-trigger.)
48
48
#include "cext.h"
49
49
#include "assert.h"
50
50
51
- #define TRIGGERDBG 1
51
+ #define TRIGGERDBG 0
52
52
#define D if (TRIGGERDBG)
53
53
54
54
/* Note: this structure is identical to an add_susp structure up
Original file line number Diff line number Diff line change 668
668
(ny :error " SAMPLER" 2 ' ((SOUND) " modulation" ) modulation))
669
669
(ny :assert-sample " SAMPLER" 3 " table" sample)
670
670
(ny :typecheck (not (integerp npoints))
671
- (ny :error " BUZZ " 3 ' ((INTEGER ) " npoints" ) npoints))
671
+ (ny :error " SAMPLER " 3 ' ((INTEGER ) " npoints" ) npoints))
672
672
(let ((samp (car sample))
673
673
(samp-pitch (cadr sample))
674
674
(samp-loop-start (caddr sample))
Original file line number Diff line number Diff line change 199
199
; ; a more helpful stack trace for SAL.
200
200
(defmacro trigger (input beh)
201
201
` (let* ((nyq%environment (nyq :the-environment))
202
- (gate%signal (force-srate *sound-srate* , input))
203
- (s%rate (snd-srate gate%signal)))
204
- (snd-trigger gate%signal
202
+ (s%rate *sound-srate* ))
203
+ (snd-trigger (force-srate *sound-srate* , input)
205
204
#' (lambda (t0) (eval-seq-behavior , beh " TRIGGER" )))))
206
205
207
206
You can’t perform that action at this time.
0 commit comments