1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00
lllucius 4c0aa60871 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
2014-11-13 16:38:20 +00:00

100 lines
2.7 KiB
C

/**********************************************************************
nyx.h
Nyx: A very simple external interface to Nyquist
Dominic Mazzoni
**********************************************************************/
#ifndef __NYX__
#define __NYX__
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#define nyx_returns_start_and_end_time 1
typedef enum {
nyx_error,
nyx_audio,
nyx_int,
nyx_double,
nyx_string,
nyx_labels
} nyx_rval;
void nyx_init();
void nyx_cleanup();
void nyx_set_xlisp_path(const char *path);
/* should return return 0 for success, -1 for error */
typedef int (*nyx_audio_callback)(float *buffer,
int channel,
long start, long len,
long totlen,
void *userdata);
typedef void (*nyx_output_callback)(int c,
void *userdata);
typedef void (*nyx_os_callback)(void *userdata);
/* Set to NULL to stop capturing output */
void nyx_capture_output(nyx_output_callback callback,
void *userdata);
/* Set to NULL to stop checking */
void nyx_set_os_callback(nyx_os_callback callback,
void *userdata);
void nyx_stop();
void nyx_break();
void nyx_continue();
void nyx_set_audio_params(double rate, long len);
void nyx_set_input_audio(nyx_audio_callback callback,
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);
/** @brief Get the number of channels in the Nyquist audio object
*
* @return The positive integer number of audio channels in the
* Nyquist audio object, 0 if not an audio object, -1 one if
* Nyquist returns an array of samples (which we can't handle)
*/
int nyx_get_audio_num_channels();
int nyx_get_audio(nyx_audio_callback callback,
void *userdata);
int nyx_get_int();
double nyx_get_double();
const char *nyx_get_string();
unsigned int nyx_get_num_labels();
void nyx_get_label(unsigned int index,
double *start_time,
double *end_time,
const char **label);
const char *nyx_get_error_str();
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __NYX__ */