⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sound.h

📁 Audacity是一款用於錄音和編輯聲音的、免費的開放源碼軟體。它可以執行於Mac OS X、Microsoft Windows、GNU/Linux和其它作業系統
💻 H
📖 第 1 页 / 共 2 页
字号:
/* sound.h -- new nyquist sound data type *//* CHANGE LOG * -------------------------------------------------------------------- * 28Apr03  dm  changes for portability: moved some defns out of here */#include <math.h>#include "stdefs.h"#if USE_PRINTF#define nyquist_printf printf#endif#define PERMS		 0644		/* -rw-r--r-- *//* default stop sample count (for clipping) */#define MAX_STOP 0x7FFFFFFF/* default stop time (for clipping) */#define MAX_STOP_TIME 10E20/* LISP-SRC: (SETF MAX-STOP-TIME 10E20) */#define MIN_START_TIME -10E20/* LISP-SRC: (SETF MIN-START-TIME -10E20) *//* conversion from float to integer */#define SCALE_FACTOR_TO_BYTE 127#define SCALE_FACTOR_TO_SHORT 32767#define SCALE_FACTOR_TO_LONG 2147483647/* Note that the values assigned here are not arbitrary, but represent   a dominance relationship among the interpolation types.*/#define INTERP_n 0#define INTERP_s 1#define INTERP_i 2#define INTERP_r 3#define INTERP_nn 0#define INTERP_ns 1#define INTERP_ni 2#define INTERP_nr 3#define INTERP_sn 4#define INTERP_ss 5#define INTERP_si 6#define INTERP_sr 7#define INTERP_nnn 0#define INTERP_nns 1#define INTERP_nni 2#define INTERP_nnr 3#define INTERP_nsn 4#define INTERP_nss 5#define INTERP_nsi 6#define INTERP_nsr 7#define INTERP_nin 8#define INTERP_nis 9#define INTERP_nii 10#define INTERP_nir 11#define INTERP_nrn 12#define INTERP_nrs 13#define INTERP_nri 14#define INTERP_nrr 15#define INTERP_snn 16#define INTERP_sns 17#define INTERP_sni 18#define INTERP_snr 19#define INTERP_ssn 20#define INTERP_sss 21#define INTERP_ssi 22#define INTERP_ssr 23#define INTERP_sin 24#define INTERP_sis 25#define INTERP_sii 26#define INTERP_sir 27#define INTERP_srn 28#define INTERP_srs 29#define INTERP_sri 30#define INTERP_srr 31#define INTERP_nnnn 0#define INTERP_nnns 1#define INTERP_nnsn 4#define INTERP_nnss 5#define INTERP_nsnn 16#define INTERP_nsns 17#define INTERP_nssn 20#define INTERP_nsss 21#define INTERP_snnn 64#define INTERP_snns 65#define INTERP_snsn 68#define INTERP_snss 69#define INTERP_ssnn 80#define INTERP_ssns 81#define INTERP_sssn 84#define INTERP_ssss 85#define INTERP_niii 42#define INTERP_siii 106#define INTERP_nrrr 63#define INTERP_srrr 127#define INTERP_MASK 3#define INTERP_SHIFT 2LVAL snd_badsr(void);typedef double time_type;typedef double rate_type;typedef float sample_type;typedef double promoted_sample_type;/* use radians or degrees for phase? */#define ANGLEBASE 360.0/* used by sndwrite.c for output buffers.  This should be * eliminated: */#define MAX_SND_CHANNELS 8#define max_table_len 100000/* Set to 4 for debugging block allocation stuff, 1012? for   production*//* leave a few words short of 1024 in case we allocate powers of 2 */#define max_sample_block_len 1020/* #define max_sample_block_len 4 *//* Defines needed for xlisp */#define getsound(x)	((sound_type) getinst(x))#define xlgasound()	(testarg(typearg(soundp)))typedef short SFDataType, *SFDataPtr;typedef sample_type  sample_block_values[max_sample_block_len],                     *sample_block_values_type;typedef struct {    long		refcnt;		                 /* reference count */    sample_block_values	samples;} sample_block_node, *sample_block_type; typedef struct snd_susp_struct {    void		(*fetch)();    void		(*keep_fetch)();    void		(*free)();    void                (*mark)();  /* marks LVAL nodes for GC */    void                (*print_tree)();    /* debugging */    char *              name;       /* string name for debugging */    long                toss_cnt;   /* return this many zeros, then compute */    long                current;    /* current sample number */    double              sr;         /* sample rate */    time_type           t0;         /* starting time */    long                log_stop_cnt;   /* logical stop count */    /* other susp dependent stuff will be here... */} snd_susp_node, *snd_susp_type;typedef struct snd_list_struct {    sample_block_type	block;	/* pointer to block of samples */    union {        struct snd_list_struct	*next;        snd_susp_type		susp;    }			u;    short		refcnt;    short		block_len;    boolean		logically_stopped;} snd_list_node, *snd_list_type;typedef struct table_struct {    long refcount;  /* reference count */    double length;    /* number of samples in table (double allows fractional length)*/    sample_type samples[1]; /* arbitrary length array of sample */} table_node, *table_type;/* some counts are biased by -max_sample_block_len, so UNKNOWN can't be -1 * Any number less than -max_sample_block should do */#define UNKNOWN (-10-max_sample_block_len)typedef struct sound_struct {    sample_block_type	(*get_next)(/* struct sound_struct * snd, long * cnt */);    time_type		time;	/* logical starting time */    time_type		t0;	/* quantized time of first sample */    long                stop;  /* stop (clipping) sample no. */    time_type           true_t0;    /* exact time of first sample */    rate_type		sr;	/* sample rate */    long		current;	/* current sample number,                                         if negative, then the first                                          -current samples must be dropped                                         in order to find the first sample */    long		logical_stop_cnt; /* log stop sample no, -1=unknwn */    snd_list_type	list;	/* sample block list, starting at curr. samp */    sample_type		scale;	/* scale factor for the result */    long                prepend_cnt;    /* how many zeros to prepend */    /* function to use as get_next after prepended zeros have been generated: */    sample_block_type	(*after_prepend)                        (/* struct sound_struct * snd, long * cnt */);    table_type table;   /* pointer to table-ized version of this sound */    long *extra;	/* used for extra state information, first word of extra state should                     * be the length of the extra state (see sound_unref())                     */} sound_node, *sound_type;/* convert number of samples to memory size: */#define table_size_in_bytes(n) (sizeof(table_node) + sizeof(sample_type) * ((n) - 1))extern sample_block_type zero_block;extern sample_block_type internal_zero_block;extern snd_list_type zero_snd_list;extern sound_type printing_this_sound;  /* debugging global */double compute_phase(double phase, double key, long n, double srate,                     double new_srate, double freq, double *incr_ptr);boolean soundp();/* LISP: (SOUNDP ANY) */void snd_list_ref(snd_list_type list);void sound_unref(sound_type snd);void snd_list_unref(snd_list_type list);LVAL cvsound();extern LVAL a_sound;sample_block_type SND_get_next(sound_type snd, long * cnt);sample_block_type SND_get_first(sound_type snd, long * cnt);sample_block_type SND_get_zeros(sound_type snd, long * cnt);sample_block_type SND_flush(sound_type snd, long * cnt);double hz_to_step();	/* LISP: (HZ-TO-STEP ANYNUM) */int interp_style(sound_type s, rate_type sr);void set_logical_stop_time(); /* LISP: (SND-SET-LOGICAL-STOP SOUND ANYNUM) */#define xlog(x) log(x)/* LISP: double (LOG FLONUM) */snd_list_type snd_list_create(snd_susp_type susp);void snd_list_terminate(snd_list_type snd_list);void snd_sort_2(sound_type * s1_ptr, sound_type * s2_ptr, rate_type sr);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -