mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-10 08:33:36 +02:00
A subset of the original v4 patch (which will become v5 eventually)
The main operational difference is that for v4 effect onward, the sound name will now be *TRACK*. This will not affect existing effects since they use version number 3 or less. This also provides the Nyquist effect with much more information about the current processing: Variable Property What *AUDACITY* VERSION current Audacity version number *SYSTEM-DIR* BASE Audacity install path *SYSTEM-DIR* DATA Audacity data path *SYSTEM-DIR* HELP Audacity help path *SYSTEM-DIR* TEMP Audacity temp file path *SYSTEM-DIR* PLUGIN Audacity search path for Nyquist plugins *PROJECT* RATE current project sample rate *PROJECT* TRACKS total number of tracks in the project *PROJECT* WAVETRACKS number of wave tracks in the project *PROJECT* LABELTRACKS number of label tracks in the project *PROJECT* MIDITRACKS number of midi tracks in the project *PROJECT* TIMETRACKS number of time tracks in the project *SELECTION* START start time of current selection *SELECTION* END end time of current selection *SELECTION* TRACKS number of tracks in the current selection *SELECTION* CHANNELS number of channels in the current selection *SELECTION* LOW-HZ low frequency from spectrogram (if available, else nil) *SELECTION* CENTER-HZ center frequence (calculated) (if available, else nil) *SELECTION* HIGH-HZ high frequence from spectrogram (if available, else nil) *SELECTION* BANDWIDTH bandwidth in octaves (calculated) (if available, else nil) *SELECTION* PEAK-LEVEL peak amplitude for the current selection *TRACK* INDEX 1-based index of track being processed *TRACK* NAME name of track *TRACK* TYPE type of track: wave, midi, label, time *TRACK* VIEW track view: Waveform, Waveform (dB), etc. *TRACK* CHANNELS number of channels in the track *TRACK* START-TIME start time of track *TRACK* END-TIME end time of track *TRACK* GAIN track gain *TRACK* PAN track pan *TRACK* RATE sample rate of track *TRACK* FORMAT sample format: 16 (int), 24 (int), 32.0 (float) *TRACK* CLIPS list of start/end times for clips for each channel
This commit is contained in:
@@ -75,6 +75,7 @@ LOCAL int nyx_first_time = 1;
|
||||
LOCAL LVAL nyx_obarray;
|
||||
LOCAL FLOTYPE nyx_warp_stretch;
|
||||
LOCAL long nyx_input_length = 0;
|
||||
LOCAL char *nyx_audio_name = NULL;
|
||||
|
||||
/* Suspension node */
|
||||
typedef struct nyx_susp_struct {
|
||||
@@ -454,6 +455,7 @@ void nyx_init()
|
||||
argv[0] = "nyquist";
|
||||
xlisp_main_init(1, argv);
|
||||
|
||||
nyx_audio_name = NULL;
|
||||
nyx_os_cb = NULL;
|
||||
nyx_output_cb = NULL;
|
||||
|
||||
@@ -505,7 +507,7 @@ void nyx_cleanup()
|
||||
|
||||
// Make sure the sound nodes can be garbage-collected. Sounds are EXTERN
|
||||
// nodes whose value does not get copied during a full copy of the obarray.
|
||||
setvalue(xlenter("S"), NIL);
|
||||
setvalue(xlenter(nyx_get_audio_name()), NIL);
|
||||
|
||||
// Free excess memory segments - does a gc()
|
||||
freesegs();
|
||||
@@ -520,6 +522,11 @@ void nyx_cleanup()
|
||||
// Reset vars
|
||||
nyx_input_length = 0;
|
||||
|
||||
if (nyx_audio_name) {
|
||||
free(nyx_audio_name);
|
||||
nyx_audio_name = NULL;
|
||||
}
|
||||
|
||||
#if defined(NYX_MEMORY_STATS) && NYX_MEMORY_STATS
|
||||
printf("\nnyx_cleanup\n");
|
||||
xmem();
|
||||
@@ -587,6 +594,25 @@ void nyx_capture_output(nyx_output_callback callback, void *userdata)
|
||||
nyx_output_ud = userdata;
|
||||
}
|
||||
|
||||
char *nyx_get_audio_name()
|
||||
{
|
||||
if (!nyx_audio_name) {
|
||||
nyx_audio_name = strdup("S");
|
||||
}
|
||||
|
||||
return nyx_audio_name;
|
||||
}
|
||||
|
||||
void nyx_set_audio_name(const char *name)
|
||||
{
|
||||
if (nyx_audio_name) {
|
||||
free(nyx_audio_name);
|
||||
nyx_audio_name = NULL;
|
||||
}
|
||||
|
||||
nyx_audio_name = strdup(name);
|
||||
}
|
||||
|
||||
void nyx_set_audio_params(double rate, long len)
|
||||
{
|
||||
LVAL flo;
|
||||
@@ -670,7 +696,7 @@ void nyx_set_input_audio(nyx_audio_callback callback,
|
||||
}
|
||||
}
|
||||
|
||||
setvalue(xlenter("S"), val);
|
||||
setvalue(xlenter(nyx_get_audio_name()), val);
|
||||
|
||||
xlpop();
|
||||
}
|
||||
@@ -862,7 +888,7 @@ nyx_rval nyx_eval_expression(const char *expr_string)
|
||||
|
||||
xlpop(); // unprotect expr
|
||||
|
||||
setvalue(xlenter("S"), NIL);
|
||||
setvalue(xlenter(nyx_get_audio_name()), NIL);
|
||||
|
||||
gc();
|
||||
|
||||
|
@@ -61,6 +61,9 @@ extern "C"
|
||||
void *userdata,
|
||||
int num_channels,
|
||||
long len, double rate);
|
||||
|
||||
char *nyx_get_audio_name();
|
||||
void nyx_set_audio_name(const char *name);
|
||||
|
||||
nyx_rval nyx_eval_expression(const char *expr);
|
||||
|
||||
|
Reference in New Issue
Block a user