1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 15:49:36 +02:00

Nyquist: Handle nyx_list return value

Required to avoid error on running Macoro Scripting commands
from Nyquist.
This commit is contained in:
SteveDaulton 2020-02-15 15:28:01 +00:00
parent cda8f2fcd6
commit 63c7f6b722
3 changed files with 29 additions and 16 deletions

View File

@ -87,7 +87,7 @@ typedef struct nyx_susp_struct {
} nyx_susp_node, *nyx_susp_type;
#if defined(NYX_DEBUG_COPY) && NYX_DEBUG_COPY
static const char *_types_[] =
static const char *_types_[] =
{
"FREE_NODE",
"SUBR",
@ -393,7 +393,7 @@ LOCAL void nyx_restore_obarray()
}
}
// If we didn't find the symbol in the original obarray, then it
// If we didn't find the symbol in the original obarray, then it
// must've been added and must be removed from the current obarray.
// Exception: if the new symbol is a property symbol of *scratch*,
// then allow the symbol to stay; otherwise, property lookups will
@ -458,7 +458,7 @@ void nyx_init()
nyx_audio_name = NULL;
nyx_os_cb = NULL;
nyx_output_cb = NULL;
nyx_first_time = 0;
#if defined(NYX_FULL_COPY) && NYX_FULL_COPY
@ -467,7 +467,7 @@ void nyx_init()
#else
// Permanently protect the original obarray value. This is needed since
// it would be unreferenced in the new obarray and would be garbage
// collected. We want to keep it around so we can make copies of it to
// collected. We want to keep it around so we can make copies of it to
// refresh the execution state.
xlprot1(nyx_obarray);
nyx_obarray = getvalue(obarray);
@ -686,7 +686,7 @@ void nyx_set_input_audio(nyx_audio_callback callback,
susp->susp.sr = rate;
susp->susp.t0 = 0.0;
susp->susp.log_stop_cnt = 0;
snd = sound_create((snd_susp_type) susp, 0.0, rate, 1.0);
if (num_channels > 1) {
setelement(val, ch, cvsound(snd));
@ -775,7 +775,7 @@ nyx_rval nyx_get_type(LVAL expr)
case FIXNUM:
nyx_result_type = nyx_int;
break;
case FLONUM:
nyx_result_type = nyx_double;
break;
@ -804,6 +804,8 @@ nyx_rval nyx_get_type(LVAL expr)
label track */
if (nyx_is_labels(expr)) {
nyx_result_type = nyx_labels;
} else {
nyx_result_type = nyx_list;
}
}
break;
@ -1218,7 +1220,7 @@ void osinit(const char *banner)
}
/* osfinish - clean up before returning to the operating system */
void osfinish(void)
void osfinish(void)
{
}
@ -1244,7 +1246,7 @@ FILE *osaopen(const char *name, const char *mode)
FILE *osbopen(const char *name, const char *mode)
{
char bmode[10];
strncpy(bmode, mode, 8);
strcat(bmode, "b");
@ -1289,9 +1291,9 @@ int osbputc(int ch, FILE *fp)
/* ostputc - put a character to the terminal */
void ostputc(int ch)
{
{
oscheck(); /* check for control characters */
if (nyx_output_cb) {
nyx_output_cb(ch, nyx_output_ud);
}

View File

@ -24,9 +24,10 @@ extern "C"
nyx_int,
nyx_double,
nyx_string,
nyx_labels
nyx_labels,
nyx_list
} nyx_rval;
void nyx_init();
void nyx_cleanup();
void nyx_set_xlisp_path(const char *path);
@ -64,9 +65,9 @@ extern "C"
char *nyx_get_audio_name();
void nyx_set_audio_name(const char *name);
nyx_rval nyx_eval_expression(const char *expr);
/** @brief Get the number of channels in the Nyquist audio object
*
* @return The positive integer number of audio channels in the
@ -94,6 +95,6 @@ extern "C"
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __NYX__ */

View File

@ -613,7 +613,7 @@ bool NyquistEffect::Process()
mDelegate.reset();
return result;
}
// Check for reentrant Nyquist commands.
// I'm choosing to mark skipped Nyquist commands as successful even though
// they are skipped. The reason is that when Nyquist calls out to a chain,
@ -1412,6 +1412,16 @@ bool NyquistEffect::ProcessOne()
return false;
}
if (rval == nyx_list) {
wxLogMessage("Nyquist returned nyx_list");
if (GetType() == EffectTypeTool) {
mProjectChanged = true;
} else {
Effect::MessageBox(XO("Nyquist returned a list.") );
}
return true;
}
if (rval == nyx_string) {
// Assume the string has already been translated within the Lisp runtime
// if necessary, by gettext or ngettext defined below, before it is