From 8f41dd7a3854a66678911915b8e158712d21eb1f Mon Sep 17 00:00:00 2001 From: Roger Dannenberg Date: Fri, 28 May 2021 06:51:40 -0400 Subject: [PATCH] Restore old behavior where Nyquist sound effects replace selection with arbitrary length computed sound. (So as before, sound after the selection is shifted in time if the replacement sound is shorter or longer than the original selection.) If stereo is computed and one channel is shorter than the other, the shorter channel is extended with zeros to match the length of the longer one. --- lib-src/libnyquist/nyx.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/lib-src/libnyquist/nyx.c b/lib-src/libnyquist/nyx.c index cc34c6e0a..3ef974768 100644 --- a/lib-src/libnyquist/nyx.c +++ b/lib-src/libnyquist/nyx.c @@ -1002,22 +1002,6 @@ int nyx_get_audio(nyx_audio_callback callback, void *userdata) goto finish; } - // if LEN is set, we will return LEN samples per channel. If LEN is - // unbound, we will compute samples until every channel has terminated - // that the samples per channel will match the last termination time, - // i.e. it could result in a partial block at the end. - if (nyx_input_length == 0) { - LVAL val = getvalue(xlenter("LEN")); - if (val != s_unbound) { - if (ntype(val) == FLONUM) { - nyx_input_length = (int64_t) getflonum(val); - } - else if (ntype(val) == FIXNUM) { - nyx_input_length = (int64_t) getfixnum(val); - } - } - } - // at this point, input sounds which were referenced by symbol S // (or nyx_get_audio_name()) could be referenced by nyx_result, but // S is now bound to NIL. nyx_result is a protected (garbage @@ -1060,9 +1044,6 @@ int nyx_get_audio(nyx_audio_callback callback, void *userdata) bool terminated = true; // how many samples to compute before calling callback: int64_t togo = max_sample_block_len; - if (nyx_input_length > 0 && total + togo > nyx_input_length) { - togo = nyx_input_length - total; - } for (ch = 0; ch < num_channels; ch++) { sound_state_type state = &states[ch]; sound_type snd = getsound(getelement(nyx_result, ch));