This is sound.h in view mode; [Download] [Up]
/*
* FILE: sound.h
* BY: Christopher Lee Fraley (cf0v@spice.cs.cmu.edu)
* DESC: file for interfacing C sound functions to LISP
*
* 1.0 (23-SEP-88) - created. (cf0v)
* 1.1 (10-OCT-88) - modified data structure. (cf0v)
* 1.2 ( 1-FEB-89) - added ANGLEBASE (360=degrees, 2pi=radians, etc). (cf0v)
* 2.0 (13-FEB-89) - removed function declarations which were removed from
* "sound.c". (cf0v)
* 2.1 ( 5-MAY-89) - added s_compose() function. (cf0v)
*/
#define SOUND_H 2.0
#define ANGLEBASE 360.0
#define EPSILON (1e-5)
#define APPROX(x,y) (fabs((x)-(y))<EPSILON)
#define APPROXLT(x,y) ((x)<=(y)+2*EPSILON)
typedef short SFDataType, *SFDataPtr;
typedef float SDataType, *SDataPtr;
typedef struct _sample
{
int refCount;
int length;
float srate;
SDataPtr data;
} SampleType, *SamplePtr;
typedef struct _node
{
struct _sound *sound;
struct _node *next;
} NodeType, *NodePtr;
typedef struct _sound
{
float scale;
double from, to, shift;
float stretch, srate;
double logicalTo;
int refCount;
short tag;
union
{
SamplePtr sample;
NodePtr node;
} ptr;
} SoundType, *SoundPtr;
/* Valid tags for union in SoundType (i.e. SoundType.tag) */
#define SILENCE 0
#define SAMPLES 1
#define SUMNODES 2
/* Useful defines: */
#define MAX(x,y) (((x)<(y))?(y):(x))
#define MIN(x,y) (((x)>(y))?(y):(x))
#define ABS(x) (((x)>0) ? (x) : -(x))
#define SRATE ((double) 22050)/* Default system sample rate */
#define INFINITY 1e+9 /* Maximum value of float */
#define NEGINFINITY -1e+9 /* Minimum value of float */
#define MAXSAMPLE 1e+9 /* Maximum val for type SampleType */
#define MINSAMPLE 0.0 /* Minimum val for type SampleType */
#define PERMS 0644 /* -rw-r--r-- */
#define locate_sample(s, time) ((s)->ptr.sample->data + 1 + (long) \
((((time) - (s)->shift) * (s)->srate) + 0.5))
/* Defines needed for xlisp: */
#define xlgasound() (testarg(typearg(soundp)))
#define getsound(x) ((SoundPtr) getinst(x))
int soundp();
LVAL cvsound();
void sound_free();
void nodes_free();
void sample_free();
SoundPtr s_silence();
SoundPtr s_create(); /* LISP: (S-CREATE) */
SoundPtr s_copy(); /* LISP: (S-COPY SOUND) */
void s_extent(); /* LISP: (S-EXTENT SOUND FLONUM^ FLONUM^) */
SoundPtr s_flatten(); /* LISP: (S-FLATTEN SOUND) */
SoundPtr s_constant(); /* LISP: (S-CONSTANT FLONUM FLONUM) */
SoundPtr s_compose(); /* LISP: (S-COMPOSE ANY FLONUM) */
NodePtr n_create();
SamplePtr spl_create();
SDataPtr sdata_create();
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.