Update Nyquist to v3.09.
This commit is contained in:
parent
f88b27e6d8
commit
9fb0ce5b82
|
@ -1,102 +0,0 @@
|
|||
Index: nyquist/cmt/midifns.c
|
||||
===================================================================
|
||||
RCS file: /cvsroot/audacity/lib-src/libnyquist/nyquist/cmt/midifns.c,v
|
||||
retrieving revision 1.1
|
||||
diff -u -r1.1 midifns.c
|
||||
--- nyquist/cmt/midifns.c 29 Jan 2009 18:04:20 -0000 1.1
|
||||
+++ nyquist/cmt/midifns.c 8 Dec 2009 01:19:17 -0000
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "switches.h"
|
||||
|
||||
#ifdef UNIX
|
||||
+#include <sys/resource.h>
|
||||
#include <sys/param.h>
|
||||
#ifndef OPEN_MAX
|
||||
/* this is here for compiling the UNIX version under AIX. This is a BSDism */
|
||||
@@ -376,6 +377,7 @@
|
||||
struct timeval unix_timeout;
|
||||
struct timeval *waitspec = NULL;
|
||||
fd_set readfds;
|
||||
+ struct rlimit file_limit;
|
||||
|
||||
FD_ZERO(&readfds);
|
||||
FD_SET(MI_CONNECTION(midiconn), &readfds);
|
||||
@@ -387,7 +389,8 @@
|
||||
unix_timeout.tv_usec = (timeout - (unix_timeout.tv_sec * 1000)) * 1000;
|
||||
waitspec = &unix_timeout;
|
||||
}
|
||||
- select(NOFILE+1, &readfds, 0, 0, waitspec);
|
||||
+ getrlimit(RLIMIT_NOFILE, &file_limit);
|
||||
+ select(file_limit.rlim_max+1, &readfds, 0, 0, waitspec);
|
||||
return;
|
||||
}
|
||||
#else /* !UNIX_ITC */
|
||||
@@ -424,6 +427,7 @@
|
||||
{
|
||||
struct timeval unix_timeout;
|
||||
struct timeval *waitspec = NULL;
|
||||
+ struct rlimit file_limit;
|
||||
|
||||
if (timeout >= 0) {
|
||||
timeout -= gettime(); /* convert to millisecond delay */
|
||||
@@ -431,7 +435,8 @@
|
||||
/* remainder become microsecs: */
|
||||
unix_timeout.tv_usec = (timeout - (unix_timeout.tv_sec * 1000)) * 1000;
|
||||
waitspec = &unix_timeout;
|
||||
- select(NOFILE+1, 0, 0, 0, waitspec);
|
||||
+ getrlimit(RLIMIT_NOFILE, &file_limit);
|
||||
+ select(file_limit.rlim_max+1, 0, 0, 0, waitspec);
|
||||
} else {
|
||||
int c = getc(stdin);
|
||||
ungetc(c, stdin);
|
||||
@@ -445,6 +450,7 @@
|
||||
struct timeval unix_timeout;
|
||||
struct timeval *waitspec = NULL;
|
||||
int readfds = 1 << IOinputfd;
|
||||
+ struct rlimit file_limit;
|
||||
|
||||
if (timeout >= 0) {
|
||||
timeout -= gettime(); /* convert to millisecond delay */
|
||||
@@ -453,7 +459,8 @@
|
||||
unix_timeout.tv_usec = (timeout - (unix_timeout.tv_sec * 1000)) * 1000;
|
||||
waitspec = &unix_timeout;
|
||||
}
|
||||
- select(NOFILE+1, &readfds, 0, 0, waitspec);
|
||||
+ getrlimit(RLIMIT_NOFILE, &file_limit);
|
||||
+ select(file_limit.rlim_max+1, &readfds, 0, 0, waitspec);
|
||||
return;
|
||||
}
|
||||
#endif /* BUFFERED_SYNCHRONOUS_INPUT */
|
||||
Index: nyquist/cmt/userio.c
|
||||
===================================================================
|
||||
RCS file: /cvsroot/audacity/lib-src/libnyquist/nyquist/cmt/userio.c,v
|
||||
retrieving revision 1.1
|
||||
diff -u -r1.1 userio.c
|
||||
--- nyquist/cmt/userio.c 29 Jan 2009 18:04:21 -0000 1.1
|
||||
+++ nyquist/cmt/userio.c 8 Dec 2009 01:19:17 -0000
|
||||
@@ -133,6 +133,7 @@
|
||||
|
||||
#ifdef UNIX
|
||||
#include <sys/param.h>
|
||||
+#include <sys/resource.h>
|
||||
#include "cmtio.h"
|
||||
#ifdef _IBMR2
|
||||
#define NBBY 8
|
||||
@@ -1205,6 +1206,7 @@
|
||||
#endif /* !UNIX_MACH */
|
||||
#endif
|
||||
char c;
|
||||
+ struct rlimit file_limit;
|
||||
|
||||
if (abort_flag == ABORT_LEVEL) return ABORT_CHAR;
|
||||
if (abort_flag == BREAK_LEVEL) return BREAK_CHAR;
|
||||
@@ -1233,7 +1235,8 @@
|
||||
FD_ZERO(&readfds);
|
||||
FD_SET(IOinputfd, &readfds);
|
||||
gflush();
|
||||
- select(NOFILE+1, &readfds, 0, 0, NULL);
|
||||
+ getrlimit(RLIMIT_NOFILE, &file_limit);
|
||||
+ select(file_limit.rlim_max+1, &readfds, 0, 0, NULL);
|
||||
#endif /* !UNIX_MACH */
|
||||
#endif /* ifdef UNIX */
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
--- audacity-1.3.8.orig/lib-src/libnyquist/nyquist/sys/unix/switches.h
|
||||
+++ audacity-1.3.8/lib-src/libnyquist/nyquist/sys/unix/switches.h
|
||||
@@ -76,7 +76,7 @@
|
||||
#define CPU_IS_BIG_ENDIAN 1
|
||||
#endif
|
||||
#else
|
||||
- #ifdef __linux__
|
||||
+ #if defined(__linux__) || defined(__GLIBC__)
|
||||
#include <endian.h>
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
/* Target processor is little endian. */
|
||||
only in patch2:
|
||||
unchanged:
|
||||
--- audacity-1.3.8.orig/lib-src/libnyquist/nyquist/xlisp/xlisp.h
|
||||
+++ audacity-1.3.8/lib-src/libnyquist/nyquist/xlisp/xlisp.h
|
||||
@@ -143,7 +143,7 @@
|
||||
#endif
|
||||
|
||||
/* Linux on Pentium */
|
||||
-#ifdef __linux__
|
||||
+#if defined(__linux__) || defined(__GLIBC__)
|
||||
#include <endian.h>
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define XL_LITTLE_ENDIAN
|
|
@ -1,22 +1,62 @@
|
|||
README file for Nyquist Version 3.03
|
||||
24 Feb 2009
|
||||
README file for Nyquist Version 3.09
|
||||
28 Dec 2014
|
||||
Roger B. Dannenberg
|
||||
|
||||
LICENSE: see license.txt
|
||||
WEB SITE: http://www.cs.cmu.edu/~rbd/nyquist.html
|
||||
WEB SITE: http://www.cs.cmu.edu/~music/nyquist
|
||||
|
||||
INSTALLING NYQUIST
|
||||
====================
|
||||
Please see Section 1.1, Page 1, of the Nyquist Manual
|
||||
You can download pre-compiled versions for Windows and OS X.
|
||||
|
||||
If you use Windows 95 or Windows NT, this release was
|
||||
compiled with Visual C++ 6.0.
|
||||
You can compile Nyquist from sources for Windows, OS X, linux, and
|
||||
other versions of Unix. For details, see one of these files:
|
||||
- sys/win/README.txt
|
||||
- sys/mac/README.txt
|
||||
- sys/unix/README.txt
|
||||
|
||||
For Mac OS X command line users, there is an executable
|
||||
Nyquist program: NyquistIDE.app/Contents/Resources/Java/ny
|
||||
|
||||
IMPLEMENTATION STATUS
|
||||
=====================
|
||||
|
||||
Version 3.09 provides:
|
||||
Various bug fixes
|
||||
OS X version is significantly faster
|
||||
Security features added to limit CPU, memory, file access (default
|
||||
is still unrestricted; this feature is to protect servers)
|
||||
|
||||
Version 3.08 provides:
|
||||
NyquistIDE opens documentation properly on default browser
|
||||
NyquistIDE forcefully terminates nyquist process on exit if needed
|
||||
bug fix for mixed sample rate signal handling, affects many primitives
|
||||
timed-seq and score-play avoid stack overflow on finely spaced events
|
||||
sampler() primitive does error checking to avoid infinite loop
|
||||
|
||||
Version 3.07 provides:
|
||||
Bug fixes in NyquistIDE Envelope Editor
|
||||
NyquistIDE installs symbolic links to lib and demos
|
||||
directories from nyquist directory (where documentation
|
||||
is kept) so these folders are not hidden in the app bundle.
|
||||
Bug fix in quantize and snd-quantize functions.
|
||||
|
||||
Version 3.06 provides:
|
||||
64-bit architecture support
|
||||
Access to OGG and FLAC file formats
|
||||
Updates for MSVC++2010, VS2012, XCode 4.5
|
||||
This is a deadline-driven release. Expect an update soon.
|
||||
|
||||
Version 3.05 provides:
|
||||
New "UPIC Editor" window in NyquistIDE
|
||||
Fix to escape backslashes in default windows directory
|
||||
Fix to other problems with Preferences
|
||||
Arpeggiator example in nyquist/demos
|
||||
|
||||
Version 3.04 provides:
|
||||
Updates to libraries, including liblo and PortAudio
|
||||
Documentation uses both syntax SAL and Lisp syntax
|
||||
Some STK instruments have been added
|
||||
Build files modified to make 32-bit code even on 64-bit
|
||||
architectures (Nyquist only runs in 32-bit mode)
|
||||
Version 3.03 provides:
|
||||
Bug fix to Markov pattern generator (see make-markov).
|
||||
Update to current (24-feb-09) liblo library.
|
||||
|
@ -215,20 +255,3 @@ todo - list of things to do (this may not be in the release)
|
|||
tran - descriptor (.alg) files for machine-translated Nyquist code
|
||||
xlisp - sources for Xlisp (these are linked into Nyquist)
|
||||
|
||||
THE RUNTIME ONLY RELEASE
|
||||
========================
|
||||
The runtime-only release contains everything related to running
|
||||
Nyquist, but no source code. The files in this release are:
|
||||
Readme.txt (this file)
|
||||
nyquist.exe (located in the runtime directory)
|
||||
runtime (directory)
|
||||
lib (directory)
|
||||
demos (directory)
|
||||
test (directory)
|
||||
|
||||
BUILDING UNDER LINUX
|
||||
====================
|
||||
in the nyquist directory:
|
||||
> ln -s sys/unix/linux/Makefile
|
||||
> make
|
||||
|
||||
|
|
|
@ -89,6 +89,13 @@
|
|||
#include "ctype.h"
|
||||
#include "string.h"
|
||||
|
||||
/* this should really be defined in security.h, but it is in xlisp.h.
|
||||
* I don't want to add an xlisp dependency here, nor do I want to
|
||||
* create security.h since that's not how xlisp does things.
|
||||
* The C++ linker will type check so this is at least type safe.
|
||||
*/
|
||||
int ok_to_open(const char *filename, const char *mode);
|
||||
|
||||
#define syntax_max 10 /* allow for 10 syntax strings */
|
||||
private char *syntax[syntax_max];
|
||||
private int n_syntax = 0; /* number of strings so far */
|
||||
|
@ -440,9 +447,11 @@ private void indirect_command(filename, oldarg0)
|
|||
char *filename;
|
||||
char *oldarg0;
|
||||
{
|
||||
FILE *argfile = fopen(filename, "r");
|
||||
FILE *argfile = NULL;
|
||||
if (ok_to_open(filename, "r"))
|
||||
argfile = fopen(filename, "r");
|
||||
if (!argfile) {
|
||||
argv = (char **) malloc(sizeof(char *));
|
||||
argv = (char **) malloc(sizeof(char *));
|
||||
argv[0] = oldarg0;
|
||||
argc = 1;
|
||||
} else {
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
extern void midifile();
|
||||
extern int (*Mf_getc)();
|
||||
extern void (*Mf_header)();
|
||||
extern void (*Mf_starttrack)();
|
||||
extern void (*Mf_endtrack)();
|
||||
extern void (*Mf_on)();
|
||||
extern void (*Mf_off)();
|
||||
extern void (*Mf_pressure)();
|
||||
extern void (*Mf_controller)();
|
||||
extern void (*Mf_pitchbend)();
|
||||
extern void (*Mf_program)();
|
||||
extern void (*Mf_chanpressure)();
|
||||
extern void (*Mf_sysex)();
|
||||
extern void (*Mf_metamisc)();
|
||||
extern void (*Mf_sqspecific)();
|
||||
extern void (*Mf_seqnum)();
|
||||
extern void (*Mf_text)();
|
||||
extern void (*Mf_eot)();
|
||||
extern void (*Mf_timesig)();
|
||||
extern void (*Mf_smpte)();
|
||||
extern void (*Mf_tempo)();
|
||||
extern void (*Mf_keysig)();
|
||||
extern void (*Mf_arbitrary)();
|
||||
extern void (*Mf_error)();
|
||||
extern void midifile(void);
|
||||
extern int (*Mf_getc)(void);
|
||||
extern void (*Mf_header)(int,int,int);
|
||||
extern void (*Mf_starttrack)(void);
|
||||
extern void (*Mf_endtrack)(void);
|
||||
extern void (*Mf_on)(int,int,int);
|
||||
extern void (*Mf_off)(int,int,int);
|
||||
extern void (*Mf_pressure)(int,int,int);
|
||||
extern void (*Mf_controller)(int,int,int);
|
||||
extern void (*Mf_pitchbend)(int,int,int);
|
||||
extern void (*Mf_program)(int,int);
|
||||
extern void (*Mf_chanpressure)(int,int);
|
||||
extern void (*Mf_sysex)(int,char*);
|
||||
extern void (*Mf_metamisc)(int,int,char*);
|
||||
extern void (*Mf_sqspecific)(int,char*);
|
||||
extern void (*Mf_seqnum)(int);
|
||||
extern void (*Mf_text)(int,int,char*);
|
||||
extern void (*Mf_eot)(void);
|
||||
extern void (*Mf_timesig)(int,int,int,int);
|
||||
extern void (*Mf_smpte)(int,int,int,int,int);
|
||||
extern void (*Mf_tempo)(int);
|
||||
extern void (*Mf_keysig)(int,int);
|
||||
extern void (*Mf_arbitrary)(int,char*);
|
||||
extern void (*Mf_error)(char *);
|
||||
extern long Mf_currtime;
|
||||
extern int Mf_nomerge;
|
||||
extern int Mf_skipinit;
|
||||
|
|
|
@ -600,7 +600,20 @@ boolean rec_init(boolean bender)
|
|||
/* it would be silly to record with only room enough for 10 notes! */
|
||||
}
|
||||
|
||||
|
||||
#ifdef NEED_REC_EVENT
|
||||
/*
|
||||
This function was part of the CMU MIDI Toolkit. It provided a constant time
|
||||
fast way to record midi data into a buffer. After recording, the buffered
|
||||
data could be transferred into an Adagio score structure, which involved
|
||||
linked list allocation and insertion that might have caused performance
|
||||
problems. This code uses the high-order bit of longs to distinguish timestamps
|
||||
from data (MIDI messages), but the code seems to assume little endian, and
|
||||
I'm not sure how it worked on both Intel and 68000 processors. Rather than
|
||||
look more closely or fix it, I'm commenting it out because Nyquist does not
|
||||
have any MIDI I/O capability and does not need the function. It is here for
|
||||
completeness, since this is probably the only archived version of the CMU
|
||||
MIDI Toolkit. */
|
||||
|
||||
/****************************************************************************
|
||||
* rec_event
|
||||
* Inputs:
|
||||
|
@ -636,3 +649,5 @@ overflow:
|
|||
gprintf(ERROR, "No more memory.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -35,14 +35,15 @@ boolean clock_running = FALSE; /* TRUE if clock is running */
|
|||
boolean external_midi_clock = FALSE;
|
||||
boolean suppress_midi_clock = FALSE;
|
||||
|
||||
private void insert_event();
|
||||
private void process_event();
|
||||
private void insert_event(seq_type, register event_type);
|
||||
private void process_event(seq_type);
|
||||
|
||||
private char *chunk_alloc();
|
||||
private void clock_tick();
|
||||
private char *chunk_alloc(seq_type seq, int size);
|
||||
private void clock_tick(seq_type seq, time_type fraction);
|
||||
private void ramp_event(seq_type seq, event_type event, unsigned int value,
|
||||
unsigned int to_value, int increment, time_type step, int n);
|
||||
/*private*/ void send_macro();
|
||||
/*private*/ void send_macro(register unsigned char *ptr, int voice,
|
||||
short parameter[], int parm_num, int value, int nline);
|
||||
|
||||
/* chunk_alloc -- allocate data for a sequence */
|
||||
/*
|
||||
|
@ -103,9 +104,7 @@ chunk_type chunk_create(boolean first_flag)
|
|||
|
||||
/* clock_tick -- advance the clock and send a tick */
|
||||
/**/
|
||||
private void clock_tick(seq, fraction)
|
||||
seq_type seq;
|
||||
time_type fraction;
|
||||
private void clock_tick(seq_type seq, time_type fraction)
|
||||
{
|
||||
int delay;
|
||||
fraction += clock_ticksize;
|
||||
|
@ -121,8 +120,7 @@ private void clock_tick(seq, fraction)
|
|||
}
|
||||
}
|
||||
|
||||
private void cycle(seq)
|
||||
seq_type seq;
|
||||
private void cycle(seq_type seq)
|
||||
{
|
||||
seq_reset(seq);
|
||||
seq_play(seq);
|
||||
|
@ -828,11 +826,7 @@ void seq_at_end(seq, fn)
|
|||
|
||||
/* seq_cause_noteoff_meth -- turn off a note in the future */
|
||||
/**/
|
||||
void seq_cause_noteoff_meth(seq, delay, voice, pitch)
|
||||
seq_type seq;
|
||||
time_type delay;
|
||||
int voice;
|
||||
int pitch;
|
||||
void seq_cause_noteoff_meth(seq_type seq, time_type delay, int voice, int pitch)
|
||||
{
|
||||
if (seq->note_enable) {
|
||||
pitch += seq->transpose;
|
||||
|
@ -1021,10 +1015,7 @@ void seq_midi_touch_meth(seq_type seq, int voice, int value)
|
|||
|
||||
/* seq_noteoff_meth -- turn a seq note off */
|
||||
/**/
|
||||
void seq_noteoff_meth(seq, voice, pitch)
|
||||
seq_type seq;
|
||||
int voice;
|
||||
int pitch;
|
||||
void seq_noteoff_meth(seq_type seq, int voice, int pitch)
|
||||
{
|
||||
midi_note(voice, pitch, 0);
|
||||
/*gprintf(TRANS, "_e");*/
|
||||
|
@ -1034,9 +1025,7 @@ void seq_noteoff_meth(seq, voice, pitch)
|
|||
|
||||
/* seq_noteon_meth -- play a note with transformations */
|
||||
/**/
|
||||
void seq_noteon_meth(seq, chan, pitch, vel)
|
||||
seq_type seq;
|
||||
int chan, pitch, vel;
|
||||
void seq_noteon_meth(seq_type seq, int chan, int pitch, int vel)
|
||||
{
|
||||
if (seq->note_enable) {
|
||||
pitch += seq->transpose;
|
||||
|
@ -1100,8 +1089,7 @@ void seq_play(seq)
|
|||
|
||||
/* seq_reset_meth -- reset a sequence to start back at the first event */
|
||||
/**/
|
||||
void seq_reset_meth(seq)
|
||||
seq_type seq;
|
||||
void seq_reset_meth(seq_type seq)
|
||||
{
|
||||
timebase_type old_timebase = timebase;
|
||||
|
||||
|
|
|
@ -168,15 +168,15 @@ typedef struct chunk_struct {
|
|||
|
||||
|
||||
typedef struct seq_struct {
|
||||
void (*cause_noteoff_fn)();
|
||||
void (*midi_bend_fn)();
|
||||
void (*midi_ctrl_fn)();
|
||||
void (*midi_program_fn)();
|
||||
void (*midi_touch_fn)();
|
||||
void (*noteoff_fn)();
|
||||
void (*noteon_fn)();
|
||||
void (*free_fn)();
|
||||
void (*reset_fn)();
|
||||
void (*cause_noteoff_fn)(struct seq_struct *, time_type, int, int);
|
||||
void (*midi_bend_fn)(struct seq_struct * seq, int voice, int value);
|
||||
void (*midi_ctrl_fn)(struct seq_struct * seq, int voice, int ctrl, int value);
|
||||
void (*midi_program_fn)(struct seq_struct * seq, int voice, int prog);
|
||||
void (*midi_touch_fn)(struct seq_struct * seq, int voice, int value);
|
||||
void (*noteoff_fn)(struct seq_struct * seq, int voice, int pitch);
|
||||
void (*noteon_fn)(struct seq_struct * seq, int chan, int pitch, int vel);
|
||||
void (*free_fn)(struct seq_struct * seq);
|
||||
void (*reset_fn)(struct seq_struct * seq);
|
||||
void (*stopfunc)(struct seq_struct *);
|
||||
chunk_type chunklist;
|
||||
/* event_type eventlist;
|
||||
|
|
|
@ -167,9 +167,6 @@ private void smfw_dotrack(seq)
|
|||
unsigned long chunk_size;
|
||||
|
||||
if (seq->runflag) {
|
||||
if ((seq->timebase->virt_base == 0) &&
|
||||
(seq->timebase->rate == STOPRATE))
|
||||
/*we just set these last time through... do nothing*/;
|
||||
seq_stop(seq);
|
||||
}
|
||||
timebase_use(seq->timebase);
|
||||
|
@ -541,8 +538,9 @@ void seq_write_smf(seq, outfile)
|
|||
|
||||
event = seq_events(smfw_seq.seq);
|
||||
|
||||
/*search for clock events up till start of score*/
|
||||
while(event->ntime <= 0){
|
||||
/* search for clock events up till start of score */
|
||||
/* careful: there may be no events at all */
|
||||
while(event && event->ntime <= 0){
|
||||
if(debug) gprintf(TRANS, "event (time:%ld)\n", event->ntime);
|
||||
if(vc_ctrl(event->nvoice) == ESC_CTRL && event->value == CLOCK_VALUE) {
|
||||
if(debug) gprintf(TRANS, "clock %lu at 0\n", event->u.clock.ticksize);
|
||||
|
@ -570,55 +568,61 @@ void seq_write_smf(seq, outfile)
|
|||
putc(0x02, smfw_seq.outfile);/*division resolution of 600*/
|
||||
putc(0x58, smfw_seq.outfile);
|
||||
|
||||
for(i = 0; i < 17; i++){/*for each track..*/
|
||||
if(((seq_used_mask(smfw_seq.seq) >> (i - 1)) & 0x1) || (i == 0)){
|
||||
if(debug) gprintf(TRANS, "write track %d \n", i);
|
||||
track_count++;
|
||||
clock_ticksize = starting_ticksize;
|
||||
last_tick_size = starting_ticksize;
|
||||
putc(0x4D, smfw_seq.outfile);/*track header: MTrk*/
|
||||
putc(0x54, smfw_seq.outfile);
|
||||
putc(0x72, smfw_seq.outfile);
|
||||
putc(0x6B, smfw_seq.outfile);
|
||||
for (i = 0; i < 17; i++) { /* for each track... */
|
||||
if (((seq_used_mask(smfw_seq.seq) >> (i - 1)) & 0x1) || (i == 0)) {
|
||||
if (debug) gprintf(TRANS, "write track %d \n", i);
|
||||
track_count++;
|
||||
clock_ticksize = starting_ticksize;
|
||||
last_tick_size = starting_ticksize;
|
||||
putc(0x4D, smfw_seq.outfile);/*track header: MTrk*/
|
||||
putc(0x54, smfw_seq.outfile);
|
||||
putc(0x72, smfw_seq.outfile);
|
||||
putc(0x6B, smfw_seq.outfile);
|
||||
|
||||
chunk_size_marker = ftell(smfw_seq.outfile);/*size of chunk will be written later*/
|
||||
putc(0x00, smfw_seq.outfile); /*will be filled by chunk_size_marker*/
|
||||
putc(0x00, smfw_seq.outfile);
|
||||
putc(0x00, smfw_seq.outfile);
|
||||
putc(0x00, smfw_seq.outfile);
|
||||
|
||||
if(i == 0) { /*tempo and time signature track*/
|
||||
putc(0x00, smfw_seq.outfile);/* default time sig stuff*/
|
||||
putc(0xFF, smfw_seq.outfile);
|
||||
putc(0x58, smfw_seq.outfile);
|
||||
putc(0x04, smfw_seq.outfile);
|
||||
putc(0x04, smfw_seq.outfile);
|
||||
putc(0x02, smfw_seq.outfile);
|
||||
putc(0x18, smfw_seq.outfile);
|
||||
putc(0x08, smfw_seq.outfile);
|
||||
chunk_size_marker = ftell(smfw_seq.outfile);
|
||||
/* size of chunk will be written later */
|
||||
/* will be filled by chunk_size_marker */
|
||||
putc(0x00, smfw_seq.outfile);
|
||||
putc(0x00, smfw_seq.outfile);
|
||||
putc(0x00, smfw_seq.outfile);
|
||||
putc(0x00, smfw_seq.outfile);
|
||||
|
||||
if (i == 0) { /* tempo and time signature track */
|
||||
putc(0x00, smfw_seq.outfile);/* default time sig stuff*/
|
||||
putc(0xFF, smfw_seq.outfile);
|
||||
putc(0x58, smfw_seq.outfile);
|
||||
putc(0x04, smfw_seq.outfile);
|
||||
putc(0x04, smfw_seq.outfile);
|
||||
putc(0x02, smfw_seq.outfile);
|
||||
putc(0x18, smfw_seq.outfile);
|
||||
putc(0x08, smfw_seq.outfile);
|
||||
putc(0x00, smfw_seq.outfile);
|
||||
|
||||
putc(0xFF, smfw_seq.outfile);/*TEMPO: inserted here in case default is used*/
|
||||
putc(0x51, smfw_seq.outfile);
|
||||
putc(0x03, smfw_seq.outfile);
|
||||
/* ticksize is in ms<<16, so to get milliseconds per tick, it's
|
||||
ticksize / 65536. To get beat durations, multiply by 24 to get
|
||||
ticksize * 24 / 65536. To get microseconds, multiply by 1000:
|
||||
ticksize * 24000 / 65536. Divide both constants by 64 to get
|
||||
ticksize * 375 / 1024 = microseconds per quarter note.
|
||||
*/
|
||||
put_tick_size = scale(clock_ticksize, 375L, 1024L);
|
||||
putc((int) ((put_tick_size >> 16) & 0xFF), smfw_seq.outfile);
|
||||
putc((int) ((put_tick_size >> 8) & 0xFF), smfw_seq.outfile);
|
||||
putc((int) (put_tick_size & 0xFF), smfw_seq.outfile);
|
||||
/* TEMPO: inserted here in case default is used */
|
||||
putc(0xFF, smfw_seq.outfile);
|
||||
putc(0x51, smfw_seq.outfile);
|
||||
putc(0x03, smfw_seq.outfile);
|
||||
/* ticksize is in ms<<16, so to get milliseconds per tick, it's
|
||||
ticksize / 65536. To get beat durations, multiply by 24
|
||||
to get ticksize * 24 / 65536. To get microseconds,
|
||||
multiply by 1000: ticksize * 24000 / 65536. Divide both
|
||||
constants by 64 to get ticksize * 375 / 1024 =
|
||||
microseconds per quarter note.
|
||||
*/
|
||||
put_tick_size = scale(clock_ticksize, 375L, 1024L);
|
||||
putc((int) ((put_tick_size >> 16) & 0xFF), smfw_seq.outfile);
|
||||
putc((int) ((put_tick_size >> 8) & 0xFF), smfw_seq.outfile);
|
||||
putc((int) (put_tick_size & 0xFF), smfw_seq.outfile);
|
||||
}
|
||||
smfw_seq.track = i;
|
||||
smfw_dotrack(smfw_seq.seq);
|
||||
}
|
||||
smfw_seq.track = i;
|
||||
smfw_dotrack(smfw_seq.seq);
|
||||
}
|
||||
}
|
||||
if(seti_counter) gprintf(TRANS, "%d SETI events IGNORED!\n", seti_counter);
|
||||
if (seti_counter)
|
||||
gprintf(TRANS, "%d SETI events IGNORED!\n", seti_counter);
|
||||
seq_stop(smfw_seq.seq);
|
||||
fseek(smfw_seq.outfile, track_count_marker, 0);/*go back and insert number of tracks*/
|
||||
/* go back and insert number of tracks */
|
||||
fseek(smfw_seq.outfile, track_count_marker, 0);
|
||||
putc(0xFF & track_count, smfw_seq.outfile);
|
||||
fclose(smfw_seq.outfile);
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@
|
|||
#ifndef NYQUIST
|
||||
#define MIDIMGR
|
||||
#endif
|
||||
#define USE_VSPRINTF
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#endif
|
||||
|
||||
#ifdef BORLAND
|
||||
|
@ -161,12 +161,12 @@
|
|||
#define ITC
|
||||
#endif
|
||||
|
||||
/* USE_VSPRINTF says vsprintf() is defined */
|
||||
/* HAVE_VSNPRINTF says vsnprintf() is defined */
|
||||
#ifdef ITC
|
||||
#define USE_VSPRINTF
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#endif
|
||||
#ifdef AZTEC
|
||||
#define USE_VSPRINTF
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -537,8 +537,14 @@ FILE *fileopen(deflt, extension, mode, prompt)
|
|||
strcpy(extname, fileopen_name);
|
||||
strcat(extname, ".");
|
||||
strcat(extname, extension);
|
||||
fp = fopen(fileopen_name, mode);
|
||||
fpext = fopen(extname, mode);
|
||||
fp = NULL;
|
||||
fpext = NULL;
|
||||
if (ok_to_open(fileopen_name, mode)) {
|
||||
fp = fopen(fileopen_name, mode);
|
||||
}
|
||||
if (ok_to_open(extname, mode)) {
|
||||
fpext = fopen(extname, mode);
|
||||
}
|
||||
if (fp != NULL && fpext != NULL) {
|
||||
gprintf(TRANS,
|
||||
"warning: both %s and %s exist. %s will be used.\n",
|
||||
|
@ -566,7 +572,9 @@ FILE *fileopen(deflt, extension, mode, prompt)
|
|||
&& added_extension
|
||||
#endif
|
||||
) {
|
||||
fp = fopen(fileopen_name, "r");
|
||||
fp = NULL;
|
||||
if (ok_to_open(fileopen_name, "r"))
|
||||
fp = fopen(fileopen_name, "r");
|
||||
if (fp != NULL) {
|
||||
char question[100];
|
||||
fclose(fp);
|
||||
|
@ -579,7 +587,9 @@ FILE *fileopen(deflt, extension, mode, prompt)
|
|||
}
|
||||
}
|
||||
}
|
||||
fp = fopen(fileopen_name, mode);
|
||||
fp = NULL;
|
||||
if (ok_to_open(fileopen_name, mode))
|
||||
fp = fopen(fileopen_name, mode);
|
||||
if (fp == NULL) problem = "Couldn't create %s.\n";
|
||||
}
|
||||
tryagain:
|
||||
|
@ -592,7 +602,6 @@ FILE *fileopen(deflt, extension, mode, prompt)
|
|||
return fp;
|
||||
}
|
||||
|
||||
|
||||
#ifdef MACINTOSH
|
||||
|
||||
static int GetReadFileName(name)
|
||||
|
@ -786,7 +795,7 @@ void readln(fp)
|
|||
* Note that to handle the variable argument list, a number of different
|
||||
* approaches are implemented. The first part of the implementation selects
|
||||
* one of 4 ways to build temp1, a formatted string. The 4 ways arise from
|
||||
* use or non-use of vsprintf, and use or non-use of ... in the arg list.
|
||||
* use or non-use of vsnprintf, and use or non-use of ... in the arg list.
|
||||
* After building temp1, non-Amiga systems write to stdout or stderr,
|
||||
* whereas AMIGA writes to a special console. Why? Because the Amiga
|
||||
* needs a new console so we can set up a signal upon character typein.
|
||||
|
@ -794,10 +803,10 @@ void readln(fp)
|
|||
|
||||
#ifndef gprintf
|
||||
#define GPRINTF_MESSAGE_LEN 512
|
||||
#ifdef USE_VSPRINTF
|
||||
#ifdef HAVE_VSNPRINTF
|
||||
#ifdef DOTS_FOR_ARGS
|
||||
|
||||
/* define with ... in arg list and use vsprintf to get temp1 */
|
||||
/* define with ... in arg list and use vsnprintf to get temp1 */
|
||||
public void gprintf(long where, char *format, ...)
|
||||
{
|
||||
char temp1[GPRINTF_MESSAGE_LEN];
|
||||
|
@ -807,12 +816,12 @@ public void gprintf(long where, char *format, ...)
|
|||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
vsprintf(temp1, format, ap);
|
||||
vsnprintf(temp1, GPRINTF_MESSAGE_LEN, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
#else /* !DOTS_FOR_ARGS */
|
||||
|
||||
/* define with va_alist and use vsprintf to get temp1 */
|
||||
/* define with va_alist and use vsnprintf to get temp1 */
|
||||
public void gprintf(where, format, va_alist)
|
||||
long where;
|
||||
char *format;
|
||||
|
@ -823,19 +832,19 @@ va_dcl
|
|||
/* this is a syntax error - if you don't have to remove this, */
|
||||
/* then this whole section of code is unnecessary. */
|
||||
va_start(pvar);
|
||||
vsprintf(temp1, format, pvar);
|
||||
vsnprintf(temp1, GPRINTF_MESSAGE_LEN, format, pvar);
|
||||
va_end(pvar);
|
||||
|
||||
#endif /* DOTS_FOR_ARGS */
|
||||
|
||||
#else /* !USE_VSPRINTF */
|
||||
#else /* !HAVE_VSNPRINTF */
|
||||
#define MAX_GPRINTF_ARGS 10
|
||||
typedef struct gp_args_struct {
|
||||
long arg[MAX_GPRINTF_ARGS];
|
||||
} gp_args_node;
|
||||
|
||||
#ifdef DOTS_FOR_ARGS
|
||||
/* use ... but not vsprintf */
|
||||
/* use ... but not vsnprintf */
|
||||
public void gprintf(long where, char *format, ...)
|
||||
{
|
||||
char temp1[GPRINTF_MESSAGE_LEN];
|
||||
|
@ -848,7 +857,7 @@ public void gprintf(long where, char *format, ...)
|
|||
args = va_arg(ap, gp_args_node);
|
||||
va_end(ap);
|
||||
#else /* !DOTS_FOR_ARGS */
|
||||
/* don't use ... and don't use vsprintf */
|
||||
/* don't use ... and don't use vsnprintf */
|
||||
public void gprintf(where, format, args)
|
||||
long where;
|
||||
char *format;
|
||||
|
@ -860,9 +869,9 @@ public void gprintf(where, format, args)
|
|||
#endif /* AMIGA*/
|
||||
#endif /* DOTS_FOR_ARGS */
|
||||
|
||||
sprintf(temp1, format, args);
|
||||
snprintf(temp1, GPRINTF_MESSAGE_LEN, format, args);
|
||||
|
||||
#endif /* USE_VSPRINTF */
|
||||
#endif /* HAVE_VSNPRINTF */
|
||||
|
||||
/*
|
||||
* Now we've got formatted output in temp1. Write it out.
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/*******************************************************************
|
||||
lower level fft stuff including routines called in fftext.c and fft2d.c
|
||||
*******************************************************************/
|
||||
/* inline declarations modified by RBD for C99 compiler */
|
||||
|
||||
#include "fftlib.h"
|
||||
#include <math.h>
|
||||
#define MCACHE (11-(sizeof(float)/8)) // fft's with M bigger than this bust primary cache
|
||||
|
@ -61,8 +63,8 @@ for (i1 = 0; i1 < Nroot_1; i1++){
|
|||
parts of ffts1
|
||||
*************************************************/
|
||||
|
||||
inline void bitrevR2(float *ioptr, long M, short *BRLow);
|
||||
inline void bitrevR2(float *ioptr, long M, short *BRLow){
|
||||
//inline void bitrevR2(float *ioptr, long M, short *BRLow);
|
||||
static inline void bitrevR2(float *ioptr, long M, short *BRLow){
|
||||
/*** bit reverse and first radix 2 stage of forward or inverse fft ***/
|
||||
float f0r;
|
||||
float f0i;
|
||||
|
@ -198,8 +200,8 @@ for (; ioptr < iolimit; ioptr += POW2(M/2+1)){
|
|||
};
|
||||
}
|
||||
|
||||
inline void fft2pt(float *ioptr);
|
||||
inline void fft2pt(float *ioptr){
|
||||
//inline void fft2pt(float *ioptr);
|
||||
static inline void fft2pt(float *ioptr){
|
||||
/*** RADIX 2 fft ***/
|
||||
float f0r, f0i, f1r, f1i;
|
||||
float t0r, t0i;
|
||||
|
@ -229,8 +231,8 @@ ioptr[3] = f1i;
|
|||
}
|
||||
|
||||
|
||||
inline void fft4pt(float *ioptr);
|
||||
inline void fft4pt(float *ioptr){
|
||||
//inline void fft4pt(float *ioptr);
|
||||
static inline void fft4pt(float *ioptr){
|
||||
/*** RADIX 4 fft ***/
|
||||
float f0r, f0i, f1r, f1i, f2r, f2i, f3r, f3i;
|
||||
float t0r, t0i, t1r, t1i;
|
||||
|
@ -284,8 +286,8 @@ ioptr[6] = f3r;
|
|||
ioptr[7] = f3i;
|
||||
}
|
||||
|
||||
inline void fft8pt(float *ioptr);
|
||||
inline void fft8pt(float *ioptr){
|
||||
//inline void fft8pt(float *ioptr);
|
||||
static inline void fft8pt(float *ioptr){
|
||||
/*** RADIX 8 fft ***/
|
||||
float w0r = 1.0/MYROOT2; /* cos(pi/4) */
|
||||
float f0r, f0i, f1r, f1i, f2r, f2i, f3r, f3i;
|
||||
|
@ -403,8 +405,8 @@ ioptr[14] = f6r;
|
|||
ioptr[15] = f6i;
|
||||
}
|
||||
|
||||
inline void bfR2(float *ioptr, long M, long NDiffU);
|
||||
inline void bfR2(float *ioptr, long M, long NDiffU){
|
||||
//inline void bfR2(float *ioptr, long M, long NDiffU);
|
||||
static inline void bfR2(float *ioptr, long M, long NDiffU){
|
||||
/*** 2nd radix 2 stage ***/
|
||||
unsigned long pos;
|
||||
unsigned long posi;
|
||||
|
@ -512,8 +514,8 @@ for (SameUCnt = NSameU; SameUCnt > 0 ; SameUCnt--){
|
|||
}
|
||||
}
|
||||
|
||||
inline void bfR4(float *ioptr, long M, long NDiffU);
|
||||
inline void bfR4(float *ioptr, long M, long NDiffU){
|
||||
//inline void bfR4(float *ioptr, long M, long NDiffU);
|
||||
static inline void bfR4(float *ioptr, long M, long NDiffU){
|
||||
/*** 1 radix 4 stage ***/
|
||||
unsigned long pos;
|
||||
unsigned long posi;
|
||||
|
@ -721,8 +723,8 @@ f4i = f4i * Two - f6i;
|
|||
|
||||
}
|
||||
|
||||
inline void bfstages(float *ioptr, long M, float *Utbl, long Ustride, long NDiffU, long StageCnt);
|
||||
inline void bfstages(float *ioptr, long M, float *Utbl, long Ustride, long NDiffU, long StageCnt){
|
||||
// inline void bfstages(float *ioptr, long M, float *Utbl, long Ustride, long NDiffU, long StageCnt);
|
||||
static inline void bfstages(float *ioptr, long M, float *Utbl, long Ustride, long NDiffU, long StageCnt){
|
||||
/*** RADIX 8 Stages ***/
|
||||
unsigned long pos;
|
||||
unsigned long posi;
|
||||
|
@ -1125,8 +1127,8 @@ default:
|
|||
parts of iffts1
|
||||
*************************************************/
|
||||
|
||||
inline void scbitrevR2(float *ioptr, long M, short *BRLow, float scale);
|
||||
inline void scbitrevR2(float *ioptr, long M, short *BRLow, float scale){
|
||||
// inline void scbitrevR2(float *ioptr, long M, short *BRLow, float scale);
|
||||
static inline void scbitrevR2(float *ioptr, long M, short *BRLow, float scale){
|
||||
/*** scaled bit reverse and first radix 2 stage forward or inverse fft ***/
|
||||
float f0r;
|
||||
float f0i;
|
||||
|
@ -1262,8 +1264,8 @@ for (; ioptr < iolimit; ioptr += POW2(M/2+1)){
|
|||
};
|
||||
}
|
||||
|
||||
inline void ifft2pt(float *ioptr, float scale);
|
||||
inline void ifft2pt(float *ioptr, float scale){
|
||||
//inline void ifft2pt(float *ioptr, float scale);
|
||||
static inline void ifft2pt(float *ioptr, float scale){
|
||||
/*** RADIX 2 ifft ***/
|
||||
float f0r, f0i, f1r, f1i;
|
||||
float t0r, t0i;
|
||||
|
@ -1292,8 +1294,8 @@ ioptr[2] = scale*f1r;
|
|||
ioptr[3] = scale*f1i;
|
||||
}
|
||||
|
||||
inline void ifft4pt(float *ioptr, float scale);
|
||||
inline void ifft4pt(float *ioptr, float scale){
|
||||
// inline void ifft4pt(float *ioptr, float scale);
|
||||
static inline void ifft4pt(float *ioptr, float scale){
|
||||
/*** RADIX 4 ifft ***/
|
||||
float f0r, f0i, f1r, f1i, f2r, f2i, f3r, f3i;
|
||||
float t0r, t0i, t1r, t1i;
|
||||
|
@ -1347,8 +1349,8 @@ ioptr[6] = scale*f3r;
|
|||
ioptr[7] = scale*f3i;
|
||||
}
|
||||
|
||||
inline void ifft8pt(float *ioptr, float scale);
|
||||
inline void ifft8pt(float *ioptr, float scale){
|
||||
//inline void ifft8pt(float *ioptr, float scale);
|
||||
static inline void ifft8pt(float *ioptr, float scale){
|
||||
/*** RADIX 8 ifft ***/
|
||||
float w0r = 1.0/MYROOT2; /* cos(pi/4) */
|
||||
float f0r, f0i, f1r, f1i, f2r, f2i, f3r, f3i;
|
||||
|
@ -1467,8 +1469,8 @@ ioptr[14] = scale*f6r;
|
|||
ioptr[15] = scale*f6i;
|
||||
}
|
||||
|
||||
inline void ibfR2(float *ioptr, long M, long NDiffU);
|
||||
inline void ibfR2(float *ioptr, long M, long NDiffU){
|
||||
//inline void ibfR2(float *ioptr, long M, long NDiffU);
|
||||
static inline void ibfR2(float *ioptr, long M, long NDiffU){
|
||||
/*** 2nd radix 2 stage ***/
|
||||
unsigned long pos;
|
||||
unsigned long posi;
|
||||
|
@ -1576,8 +1578,8 @@ for (SameUCnt = NSameU; SameUCnt > 0 ; SameUCnt--){
|
|||
}
|
||||
}
|
||||
|
||||
inline void ibfR4(float *ioptr, long M, long NDiffU);
|
||||
inline void ibfR4(float *ioptr, long M, long NDiffU){
|
||||
//inline void ibfR4(float *ioptr, long M, long NDiffU);
|
||||
static inline void ibfR4(float *ioptr, long M, long NDiffU){
|
||||
/*** 1 radix 4 stage ***/
|
||||
unsigned long pos;
|
||||
unsigned long posi;
|
||||
|
@ -1785,8 +1787,8 @@ f4i = f4i * Two - f6i;
|
|||
|
||||
}
|
||||
|
||||
inline void ibfstages(float *ioptr, long M, float *Utbl, long Ustride, long NDiffU, long StageCnt);
|
||||
inline void ibfstages(float *ioptr, long M, float *Utbl, long Ustride, long NDiffU, long StageCnt){
|
||||
//inline void ibfstages(float *ioptr, long M, float *Utbl, long Ustride, long NDiffU, long StageCnt);
|
||||
static inline void ibfstages(float *ioptr, long M, float *Utbl, long Ustride, long NDiffU, long StageCnt){
|
||||
/*** RADIX 8 Stages ***/
|
||||
unsigned long pos;
|
||||
unsigned long posi;
|
||||
|
@ -2193,8 +2195,8 @@ default:
|
|||
parts of rffts1
|
||||
*************************************************/
|
||||
|
||||
inline void rfft1pt(float *ioptr);
|
||||
inline void rfft1pt(float *ioptr){
|
||||
//inline void rfft1pt(float *ioptr);
|
||||
static inline void rfft1pt(float *ioptr){
|
||||
/*** RADIX 2 rfft ***/
|
||||
float f0r, f0i;
|
||||
float t0r, t0i;
|
||||
|
@ -2212,8 +2214,8 @@ ioptr[0] = t0r;
|
|||
ioptr[1] = t0i;
|
||||
}
|
||||
|
||||
inline void rfft2pt(float *ioptr);
|
||||
inline void rfft2pt(float *ioptr){
|
||||
//inline void rfft2pt(float *ioptr);
|
||||
static inline void rfft2pt(float *ioptr){
|
||||
/*** RADIX 4 rfft ***/
|
||||
float f0r, f0i, f1r, f1i;
|
||||
float t0r, t0i;
|
||||
|
@ -2245,8 +2247,8 @@ ioptr[2] = f1r;
|
|||
ioptr[3] = f1i;
|
||||
}
|
||||
|
||||
inline void rfft4pt(float *ioptr);
|
||||
inline void rfft4pt(float *ioptr){
|
||||
//inline void rfft4pt(float *ioptr);
|
||||
static inline void rfft4pt(float *ioptr){
|
||||
/*** RADIX 8 rfft ***/
|
||||
float f0r, f0i, f1r, f1i, f2r, f2i, f3r, f3i;
|
||||
float t0r, t0i, t1r, t1i;
|
||||
|
@ -2318,8 +2320,8 @@ ioptr[6] = scale*f3r;
|
|||
ioptr[7] = scale*f3i;
|
||||
}
|
||||
|
||||
inline void rfft8pt(float *ioptr);
|
||||
inline void rfft8pt(float *ioptr){
|
||||
//inline void rfft8pt(float *ioptr);
|
||||
static inline void rfft8pt(float *ioptr){
|
||||
/*** RADIX 16 rfft ***/
|
||||
float w0r = 1.0/MYROOT2; /* cos(pi/4) */
|
||||
float w1r = MYCOSPID8; /* cos(pi/8) */
|
||||
|
@ -2477,8 +2479,8 @@ ioptr[14] = scale*f6r;
|
|||
ioptr[15] = scale*f6i;
|
||||
}
|
||||
|
||||
inline void frstage(float *ioptr, long M, float *Utbl);
|
||||
inline void frstage(float *ioptr, long M, float *Utbl){
|
||||
//inline void frstage(float *ioptr, long M, float *Utbl);
|
||||
static inline void frstage(float *ioptr, long M, float *Utbl){
|
||||
/* Finish RFFT */
|
||||
|
||||
unsigned long pos;
|
||||
|
@ -2687,8 +2689,8 @@ default:
|
|||
parts of riffts1
|
||||
*************************************************/
|
||||
|
||||
inline void rifft1pt(float *ioptr, float scale);
|
||||
inline void rifft1pt(float *ioptr, float scale){
|
||||
//inline void rifft1pt(float *ioptr, float scale);
|
||||
static inline void rifft1pt(float *ioptr, float scale){
|
||||
/*** RADIX 2 rifft ***/
|
||||
float f0r, f0i;
|
||||
float t0r, t0i;
|
||||
|
@ -2706,8 +2708,8 @@ ioptr[0] = scale*t0r;
|
|||
ioptr[1] = scale*t0i;
|
||||
}
|
||||
|
||||
inline void rifft2pt(float *ioptr, float scale);
|
||||
inline void rifft2pt(float *ioptr, float scale){
|
||||
//inline void rifft2pt(float *ioptr, float scale);
|
||||
static inline void rifft2pt(float *ioptr, float scale){
|
||||
/*** RADIX 4 rifft ***/
|
||||
float f0r, f0i, f1r, f1i;
|
||||
float t0r, t0i;
|
||||
|
@ -2740,8 +2742,8 @@ ioptr[2] = scale*f1r;
|
|||
ioptr[3] = scale*f1i;
|
||||
}
|
||||
|
||||
inline void rifft4pt(float *ioptr, float scale);
|
||||
inline void rifft4pt(float *ioptr, float scale){
|
||||
//inline void rifft4pt(float *ioptr, float scale);
|
||||
static inline void rifft4pt(float *ioptr, float scale){
|
||||
/*** RADIX 8 rifft ***/
|
||||
float f0r, f0i, f1r, f1i, f2r, f2i, f3r, f3i;
|
||||
float t0r, t0i, t1r, t1i;
|
||||
|
@ -2811,8 +2813,8 @@ ioptr[6] = scale*f3r;
|
|||
ioptr[7] = scale*f3i;
|
||||
}
|
||||
|
||||
inline void rifft8pt(float *ioptr, float scale);
|
||||
inline void rifft8pt(float *ioptr, float scale){
|
||||
//inline void rifft8pt(float *ioptr, float scale);
|
||||
static inline void rifft8pt(float *ioptr, float scale){
|
||||
/*** RADIX 16 rifft ***/
|
||||
float w0r = 1.0/MYROOT2; /* cos(pi/4) */
|
||||
float w1r = MYCOSPID8; /* cos(pi/8) */
|
||||
|
@ -2968,8 +2970,8 @@ ioptr[14] = scale*f6r;
|
|||
ioptr[15] = scale*f6i;
|
||||
}
|
||||
|
||||
inline void ifrstage(float *ioptr, long M, float *Utbl);
|
||||
inline void ifrstage(float *ioptr, long M, float *Utbl){
|
||||
//inline void ifrstage(float *ioptr, long M, float *Utbl);
|
||||
static inline void ifrstage(float *ioptr, long M, float *Utbl){
|
||||
/* Start RIFFT */
|
||||
|
||||
unsigned long pos;
|
||||
|
|
|
@ -59,17 +59,9 @@ factor, ADD will create a rescaling of the operand.
|
|||
/* #define GC_DEBUG 1 */
|
||||
|
||||
|
||||
void add_s1_s2_nn_fetch(add_susp_type, snd_list_type);
|
||||
void add_s1_nn_fetch(add_susp_type, snd_list_type);
|
||||
void add_s2_nn_fetch(add_susp_type, snd_list_type);
|
||||
void add_zero_fill_nn_fetch(add_susp_type, snd_list_type);
|
||||
void add_free();
|
||||
|
||||
|
||||
void add_s1_s2_nn_fetch(susp, snd_list)
|
||||
register add_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void add_s1_s2_nn_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
add_susp_type susp = (add_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
int togo;
|
||||
int n;
|
||||
|
@ -126,7 +118,7 @@ A if (susp->terminate_bits & 2) {
|
|||
* if a sound has terminated)
|
||||
*/
|
||||
A nyquist_printf(
|
||||
"add[%p,%p] (s1_s2_nn) %p: logically_stopped %d, logical_stop_cnt %d, s1 logical_stop_cnt %d, s2 logical_stop_cnt %d \n",
|
||||
"add[%p,%p] (s1_s2_nn) %p: logically_stopped %d, logical_stop_cnt %d, s1 logical_stop_cnt %ld, s2 logical_stop_cnt %ld \n",
|
||||
susp->s1, susp->s2, susp, susp->logically_stopped,
|
||||
(int) susp->susp.log_stop_cnt,
|
||||
susp->s1->logical_stop_cnt,
|
||||
|
@ -173,7 +165,7 @@ A nyquist_printf("add[%p,%p] (s1_s2_nn) %p starting inner loop, n %d\n",
|
|||
out_ptr_reg = out_ptr;
|
||||
if (n) do { /* the inner sample computation loop */
|
||||
/* scale? */
|
||||
A nyquist_printf("add_s1_s2_nn: %g + %g\n", *s1_ptr_reg, *s2_ptr_reg);
|
||||
/*A nyquist_printf("add_s1_s2_nn: %g + %g\n", *s1_ptr_reg, *s2_ptr_reg); */
|
||||
*out_ptr_reg++ = *(s1_ptr_reg++) + *(s2_ptr_reg++);
|
||||
} while (--n); /* inner loop */
|
||||
/* using s1_ptr_reg is a bad idea on RS/6000 */
|
||||
|
@ -238,7 +230,7 @@ D nyquist_printf("add_s1_s2_nn_fetch: add_s2_nn_fetch installed\n");
|
|||
if (cnt == 0) {
|
||||
D nyquist_printf("add[%p,%p]: calling add_s2_nn_fetch\n",
|
||||
susp->s1, susp->s2);
|
||||
add_s2_nn_fetch(susp, snd_list);
|
||||
add_s2_nn_fetch(a_susp, snd_list);
|
||||
}
|
||||
}
|
||||
else if (susp->terminate_bits & 2) {
|
||||
|
@ -251,7 +243,7 @@ D stdputstr("add_s1_s2_nn_fetch: add_s1_nn_fetch installed\n");
|
|||
if (cnt == 0) {
|
||||
D nyquist_printf("add[%p,%p]: calling add_s1_nn_fetch\n",
|
||||
susp->s1, susp->s2);
|
||||
add_s1_nn_fetch(susp, snd_list);
|
||||
add_s1_nn_fetch(a_susp, snd_list);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,10 +259,9 @@ D nyquist_printf("add[%p,%p]: calling add_s1_nn_fetch\n",
|
|||
* They should probably be made into one routine, but for now,
|
||||
* any changes to one should be made to the other.
|
||||
*/
|
||||
void add_s1_nn_fetch(susp, snd_list)
|
||||
register add_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void add_s1_nn_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
add_susp_type susp = (add_susp_type) a_susp;
|
||||
/* expansion of add_s_nn_fetch(snd_list,s1,s2,1); follows: */
|
||||
int togo, s2_start=0;
|
||||
int n;
|
||||
|
@ -314,7 +305,7 @@ B if (togo == 0) stdputstr("togo is zero at checkpoint 2\n");
|
|||
susp->s1 = NULL;
|
||||
susp->susp.fetch = add_s2_nn_fetch;
|
||||
D stdputstr("add_s_nn_fetch: other installed, calling now...\n");
|
||||
add_s2_nn_fetch(susp, snd_list);
|
||||
add_s2_nn_fetch(a_susp, snd_list);
|
||||
} else if (susp->s2 && susp->susp.current < s2_start) {
|
||||
/* s2 not started and s1 stops */
|
||||
/* go to zero-fill state */
|
||||
|
@ -322,7 +313,7 @@ D stdputstr("add_s_nn_fetch: other installed, calling now...\n");
|
|||
susp->s1 = NULL;
|
||||
susp->susp.fetch = add_zero_fill_nn_fetch;
|
||||
B stdputstr("add_s_nn_fetch: zero_fill installed\n");
|
||||
add_zero_fill_nn_fetch(susp, snd_list);
|
||||
add_zero_fill_nn_fetch(a_susp, snd_list);
|
||||
} else if (susp->s2) {
|
||||
D stdputstr("add_s_nn_fetch: unexpected condition\n");
|
||||
EXIT(1);
|
||||
|
@ -391,7 +382,7 @@ B if (togo == 0) stdputstr("togo is zero at checkpoint 4\n");
|
|||
snd_list->block_len = togo;
|
||||
|
||||
/* if other is terminated and sound_types match, collapse */
|
||||
/* NOTE: in order to collapse, we need s2 to be generating
|
||||
/* NOTE: in order to collapse, we need s1 to be generating
|
||||
* blocks and linking them onto a sound list. This is true
|
||||
* when the get_next fn is SND_get_next. (A counterexample is
|
||||
* SND_get_zeros, which returns zero blocks but does not link
|
||||
|
@ -493,10 +484,9 @@ D {
|
|||
}
|
||||
|
||||
|
||||
void add_s2_nn_fetch(susp, snd_list)
|
||||
register add_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void add_s2_nn_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
add_susp_type susp = (add_susp_type) a_susp;
|
||||
int togo, s1_start=0;
|
||||
int n;
|
||||
sample_block_type out;
|
||||
|
@ -537,7 +527,7 @@ D nyquist_printf("add_s2_nn_fetch(susp %p, snd_list %p)\n",
|
|||
susp->s2 = NULL;
|
||||
susp->susp.fetch = add_s1_nn_fetch;
|
||||
D stdputstr("add_s_nn_fetch: other installed, calling now...\n");
|
||||
add_s1_nn_fetch(susp, snd_list);
|
||||
add_s1_nn_fetch(a_susp, snd_list);
|
||||
} else if (susp->s1 && susp->susp.current < s1_start) {
|
||||
/* s1 not started and s2 stops */
|
||||
/* go to zero-fill state */
|
||||
|
@ -545,7 +535,7 @@ D stdputstr("add_s_nn_fetch: other installed, calling now...\n");
|
|||
susp->s2 = NULL;
|
||||
susp->susp.fetch = add_zero_fill_nn_fetch;
|
||||
D stdputstr("add_s_nn_fetch: zero_fill installed\n");
|
||||
add_zero_fill_nn_fetch(susp, snd_list);
|
||||
add_zero_fill_nn_fetch(a_susp, snd_list);
|
||||
} else if (susp->s1) {
|
||||
D stdputstr("add_s_nn_fetch: unexpected condition\n");
|
||||
EXIT(1);
|
||||
|
@ -565,13 +555,12 @@ D nyquist_printf("add_s_nn_fetch: special return, susp %p\n", susp);
|
|||
/* check if we've seen the logical stop from s2. If so then
|
||||
log_stop_cnt is max of s1 and s2 stop times */
|
||||
(susp->logical_stop_bits & 2)) {
|
||||
/* (some compilers don't like statements before declarations)
|
||||
D nyquist_printf("add_s2_nn_fetch: susp->susp.log_stop_cnt %d\n",
|
||||
int to_stop;
|
||||
D nyquist_printf("add_s2_nn_fetch: susp->susp.log_stop_cnt %ld\n",
|
||||
susp->susp.log_stop_cnt);
|
||||
D nyquist_printf("add_s2_nn_fetch: susp->susp.current %d\n",
|
||||
D nyquist_printf("add_s2_nn_fetch: susp->susp.current %ld\n",
|
||||
susp->susp.current);
|
||||
*/
|
||||
int to_stop = susp->susp.log_stop_cnt - susp->susp.current;
|
||||
to_stop = susp->susp.log_stop_cnt - susp->susp.current;
|
||||
// to_stop can be less than zero if we've been adding in sounds with
|
||||
// t0 less than the time when the sound is added. E.g. if the user
|
||||
// wants a sequence of two sounds that start at 0, the second sound
|
||||
|
@ -636,7 +625,7 @@ D nyquist_printf("add[%p,%p] (s%d_nn) %p shared block %p zero_block %p\n",susp->
|
|||
snd_list->block_len = togo;
|
||||
|
||||
/* if other is terminated and sound_types match, collapse */
|
||||
/* NOTE: in order to collapse, we need s1 to be generating
|
||||
/* NOTE: in order to collapse, we need s2 to be generating
|
||||
* blocks and linking them onto a sound list. This is true
|
||||
* when the get_next fn is SND_get_next. (A counterexample is
|
||||
* SND_get_zeros, which returns zero blocks but does not link
|
||||
|
@ -650,9 +639,9 @@ D nyquist_printf("add[%p,%p] (s%d_nn) %p shared block %p zero_block %p\n",susp->
|
|||
susp->s2->get_next == SND_get_next &&
|
||||
susp->s2->logical_stop_cnt == UNKNOWN) {
|
||||
snd_list_type addend_list;
|
||||
D nyquist_printf("add[%p,%p]: collapsing! LSC %d\n",
|
||||
D nyquist_printf("add[%p,%p]: collapsing! LSC %d\n",
|
||||
susp->s2, susp->s1, (int)susp->s2->logical_stop_cnt);
|
||||
D sound_print_tree(susp->s2);
|
||||
D sound_print_tree(susp->s2);
|
||||
/* will "current" values match? */
|
||||
/* test for logical stop */
|
||||
if (susp->logically_stopped) {
|
||||
|
@ -667,6 +656,9 @@ D sound_print_tree(susp->s2);
|
|||
snd_list_unref(snd_list->u.next);
|
||||
snd_list->u.next = addend_list;
|
||||
return;
|
||||
} else {
|
||||
D nyquist_printf("s1 == NULL, but no collapse, lsc %ld\n",
|
||||
susp->s2->logical_stop_cnt);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
@ -746,10 +738,9 @@ D stdputstr("add_s_nn_fetch: susp->logically_stopped\n");
|
|||
|
||||
|
||||
|
||||
void add_zero_fill_nn_fetch(susp, snd_list)
|
||||
register add_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void add_zero_fill_nn_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
add_susp_type susp = (add_susp_type) a_susp;
|
||||
int togo, s_start=0;
|
||||
|
||||
#ifdef GC_DEBUG
|
||||
|
@ -790,16 +781,18 @@ D stdputstr("add_zero_fill_nn_fetch: add_s2_nn_fetch installed\n");
|
|||
} /* add_zero_fill_nn_fetch */
|
||||
|
||||
|
||||
void add_free(add_susp_type susp)
|
||||
void add_free(snd_susp_type a_susp)
|
||||
{
|
||||
add_susp_type susp = (add_susp_type) a_susp;
|
||||
sound_unref(susp->s1);
|
||||
sound_unref(susp->s2);
|
||||
ffree_generic(susp, sizeof(add_susp_node), "add_free");
|
||||
}
|
||||
|
||||
|
||||
void add_mark(add_susp_type susp)
|
||||
void add_mark(snd_susp_type a_susp)
|
||||
{
|
||||
add_susp_type susp = (add_susp_type) a_susp;
|
||||
/* nyquist_printf("add_mark(%p)\n", susp);*/
|
||||
/* nyquist_printf("marking s1@%p in add@%p\n", susp->s1, susp);*/
|
||||
sound_xlmark(susp->s1);
|
||||
|
@ -809,8 +802,9 @@ void add_mark(add_susp_type susp)
|
|||
}
|
||||
|
||||
|
||||
void add_print_tree(add_susp_type susp, int n)
|
||||
void add_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
add_susp_type susp = (add_susp_type) a_susp;
|
||||
indent(n);
|
||||
nyquist_printf("logically_stopped %d logical_stop_bits %d terminate_bits %d\n",
|
||||
susp->logically_stopped, susp->logical_stop_bits, susp->terminate_bits);
|
||||
|
@ -826,9 +820,7 @@ void add_print_tree(add_susp_type susp, int n)
|
|||
}
|
||||
|
||||
|
||||
sound_type snd_make_add(s1, s2)
|
||||
sound_type s1;
|
||||
sound_type s2;
|
||||
sound_type snd_make_add(sound_type s1, sound_type s2)
|
||||
{
|
||||
register add_susp_type susp;
|
||||
rate_type sr = MAX(s1->sr, s2->sr);
|
||||
|
@ -906,13 +898,10 @@ D stdputstr("snd_make_add: add_s1_s2_nn_fetch installed\n");
|
|||
}
|
||||
|
||||
|
||||
sound_type snd_add(s1, s2, t0)
|
||||
sound_type s1;
|
||||
sound_type s2;
|
||||
time_type t0;
|
||||
sound_type snd_add(sound_type s1, sound_type s2)
|
||||
{
|
||||
sound_type s1_copy = sound_copy(s1);
|
||||
sound_type s2_copy = sound_copy(s2);
|
||||
/* nyquist_printf("snd_add %p %p copied to %p %p\n", s1, s2, s1_copy, s2_copy); */
|
||||
return snd_make_add(s1_copy, s2_copy, t0);
|
||||
return snd_make_add(s1_copy, s2_copy);
|
||||
}
|
||||
|
|
|
@ -30,15 +30,15 @@ typedef struct add_susp_struct {
|
|||
long s1_prepend; /* offset to susp.current */
|
||||
} add_susp_node, *add_susp_type;
|
||||
|
||||
sound_type snd_make_add();
|
||||
sound_type snd_add();
|
||||
sound_type snd_make_add(sound_type s1, sound_type s2);
|
||||
sound_type snd_add(sound_type s1, sound_type s2);
|
||||
/* LISP: (SND-ADD SOUND SOUND) */
|
||||
|
||||
/* we export these for seq.c and multiseq.c */
|
||||
void add_zero_fill_nn_fetch(add_susp_type susp, snd_list_type snd_list);
|
||||
void add_s1_s2_nn_fetch(add_susp_type susp, snd_list_type snd_list);
|
||||
void add_s2_nn_fetch(add_susp_type susp, snd_list_type snd_list);
|
||||
void add_s1_nn_fetch(add_susp_type susp, snd_list_type snd_list);
|
||||
void add_mark(add_susp_type susp);
|
||||
void add_print_tree(add_susp_type susp, int n);
|
||||
void add_free(add_susp_type susp);
|
||||
void add_zero_fill_nn_fetch(snd_susp_type, snd_list_type);
|
||||
void add_s1_s2_nn_fetch(snd_susp_type, snd_list_type);
|
||||
void add_s1_nn_fetch(snd_susp_type, snd_list_type);
|
||||
void add_s2_nn_fetch(snd_susp_type, snd_list_type);
|
||||
void add_mark(snd_susp_type susp);
|
||||
void add_print_tree(snd_susp_type susp, int n);
|
||||
void add_free(snd_susp_type susp);
|
||||
|
|
|
@ -73,8 +73,9 @@ sample_type peak_block(avg_susp_type susp)
|
|||
}
|
||||
|
||||
|
||||
void avg_s_fetch(avg_susp_type susp, snd_list_type snd_list)
|
||||
void avg_s_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
avg_susp_type susp = (avg_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
int togo = 0;
|
||||
int n;
|
||||
|
@ -164,10 +165,9 @@ void avg_s_fetch(avg_susp_type susp, snd_list_type snd_list)
|
|||
} /* avg_s_fetch */
|
||||
|
||||
|
||||
void avg_toss_fetch(susp, snd_list)
|
||||
avg_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void avg_toss_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
avg_susp_type susp = (avg_susp_type) a_susp;
|
||||
long final_count = MIN(susp->susp.current + max_sample_block_len,
|
||||
susp->susp.toss_cnt);
|
||||
time_type final_time = susp->susp.t0 + final_count / susp->susp.sr;
|
||||
|
@ -193,22 +193,25 @@ void avg_toss_fetch(susp, snd_list)
|
|||
}
|
||||
|
||||
|
||||
void avg_mark(avg_susp_type susp)
|
||||
void avg_mark(snd_susp_type a_susp)
|
||||
{
|
||||
avg_susp_type susp = (avg_susp_type) a_susp;
|
||||
sound_xlmark(susp->s);
|
||||
}
|
||||
|
||||
|
||||
void avg_free(avg_susp_type susp)
|
||||
void avg_free(snd_susp_type a_susp)
|
||||
{
|
||||
avg_susp_type susp = (avg_susp_type) a_susp;
|
||||
sound_unref(susp->s);
|
||||
free(susp->buffer);
|
||||
ffree_generic(susp, sizeof(avg_susp_node), "avg_free");
|
||||
}
|
||||
|
||||
|
||||
void avg_print_tree(avg_susp_type susp, int n)
|
||||
void avg_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
avg_susp_type susp = (avg_susp_type) a_susp;
|
||||
indent(n);
|
||||
stdputstr("s:");
|
||||
sound_print_tree_1(susp->s, n);
|
||||
|
|
|
@ -36,8 +36,9 @@ typedef struct compose_susp_struct {
|
|||
|
||||
/* compose_fetch -- computes f(g(t)) */
|
||||
/**/
|
||||
void compose_fetch(register compose_susp_type susp, snd_list_type snd_list)
|
||||
void compose_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
compose_susp_type susp = (compose_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
int togo = 0;
|
||||
int n;
|
||||
|
@ -173,10 +174,9 @@ f_out_of_samples:
|
|||
} /* compose_fetch */
|
||||
|
||||
|
||||
void compose_toss_fetch(susp, snd_list)
|
||||
register compose_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void compose_toss_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
compose_susp_type susp = (compose_susp_type) a_susp;
|
||||
long final_count = MIN(susp->susp.current + max_sample_block_len,
|
||||
susp->susp.toss_cnt);
|
||||
time_type final_time = susp->susp.t0 + final_count / susp->susp.sr;
|
||||
|
@ -210,23 +210,26 @@ void compose_toss_fetch(susp, snd_list)
|
|||
}
|
||||
|
||||
|
||||
void compose_mark(compose_susp_type susp)
|
||||
void compose_mark(snd_susp_type a_susp)
|
||||
{
|
||||
compose_susp_type susp = (compose_susp_type) a_susp;
|
||||
sound_xlmark(susp->f);
|
||||
sound_xlmark(susp->g);
|
||||
}
|
||||
|
||||
|
||||
void compose_free(compose_susp_type susp)
|
||||
void compose_free(snd_susp_type a_susp)
|
||||
{
|
||||
compose_susp_type susp = (compose_susp_type) a_susp;
|
||||
sound_unref(susp->f);
|
||||
sound_unref(susp->g);
|
||||
ffree_generic(susp, sizeof(compose_susp_node), "compose_free");
|
||||
}
|
||||
|
||||
|
||||
void compose_print_tree(compose_susp_type susp, int n)
|
||||
void compose_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
compose_susp_type susp = (compose_susp_type) a_susp;
|
||||
indent(n);
|
||||
stdputstr("f:");
|
||||
sound_print_tree_1(susp->f, n);
|
||||
|
|
|
@ -6,6 +6,34 @@
|
|||
* of the first parameter.
|
||||
*/
|
||||
|
||||
/* Original convolve.c modified to do fast convolution. Here are some
|
||||
* notes:
|
||||
* The first arg is arbitrary length. The second arg is the impulse
|
||||
* response, which is converted into a table. Tables have limited maximum
|
||||
* size, which is good because we're going to use a single FFT for the
|
||||
* whole impulse response.
|
||||
*
|
||||
* The fast convolution works like this:
|
||||
* inputs are x_snd and h_snd.
|
||||
* Make h_snd into a table ht of size N, where N is a power of 2.
|
||||
* Copy ht with zero fill into H of size 2N.
|
||||
* Compute FFT of H in place.
|
||||
* Iterate:
|
||||
* Copy N samples of x_snd into X and zero fill to size 2N.
|
||||
* Compute FFT of X in place.
|
||||
* Multiply X by H (result goes into X).
|
||||
* Compute IFFT of X in place
|
||||
* Add X to R.
|
||||
* Now N samples of R can be output.
|
||||
* Copy 2nd half of R to first half and zero the 2nd half.
|
||||
* (this is actually done first, and the first time does
|
||||
* nothing because R is initially filled with zeros)
|
||||
*
|
||||
* Length of output is length of x input + length of h
|
||||
*/
|
||||
|
||||
#define _USE_MATH_DEFINES 1 /* for Visual C++ to get M_LN2 */
|
||||
#include <math.h>
|
||||
#include "stdio.h"
|
||||
#ifndef mips
|
||||
#include "stdlib.h"
|
||||
|
@ -15,6 +43,8 @@
|
|||
|
||||
#include "falloc.h"
|
||||
#include "cext.h"
|
||||
#include "fftlib.h"
|
||||
#include "fftext.h"
|
||||
#include "convolve.h"
|
||||
|
||||
void convolve_free();
|
||||
|
@ -28,13 +58,13 @@ typedef struct convolve_susp_struct {
|
|||
long x_snd_cnt;
|
||||
sample_block_values_type x_snd_ptr;
|
||||
|
||||
table_type table;
|
||||
sample_type *h_buf;
|
||||
double length_of_h;
|
||||
long h_len;
|
||||
long x_buf_len;
|
||||
sample_type *x_buffer_pointer;
|
||||
sample_type *x_buffer_current;
|
||||
sample_type *H; // the FFT of h_snd
|
||||
int h_len; // true length of H
|
||||
int N; // length of block, FFTs are of size 2*N
|
||||
int M; // log2 of 2*N, the FFT size
|
||||
sample_type *X;
|
||||
sample_type *R; // result buffer where output is summed
|
||||
sample_type *R_current;
|
||||
} convolve_susp_node, *convolve_susp_type;
|
||||
|
||||
|
||||
|
@ -52,8 +82,9 @@ void h_reverse(sample_type *h, long len)
|
|||
}
|
||||
|
||||
|
||||
void convolve_s_fetch(register convolve_susp_type susp, snd_list_type snd_list)
|
||||
void convolve_s_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
convolve_susp_type susp = (convolve_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
int togo;
|
||||
int n;
|
||||
|
@ -62,152 +93,118 @@ void convolve_s_fetch(register convolve_susp_type susp, snd_list_type snd_list)
|
|||
|
||||
register sample_block_values_type out_ptr_reg;
|
||||
|
||||
register sample_type * h_buf_reg;
|
||||
register long h_len_reg;
|
||||
register long x_buf_len_reg;
|
||||
register sample_type * x_buffer_pointer_reg;
|
||||
register sample_type * x_buffer_current_reg;
|
||||
register sample_type x_snd_scale_reg = susp->x_snd->scale;
|
||||
register sample_block_values_type x_snd_ptr_reg;
|
||||
sample_type *R = susp->R;
|
||||
sample_type *R_current;
|
||||
int N = susp->N;
|
||||
falloc_sample_block(out, "convolve_s_fetch");
|
||||
out_ptr = out->samples;
|
||||
snd_list->block = out;
|
||||
|
||||
while (cnt < max_sample_block_len) { /* outer loop */
|
||||
/* first compute how many samples to generate in inner loop: */
|
||||
/* don't overflow the output sample block: */
|
||||
togo = max_sample_block_len - cnt;
|
||||
|
||||
/* don't run past the x_snd input sample block: */
|
||||
/* based on susp_check_term_log_samples, but offset by h_len */
|
||||
|
||||
/* THIS IS EXPANDED BELOW
|
||||
* susp_check_term_log_samples(x_snd, x_snd_ptr, x_snd_cnt);
|
||||
*/
|
||||
if (susp->x_snd_cnt == 0) {
|
||||
susp_get_samples(x_snd, x_snd_ptr, x_snd_cnt);
|
||||
|
||||
/* THIS IS EXPANDED BELOW
|
||||
*logical_stop_test(x_snd, susp->x_snd_cnt);
|
||||
*/
|
||||
if (susp->x_snd->logical_stop_cnt ==
|
||||
susp->x_snd->current - susp->x_snd_cnt) {
|
||||
min_cnt(&susp->susp.log_stop_cnt, susp->x_snd,
|
||||
(snd_susp_type) susp, susp->x_snd_cnt);
|
||||
}
|
||||
|
||||
/* THIS IS EXPANDED BELOW
|
||||
* terminate_test(x_snd_ptr, x_snd, susp->x_snd_cnt);
|
||||
*/
|
||||
if (susp->x_snd_ptr == zero_block->samples) {
|
||||
/* ### modify this to terminate at an offset of (susp->h_len) */
|
||||
/* Note: in the min_cnt function, susp->x_snd_cnt is *subtracted*
|
||||
* from susp->x_snd->current to form the terminate time, so to
|
||||
* increase the time, we need to *subtract* susp->h_len, which
|
||||
* due to the double negative, *adds* susp->h_len to the ultimate
|
||||
* terminate time calculation.
|
||||
/* first compute how many samples to generate in inner loop: */
|
||||
/* don't overflow the output sample block: */
|
||||
togo = max_sample_block_len - cnt;
|
||||
/* if we need output samples, generate them here */
|
||||
if (susp->R_current >= R + N) {
|
||||
/* Copy N samples of x_snd into X and zero fill to size 2N */
|
||||
int i = 0;
|
||||
sample_type *X = susp->X;
|
||||
sample_type *H = susp->H;
|
||||
int to_copy;
|
||||
while (i < N) {
|
||||
if (susp->x_snd_cnt == 0) {
|
||||
susp_get_samples(x_snd, x_snd_ptr, x_snd_cnt);
|
||||
if (susp->x_snd->logical_stop_cnt ==
|
||||
susp->x_snd->current - susp->x_snd_cnt) {
|
||||
min_cnt(&susp->susp.log_stop_cnt, susp->x_snd,
|
||||
(snd_susp_type) susp, susp->x_snd_cnt);
|
||||
}
|
||||
}
|
||||
if (susp->x_snd_ptr == zero_block->samples) {
|
||||
min_cnt(&susp->terminate_cnt, susp->x_snd,
|
||||
(snd_susp_type) susp, susp->x_snd_cnt);
|
||||
/* extend the output to include impulse response */
|
||||
susp->terminate_cnt += susp->h_len;
|
||||
}
|
||||
/* copy no more than the remaining space and no more than
|
||||
* the amount remaining in the block
|
||||
*/
|
||||
min_cnt(&susp->terminate_cnt, susp->x_snd,
|
||||
(snd_susp_type) susp, susp->x_snd_cnt - susp->h_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
togo = min(togo, susp->x_snd_cnt);
|
||||
|
||||
/* don't run past terminate time */
|
||||
if (susp->terminate_cnt != UNKNOWN &&
|
||||
susp->terminate_cnt <= susp->susp.current + cnt + togo) {
|
||||
togo = susp->terminate_cnt - (susp->susp.current + cnt);
|
||||
if (togo == 0) break;
|
||||
}
|
||||
|
||||
|
||||
/* don't run past logical stop time */
|
||||
if (!susp->logically_stopped && susp->susp.log_stop_cnt != UNKNOWN) {
|
||||
int to_stop = susp->susp.log_stop_cnt - (susp->susp.current + cnt);
|
||||
/* break if to_stop == 0 (we're at the logical stop)
|
||||
* AND cnt > 0 (we're not at the beginning of the
|
||||
* output block).
|
||||
*/
|
||||
if (to_stop < togo) {
|
||||
if (to_stop == 0) {
|
||||
if (cnt) {
|
||||
togo = 0;
|
||||
break;
|
||||
} else /* keep togo as is: since cnt == 0, we
|
||||
* can set the logical stop flag on this
|
||||
* output block
|
||||
*/
|
||||
susp->logically_stopped = true;
|
||||
} else /* limit togo so we can start a new
|
||||
* block at the LST
|
||||
*/
|
||||
togo = to_stop;
|
||||
}
|
||||
}
|
||||
|
||||
n = togo;
|
||||
h_buf_reg = susp->h_buf;
|
||||
h_len_reg = susp->h_len;
|
||||
x_buf_len_reg = susp->x_buf_len;
|
||||
x_buffer_pointer_reg = susp->x_buffer_pointer;
|
||||
x_buffer_current_reg = susp->x_buffer_current;
|
||||
x_snd_ptr_reg = susp->x_snd_ptr;
|
||||
out_ptr_reg = out_ptr;
|
||||
if (n) do { /* the inner sample computation loop */
|
||||
long i; double sum;
|
||||
/* see if we've reached end of x_buffer */
|
||||
if ((x_buffer_pointer_reg + x_buf_len_reg) <= (x_buffer_current_reg + h_len_reg)) {
|
||||
/* shift x_buffer from current back to base */
|
||||
for (i = 1; i < h_len_reg; i++) {
|
||||
x_buffer_pointer_reg[i-1] = x_buffer_current_reg[i];
|
||||
}
|
||||
/* this will be incremented back to x_buffer_pointer_reg below */
|
||||
x_buffer_current_reg = x_buffer_pointer_reg - 1;
|
||||
to_copy = min(N - i, susp->x_snd_cnt);
|
||||
memcpy(X + i, susp->x_snd_ptr,
|
||||
to_copy * sizeof(*susp->x_snd_ptr));
|
||||
susp->x_snd_ptr += to_copy;
|
||||
susp->x_snd_cnt -= to_copy;
|
||||
i += to_copy;
|
||||
}
|
||||
|
||||
x_buffer_current_reg++;
|
||||
|
||||
x_buffer_current_reg[h_len_reg - 1] = (x_snd_scale_reg * *x_snd_ptr_reg++);
|
||||
|
||||
sum = 0.0;
|
||||
for (i = 0; i < h_len_reg; i++) {
|
||||
sum += x_buffer_current_reg[i] * h_buf_reg[i];
|
||||
/* zero fill to size 2N */
|
||||
memset(X + N, 0, N * sizeof(X[0]));
|
||||
/* Compute FFT of X in place */
|
||||
fftInit(susp->M);
|
||||
rffts(X, susp->M, 1);
|
||||
/* Multiply X by H (result goes into X) */
|
||||
rspectprod(X, H, X, N * 2);
|
||||
/* Compute IFFT of X in place */
|
||||
riffts(X, susp->M, 1);
|
||||
/* Shift R, zero fill, add X, all in one loop */
|
||||
for (i = 0; i < N; i++) {
|
||||
R[i] = R[i + N] + X[i];
|
||||
R[i + N] = X[i + N];
|
||||
}
|
||||
/* now N samples of R can be output */
|
||||
susp->R_current = R;
|
||||
}
|
||||
/* compute togo, the number of samples to "compute" */
|
||||
/* can't use more than what's left in R. R_current is
|
||||
the next sample of R, so what's left is N - (R - R_current) */
|
||||
R_current = susp->R_current;
|
||||
togo = min(togo, N - (R_current - R));
|
||||
|
||||
*out_ptr_reg++ = (sample_type) sum;
|
||||
} while (--n); /* inner loop */
|
||||
/* don't run past terminate time */
|
||||
if (susp->terminate_cnt != UNKNOWN &&
|
||||
susp->terminate_cnt <= susp->susp.current + cnt + togo) {
|
||||
togo = susp->terminate_cnt - (susp->susp.current + cnt);
|
||||
if (togo == 0) break;
|
||||
}
|
||||
|
||||
susp->x_buffer_pointer = x_buffer_pointer_reg;
|
||||
susp->x_buffer_current = x_buffer_current_reg;
|
||||
/* using x_snd_ptr_reg is a bad idea on RS/6000: */
|
||||
susp->x_snd_ptr += togo;
|
||||
out_ptr += togo;
|
||||
susp_took(x_snd_cnt, togo);
|
||||
cnt += togo;
|
||||
/* don't run past logical stop time */
|
||||
if (!susp->logically_stopped &&
|
||||
susp->susp.log_stop_cnt != UNKNOWN &&
|
||||
susp->susp.log_stop_cnt <= susp->susp.current + cnt + togo) {
|
||||
togo = susp->susp.log_stop_cnt - (susp->susp.current + cnt);
|
||||
if (togo == 0) break;
|
||||
}
|
||||
|
||||
n = togo;
|
||||
out_ptr_reg = out_ptr;
|
||||
if (n) do { /* the inner sample computation loop */
|
||||
*out_ptr_reg++ = (sample_type) *R_current++;
|
||||
} while (--n); /* inner loop */
|
||||
|
||||
/* using R_current is a bad idea on RS/6000: */
|
||||
susp->R_current += togo;
|
||||
out_ptr += togo;
|
||||
cnt += togo;
|
||||
} /* outer loop */
|
||||
|
||||
/* test for termination */
|
||||
if (togo == 0 && cnt == 0) {
|
||||
snd_list_terminate(snd_list);
|
||||
snd_list_terminate(snd_list);
|
||||
} else {
|
||||
snd_list->block_len = cnt;
|
||||
susp->susp.current += cnt;
|
||||
snd_list->block_len = cnt;
|
||||
susp->susp.current += cnt;
|
||||
}
|
||||
/* test for logical stop */
|
||||
if (susp->logically_stopped) {
|
||||
snd_list->logically_stopped = true;
|
||||
snd_list->logically_stopped = true;
|
||||
} else if (susp->susp.log_stop_cnt == susp->susp.current) {
|
||||
susp->logically_stopped = true;
|
||||
susp->logically_stopped = true;
|
||||
}
|
||||
} /* convolve_s_fetch */
|
||||
|
||||
|
||||
void convolve_toss_fetch(susp, snd_list)
|
||||
register convolve_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void convolve_toss_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
convolve_susp_type susp = (convolve_susp_type) susp;
|
||||
time_type final_time = susp->susp.t0;
|
||||
long n;
|
||||
|
||||
|
@ -218,36 +215,40 @@ void convolve_toss_fetch(susp, snd_list)
|
|||
/* convert to normal processing when we hit final_count */
|
||||
/* we want each signal positioned at final_time */
|
||||
n = round((final_time - susp->x_snd->t0) * susp->x_snd->sr -
|
||||
(susp->x_snd->current - susp->x_snd_cnt));
|
||||
(susp->x_snd->current - susp->x_snd_cnt));
|
||||
susp->x_snd_ptr += n;
|
||||
susp_took(x_snd_cnt, n);
|
||||
susp->susp.fetch = susp->susp.keep_fetch;
|
||||
(*(susp->susp.fetch))(susp, snd_list);
|
||||
(*(susp->susp.fetch))(a_susp, snd_list);
|
||||
}
|
||||
|
||||
|
||||
void convolve_mark(convolve_susp_type susp)
|
||||
void convolve_mark(snd_susp_type a_susp)
|
||||
{
|
||||
convolve_susp_type susp = (convolve_susp_type) a_susp;
|
||||
sound_xlmark(susp->x_snd);
|
||||
}
|
||||
|
||||
|
||||
void convolve_free(convolve_susp_type susp)
|
||||
void convolve_free(snd_susp_type a_susp)
|
||||
{
|
||||
table_unref(susp->table);
|
||||
free(susp->x_buffer_pointer); sound_unref(susp->x_snd);
|
||||
convolve_susp_type susp = (convolve_susp_type) a_susp;
|
||||
free(susp->R);
|
||||
free(susp->X);
|
||||
free(susp->H);
|
||||
sound_unref(susp->x_snd);
|
||||
ffree_generic(susp, sizeof(convolve_susp_node), "convolve_free");
|
||||
}
|
||||
|
||||
|
||||
void convolve_print_tree(convolve_susp_type susp, int n)
|
||||
void convolve_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
convolve_susp_type susp = (convolve_susp_type) a_susp;
|
||||
indent(n);
|
||||
stdputstr("x_snd:");
|
||||
sound_print_tree_1(susp->x_snd, n);
|
||||
}
|
||||
|
||||
|
||||
sound_type snd_make_convolve(sound_type x_snd, sound_type h_snd)
|
||||
{
|
||||
register convolve_susp_type susp;
|
||||
|
@ -255,16 +256,38 @@ sound_type snd_make_convolve(sound_type x_snd, sound_type h_snd)
|
|||
time_type t0 = x_snd->t0;
|
||||
sample_type scale_factor = 1.0F;
|
||||
time_type t0_min = t0;
|
||||
table_type table;
|
||||
double log_len;
|
||||
falloc_generic(susp, convolve_susp_node, "snd_make_convolve");
|
||||
susp->table = sound_to_table(h_snd);
|
||||
susp->h_buf = susp->table->samples;
|
||||
susp->length_of_h = susp->table->length;
|
||||
susp->h_len = (long) susp->length_of_h;
|
||||
h_reverse(susp->h_buf, susp->h_len);
|
||||
susp->x_buf_len = 2 * susp->h_len;
|
||||
susp->x_buffer_pointer = calloc((2 * (susp->h_len)), sizeof(float));
|
||||
susp->x_buffer_current = susp->x_buffer_pointer;
|
||||
susp->susp.fetch = convolve_s_fetch;
|
||||
table = sound_to_table(h_snd);
|
||||
susp->h_len = table->length;
|
||||
log_len = log(table->length) / M_LN2; /* compute log-base-2(length) */
|
||||
susp->M = (int) log_len;
|
||||
if (susp->M != log_len) susp->M++; /* round up */
|
||||
susp->N = 1 << susp->M; /* size of data blocks */
|
||||
susp->M++; /* M = log2(2 * N) */
|
||||
susp->H = (sample_type *) calloc(2 * susp->N, sizeof(susp->H[0]));
|
||||
if (!susp->H) {
|
||||
xlabort("memory allocation failure in convolve");
|
||||
}
|
||||
memcpy(susp->H, table->samples, sizeof(susp->H[0]) * susp->N);
|
||||
table_unref(table); /* don't need table now */
|
||||
/* remaining N samples are already zero-filled */
|
||||
if (fftInit(susp->M)) {
|
||||
free(susp->H);
|
||||
xlabort("fft initialization error in convolve");
|
||||
}
|
||||
rffts(susp->H, susp->M, 1);
|
||||
susp->X = (sample_type *) calloc(2 * susp->N, sizeof(susp->X[0]));
|
||||
susp->R = (sample_type *) calloc(2 * susp->N, sizeof(susp->R[0]));
|
||||
if (!susp->X || !susp->R) {
|
||||
free(susp->H);
|
||||
if (susp->X) free(susp->X);
|
||||
if (susp->R) free(susp->R);
|
||||
xlabort("memory allocation failed in convolve");
|
||||
}
|
||||
susp->R_current = susp->R + susp->N;
|
||||
susp->susp.fetch = &convolve_s_fetch;
|
||||
susp->terminate_cnt = UNKNOWN;
|
||||
/* handle unequal start times, if any */
|
||||
if (t0 < x_snd->t0) sound_prepend_zeros(x_snd, t0);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "cext.h"
|
||||
#include "downsample.h"
|
||||
|
||||
void down_free();
|
||||
void down_free(snd_susp_type a_susp);
|
||||
|
||||
|
||||
typedef struct down_susp_struct {
|
||||
|
@ -40,12 +40,11 @@ typedef struct down_susp_struct {
|
|||
} down_susp_node, *down_susp_type;
|
||||
|
||||
|
||||
void down_n_fetch(susp, snd_list)
|
||||
register down_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void down_n_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
down_susp_type susp = (down_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
int togo = 0;
|
||||
int togo;
|
||||
int n;
|
||||
sample_block_type out;
|
||||
register sample_block_values_type out_ptr;
|
||||
|
@ -76,7 +75,25 @@ void down_n_fetch(susp, snd_list)
|
|||
/* don't run past logical stop time */
|
||||
if (!susp->logically_stopped && susp->susp.log_stop_cnt != UNKNOWN) {
|
||||
int to_stop = susp->susp.log_stop_cnt - (susp->susp.current + cnt);
|
||||
if (to_stop < togo && ((togo = to_stop) == 0)) break;
|
||||
/* break if to_stop == 0 (we're at the logical stop)
|
||||
* AND cnt > 0 (we're not at the beginning of the
|
||||
* output block).
|
||||
*/
|
||||
if (to_stop < togo) {
|
||||
if (to_stop == 0) {
|
||||
if (cnt) {
|
||||
togo = 0;
|
||||
break;
|
||||
} else /* keep togo as is: since cnt == 0, we
|
||||
* can set the logical stop flag on this
|
||||
* output block
|
||||
*/
|
||||
susp->logically_stopped = true;
|
||||
} else /* limit togo so we can start a new
|
||||
* block at the LST
|
||||
*/
|
||||
togo = to_stop;
|
||||
}
|
||||
}
|
||||
|
||||
n = togo;
|
||||
|
@ -109,12 +126,11 @@ void down_n_fetch(susp, snd_list)
|
|||
} /* down_n_fetch */
|
||||
|
||||
|
||||
void down_s_fetch(susp, snd_list)
|
||||
register down_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void down_s_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
down_susp_type susp = (down_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
int togo = 0;
|
||||
int togo;
|
||||
int n;
|
||||
sample_block_type out;
|
||||
register sample_block_values_type out_ptr;
|
||||
|
@ -132,6 +148,10 @@ void down_s_fetch(susp, snd_list)
|
|||
/* don't overflow the output sample block: */
|
||||
togo = max_sample_block_len - cnt;
|
||||
|
||||
/* don't run past the s input sample block: */
|
||||
susp_check_term_log_samples(s, s_ptr, s_cnt);
|
||||
togo = min(togo, susp->s_cnt);
|
||||
|
||||
/* don't run past terminate time */
|
||||
if (susp->terminate_cnt != UNKNOWN &&
|
||||
susp->terminate_cnt <= susp->susp.current + cnt + togo) {
|
||||
|
@ -142,8 +162,26 @@ void down_s_fetch(susp, snd_list)
|
|||
/* don't run past logical stop time */
|
||||
if (!susp->logically_stopped && susp->susp.log_stop_cnt != UNKNOWN) {
|
||||
int to_stop = susp->susp.log_stop_cnt - (susp->susp.current + cnt);
|
||||
if (to_stop < togo && ((togo = to_stop) == 0)) break;
|
||||
}
|
||||
/* break if to_stop == 0 (we're at the logical stop)
|
||||
* AND cnt > 0 (we're not at the beginning of the
|
||||
* output block).
|
||||
*/
|
||||
if (to_stop < togo) {
|
||||
if (to_stop == 0) {
|
||||
if (cnt) {
|
||||
togo = 0;
|
||||
break;
|
||||
} else /* keep togo as is: since cnt == 0, we
|
||||
* can set the logical stop flag on this
|
||||
* output block
|
||||
*/
|
||||
susp->logically_stopped = true;
|
||||
} else /* limit togo so we can start a new
|
||||
* block at the LST
|
||||
*/
|
||||
togo = to_stop;
|
||||
}
|
||||
}
|
||||
|
||||
n = togo;
|
||||
s_ptr_reg = susp->s_ptr;
|
||||
|
@ -152,7 +190,8 @@ void down_s_fetch(susp, snd_list)
|
|||
*out_ptr_reg++ = (s_scale_reg * *s_ptr_reg++);
|
||||
} while (--n); /* inner loop */
|
||||
|
||||
susp->s_ptr = s_ptr_reg;
|
||||
/* using s_ptr_reg is a bad idea on RS/6000: */
|
||||
susp->s_ptr += togo;
|
||||
out_ptr += togo;
|
||||
cnt += togo;
|
||||
} /* outer loop */
|
||||
|
@ -173,23 +212,21 @@ void down_s_fetch(susp, snd_list)
|
|||
} /* down_s_fetch */
|
||||
|
||||
|
||||
void down_i_fetch(susp, snd_list)
|
||||
register down_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void down_i_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
down_susp_type susp = (down_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
sample_type s_x2_sample;
|
||||
int togo = 0;
|
||||
int togo;
|
||||
int n;
|
||||
sample_block_type out;
|
||||
register sample_block_values_type out_ptr;
|
||||
|
||||
register sample_block_values_type out_ptr_reg;
|
||||
|
||||
register sample_type s_pHaSe_iNcR_rEg = (sample_type) susp->s_pHaSe_iNcR;
|
||||
register double s_pHaSe_iNcR_rEg = susp->s_pHaSe_iNcR;
|
||||
register double s_pHaSe_ReG;
|
||||
register sample_type s_x1_sample_reg;
|
||||
|
||||
falloc_sample_block(out, "down_i_fetch");
|
||||
out_ptr = out->samples;
|
||||
snd_list->block = out;
|
||||
|
@ -222,11 +259,26 @@ void down_i_fetch(susp, snd_list)
|
|||
/* don't run past logical stop time */
|
||||
if (!susp->logically_stopped && susp->susp.log_stop_cnt != UNKNOWN) {
|
||||
int to_stop = susp->susp.log_stop_cnt - (susp->susp.current + cnt);
|
||||
if (to_stop < togo && ((togo = to_stop) <= 0)) {
|
||||
togo = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* break if to_stop == 0 (we're at the logical stop)
|
||||
* AND cnt > 0 (we're not at the beginning of the
|
||||
* output block).
|
||||
*/
|
||||
if (to_stop < togo) {
|
||||
if (to_stop == 0) {
|
||||
if (cnt) {
|
||||
togo = 0;
|
||||
break;
|
||||
} else /* keep togo as is: since cnt == 0, we
|
||||
* can set the logical stop flag on this
|
||||
* output block
|
||||
*/
|
||||
susp->logically_stopped = true;
|
||||
} else /* limit togo so we can start a new
|
||||
* block at the LST
|
||||
*/
|
||||
togo = to_stop;
|
||||
}
|
||||
}
|
||||
|
||||
n = togo;
|
||||
s_pHaSe_ReG = susp->s_pHaSe;
|
||||
|
@ -263,7 +315,7 @@ void down_i_fetch(susp, snd_list)
|
|||
s_x2_sample * s_pHaSe_ReG);
|
||||
s_pHaSe_ReG += s_pHaSe_iNcR_rEg;
|
||||
} while (--n); /* inner loop */
|
||||
breakout:
|
||||
breakout:
|
||||
togo -= n;
|
||||
susp->s_pHaSe = s_pHaSe_ReG;
|
||||
susp->s_x1_sample = s_x1_sample_reg;
|
||||
|
@ -287,10 +339,9 @@ breakout:
|
|||
} /* down_i_fetch */
|
||||
|
||||
|
||||
void down_toss_fetch(snd_list)
|
||||
snd_list_type snd_list;
|
||||
void down_toss_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
register down_susp_type susp = (down_susp_type) snd_list->u.susp;
|
||||
down_susp_type susp = (down_susp_type) a_susp;
|
||||
long final_count = MIN(susp->susp.current + max_sample_block_len,
|
||||
susp->susp.toss_cnt);
|
||||
time_type final_time = susp->susp.t0 + final_count / susp->susp.sr;
|
||||
|
@ -316,30 +367,31 @@ void down_toss_fetch(snd_list)
|
|||
}
|
||||
|
||||
|
||||
void down_mark(down_susp_type susp)
|
||||
void down_mark(snd_susp_type a_susp)
|
||||
{
|
||||
down_susp_type susp = (down_susp_type) a_susp;
|
||||
sound_xlmark(susp->s);
|
||||
}
|
||||
|
||||
|
||||
void down_free(down_susp_type susp)
|
||||
void down_free(snd_susp_type a_susp)
|
||||
{
|
||||
down_susp_type susp = (down_susp_type) a_susp;
|
||||
sound_unref(susp->s);
|
||||
ffree_generic(susp, sizeof(down_susp_node), "down_free");
|
||||
}
|
||||
|
||||
|
||||
void down_print_tree(down_susp_type susp, int n)
|
||||
void down_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
down_susp_type susp = (down_susp_type) a_susp;
|
||||
indent(n);
|
||||
stdputstr("s:");
|
||||
sound_print_tree_1(susp->s, n);
|
||||
}
|
||||
|
||||
|
||||
sound_type snd_make_down(sr, s)
|
||||
rate_type sr;
|
||||
sound_type s;
|
||||
sound_type snd_make_down(rate_type sr, sound_type s)
|
||||
{
|
||||
register down_susp_type susp;
|
||||
/* sr specified as input parameter */
|
||||
|
@ -365,13 +417,12 @@ sound_type snd_make_down(sr, s)
|
|||
/* handle unequal start times, if any */
|
||||
if (t0 < s->t0) sound_prepend_zeros(s, t0);
|
||||
/* minimum start time over all inputs: */
|
||||
t0_min = MIN(s->t0, t0);
|
||||
t0_min = min(s->t0, t0);
|
||||
/* how many samples to toss before t0: */
|
||||
susp->susp.toss_cnt = ROUND((t0 - t0_min) * sr);
|
||||
susp->susp.toss_cnt = (long) ((t0 - t0_min) * sr + 0.5);
|
||||
if (susp->susp.toss_cnt > 0) {
|
||||
susp->susp.keep_fetch = susp->susp.fetch;
|
||||
susp->susp.fetch = down_toss_fetch;
|
||||
t0 = t0_min;
|
||||
}
|
||||
|
||||
/* initialize susp state */
|
||||
|
@ -395,9 +446,7 @@ sound_type snd_make_down(sr, s)
|
|||
}
|
||||
|
||||
|
||||
sound_type snd_down(sr, s)
|
||||
rate_type sr;
|
||||
sound_type s;
|
||||
sound_type snd_down(rate_type sr, sound_type s)
|
||||
{
|
||||
sound_type s_copy = sound_copy(s);
|
||||
return snd_make_down(sr, s_copy);
|
||||
|
|
|
@ -93,11 +93,13 @@ LVAL snd_fft(sound_type s, long len, long step, LVAL winval)
|
|||
float *temp_fft;
|
||||
float *window;
|
||||
LVAL result;
|
||||
float *float_base;
|
||||
|
||||
if (len < 1) xlfail("len < 1");
|
||||
|
||||
if (!s->extra) { /* this is the first call, so fix up s */
|
||||
sound_type w = NULL;
|
||||
long bytes = sizeof(long) * OFFSET + sizeof(float) * 3 * len;
|
||||
if (winval) {
|
||||
if (soundp(winval)) {
|
||||
w = getsound(winval);
|
||||
|
@ -106,10 +108,9 @@ LVAL snd_fft(sound_type s, long len, long step, LVAL winval)
|
|||
}
|
||||
}
|
||||
/* note: any storage required by fft must be allocated here in a
|
||||
* contiguous block of memory who's size is given by the first long
|
||||
* contiguous block of memory whose size is given by the first long
|
||||
* in the block. Here, there are 4 more longs after the size, and
|
||||
* then room for 3*len floats (assumes that floats and longs take
|
||||
* equal space).
|
||||
* then room for 3*len floats
|
||||
*
|
||||
* The reason for 3*len floats is to provide space for:
|
||||
* the samples to be transformed (len)
|
||||
|
@ -122,12 +123,15 @@ LVAL snd_fft(sound_type s, long len, long step, LVAL winval)
|
|||
* structure (this could be added in sound.c, however, if it's
|
||||
* really necessary).
|
||||
*/
|
||||
s->extra = (long *) malloc(sizeof(long) * (3 * len + OFFSET));
|
||||
s->extra[0] = sizeof(long) * (3 * len + OFFSET);
|
||||
|
||||
s->extra = (long *) malloc(bytes);
|
||||
s->extra[0] = bytes;
|
||||
s->CNT = s->INDEX = s->FILLCNT = 0;
|
||||
s->TERMCNT = -1;
|
||||
maxlen = len;
|
||||
window = (float *) &(s->extra[OFFSET + 2 * len]);
|
||||
// float_base is where the floats start, after the longs
|
||||
float_base = (float *) &(s->extra[OFFSET]);
|
||||
window = float_base + 2 * len;
|
||||
/* fill the window from w */
|
||||
if (!w) {
|
||||
for (i = 0; i < len; i++) *window++ = 1.0F;
|
||||
|
@ -135,12 +139,14 @@ LVAL snd_fft(sound_type s, long len, long step, LVAL winval)
|
|||
n_samples_from_sound(w, len, window);
|
||||
}
|
||||
} else {
|
||||
maxlen = ((s->extra[0] / sizeof(long)) - OFFSET) / 3;
|
||||
maxlen = (s->extra[0] - sizeof(long) * OFFSET) / (sizeof(float) * 3);
|
||||
if (maxlen != len) xlfail("len changed from initial value");
|
||||
float_base = (float *) &(s->extra[OFFSET]);
|
||||
}
|
||||
samples = (float *) &(s->extra[OFFSET]);
|
||||
temp_fft = samples + len;
|
||||
window = temp_fft + len;
|
||||
samples = float_base;
|
||||
temp_fft = float_base + len;
|
||||
// this code computes window location
|
||||
window = float_base + 2 * len;
|
||||
/* step 1: refill buffer with samples */
|
||||
fillptr = s->FILLCNT;
|
||||
while (fillptr < maxlen) {
|
||||
|
@ -178,6 +184,9 @@ LVAL snd_fft(sound_type s, long len, long step, LVAL winval)
|
|||
}
|
||||
/* perform the fft: */
|
||||
m = round(log(len) / M_LN2); /* compute log-base-2(len) */
|
||||
if (1 << m != len) {
|
||||
xlfail("FFT len is not a power of two");
|
||||
}
|
||||
if (!fftInit(m)) rffts(temp_fft, m, 1);
|
||||
else xlfail("FFT initialization error");
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*/
|
||||
|
||||
/* fftw.h -- system-wide definitions */
|
||||
/* $Id: fftw.h,v 1.2 2009-03-05 16:34:00 llucius Exp $ */
|
||||
/* $Id: fftw.h,v 1.1.1.1 2004/11/10 16:07:38 rbd Exp $ */
|
||||
|
||||
#ifndef FFTW_H
|
||||
#define FFTW_H
|
||||
|
|
|
@ -34,8 +34,9 @@ typedef struct inverse_susp_struct {
|
|||
boolean started;
|
||||
} inverse_susp_node, *inverse_susp_type;
|
||||
|
||||
void inverse_fetch(register inverse_susp_type susp, snd_list_type snd_list)
|
||||
void inverse_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
inverse_susp_type susp = (inverse_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples read from s */
|
||||
int out_cnt = 0; /* how many samples output */
|
||||
int togo = 0; /* how many more to read from s in inner loop */
|
||||
|
@ -128,10 +129,9 @@ void inverse_fetch(register inverse_susp_type susp, snd_list_type snd_list)
|
|||
} /* inverse_fetch */
|
||||
|
||||
|
||||
void inverse_toss_fetch(susp, snd_list)
|
||||
register inverse_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void inverse_toss_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
inverse_susp_type susp = (inverse_susp_type) a_susp;
|
||||
long final_count = MIN(susp->susp.current + max_sample_block_len,
|
||||
susp->susp.toss_cnt);
|
||||
time_type final_time = susp->susp.t0 + final_count / susp->susp.sr;
|
||||
|
@ -157,21 +157,24 @@ void inverse_toss_fetch(susp, snd_list)
|
|||
}
|
||||
|
||||
|
||||
void inverse_mark(inverse_susp_type susp)
|
||||
void inverse_mark(snd_susp_type a_susp)
|
||||
{
|
||||
inverse_susp_type susp = (inverse_susp_type) a_susp;
|
||||
sound_xlmark(susp->s);
|
||||
}
|
||||
|
||||
|
||||
void inverse_free(inverse_susp_type susp)
|
||||
void inverse_free(snd_susp_type a_susp)
|
||||
{
|
||||
inverse_susp_type susp = (inverse_susp_type) a_susp;
|
||||
sound_unref(susp->s);
|
||||
ffree_generic(susp, sizeof(inverse_susp_node), "inverse_free");
|
||||
}
|
||||
|
||||
|
||||
void inverse_print_tree(inverse_susp_type susp, int n)
|
||||
void inverse_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
inverse_susp_type susp = (inverse_susp_type) a_susp;
|
||||
indent(n);
|
||||
stdputstr("s:");
|
||||
sound_print_tree_1(susp->s, n);
|
||||
|
|
|
@ -44,10 +44,9 @@
|
|||
* deallocated, because it can only be referenced through the
|
||||
* snd_list nodes to which there are backpointers.
|
||||
*/
|
||||
void multiread_fetch(susp, snd_list)
|
||||
register read_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void multiread_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
read_susp_type susp = (read_susp_type) a_susp;
|
||||
int i, j;
|
||||
int frames_read = 0; /* total frames read in this call to fetch */
|
||||
int n;
|
||||
|
@ -252,8 +251,9 @@ void multiread_fetch(susp, snd_list)
|
|||
} /* multiread__fetch */
|
||||
|
||||
|
||||
void multiread_free(read_susp_type susp)
|
||||
void multiread_free(snd_susp_type a_susp)
|
||||
{
|
||||
read_susp_type susp = (read_susp_type) a_susp;
|
||||
int j;
|
||||
boolean active = false;
|
||||
/* stdputstr("multiread_free: "); */
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
LVAL multiread_create(read_susp_type susp);
|
||||
void multiread_fetch(read_susp_type susp, snd_list_type snd_list);
|
||||
void multiread_free(read_susp_type susp);
|
||||
void multiread_fetch(snd_susp_type a_susp, snd_list_type snd_list);
|
||||
void multiread_free(snd_susp_type a_susp);
|
||||
|
|
|
@ -136,9 +136,9 @@ known", I mean somewhere in the block referenced by ->s1_ptr and ->s1_cnt.
|
|||
/* extern LVAL s_stdout; */
|
||||
|
||||
void multiseq_convert(multiseq_type ms);
|
||||
void multiseq_free(add_susp_type susp);
|
||||
void multiseq_free(snd_susp_type a_susp);
|
||||
sample_block_type multiseq_get_next(sound_type snd, long * cnt);
|
||||
void multiseq_print_tree(add_susp_type susp, int n);
|
||||
void multiseq_print_tree(snd_susp_type a_susp, int n);
|
||||
|
||||
|
||||
#define susp_cnt_time(ssp, ms, cnt) (ssp->susp.t0 - ms->t0 + (cnt)/ssp->s1->sr)
|
||||
|
@ -390,7 +390,7 @@ D nyquist_printf("susp %p using add_s1_s2_nn_fetch\n", susp);
|
|||
*/
|
||||
snd_list->u.next = snd_list_create(&(susp->susp));
|
||||
snd_list->block = internal_zero_block;
|
||||
(*(susp->susp.fetch))(susp, snd_list);
|
||||
(*(susp->susp.fetch))((snd_susp_type) susp, snd_list);
|
||||
}
|
||||
|
||||
/* now free the multiseq struct */
|
||||
|
@ -420,10 +420,9 @@ D nyquist_printf("susp %p using add_s1_s2_nn_fetch\n", susp);
|
|||
* must check the pointers and substitute internal_zero_block to
|
||||
* avoid premature termination.
|
||||
*/
|
||||
void multiseq_fetch(susp, snd_list)
|
||||
register add_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void multiseq_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
add_susp_type susp = (add_susp_type) a_susp;
|
||||
time_type block_end_time;
|
||||
|
||||
/* undo the preallocation of a snd_list_node */
|
||||
|
@ -483,8 +482,9 @@ D nyquist_printf("block_end_time of %p: %g\n", susp, block_end_time);
|
|||
|
||||
/* multiseq_mark -- mark routine for multiseq susps */
|
||||
/**/
|
||||
void multiseq_mark(add_susp_type susp)
|
||||
void multiseq_mark(snd_susp_type a_susp)
|
||||
{
|
||||
add_susp_type susp = (add_susp_type) a_susp;
|
||||
int i;
|
||||
multiseq_type ms = susp->multiseq;
|
||||
D nyquist_printf("multiseq_mark(%p)\n", susp);
|
||||
|
@ -607,8 +607,9 @@ D nyquist_printf("ms->t0 == %g\n", ms->t0);
|
|||
|
||||
/* note: snd_multiseq is a noop, just call snd_make_multiseq */
|
||||
|
||||
void multiseq_free(add_susp_type susp)
|
||||
void multiseq_free(snd_susp_type a_susp)
|
||||
{
|
||||
add_susp_type susp = (add_susp_type) a_susp;
|
||||
int i;
|
||||
multiseq_type ms = susp->multiseq;
|
||||
boolean dead = true;
|
||||
|
@ -642,8 +643,9 @@ D nyquist_printf("susp %p freed, ms@%p->chans[%d] = NULL\n",
|
|||
}
|
||||
|
||||
|
||||
void multiseq_print_tree(add_susp_type susp, int n)
|
||||
void multiseq_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
add_susp_type susp = (add_susp_type) a_susp;
|
||||
int i;
|
||||
|
||||
indent(n);
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
#include "xlisp.h"
|
||||
#include "sound.h" /* to get nosc_enabled */
|
||||
#include "lo/lo.h"
|
||||
#include "sliders.h"
|
||||
#include "nyq-osc-server.h"
|
||||
#include "sndsliders.h"
|
||||
|
||||
static lo_server the_server = NULL;
|
||||
static int lo_fd;
|
||||
|
@ -63,14 +64,16 @@ static int wii_orientation_handler(const char *path, const char *types,
|
|||
|
||||
int nosc_init()
|
||||
{
|
||||
the_server = lo_server_new("7770", error);
|
||||
/* add method that will match the path /slider, with two numbers, coerced
|
||||
* to int and float */
|
||||
lo_server_add_method(the_server, "/slider", "if", slider_handler, NULL);
|
||||
lo_server_add_method(the_server, "/wii/orientation", "ff",
|
||||
wii_orientation_handler, NULL);
|
||||
lo_fd = lo_server_get_socket_fd(the_server);
|
||||
nosc_enabled = true;
|
||||
if (!SAFE_NYQUIST) {
|
||||
the_server = lo_server_new("7770", error);
|
||||
/* add method that will match the path /slider, with two numbers, coerced
|
||||
* to int and float */
|
||||
lo_server_add_method(the_server, "/slider", "if", slider_handler, NULL);
|
||||
lo_server_add_method(the_server, "/wii/orientation", "ff",
|
||||
wii_orientation_handler, NULL);
|
||||
lo_fd = lo_server_get_socket_fd(the_server);
|
||||
nosc_enabled = true;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -81,6 +84,7 @@ int nosc_poll()
|
|||
struct timeval tv;
|
||||
int retval;
|
||||
|
||||
if (SAFE_NYQUIST) return 0;
|
||||
// loop, receiving all pending OSC messages
|
||||
while (true) {
|
||||
FD_ZERO(&rfds);
|
||||
|
@ -99,13 +103,16 @@ int nosc_poll()
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void nosc_finish()
|
||||
{
|
||||
lo_server_free(the_server);
|
||||
nosc_enabled = false;
|
||||
if (!SAFE_NYQUIST) {
|
||||
lo_server_free(the_server);
|
||||
nosc_enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
* nyq-osc-server.h
|
||||
* nyquist
|
||||
*
|
||||
* Created by Roger Dannenberg on 10/1/06.
|
||||
* Copyright 2006 __MyCompanyName__. All rights reserved.
|
||||
*
|
||||
* Created by Roger Dannenberg
|
||||
*/
|
||||
|
||||
int nosc_init();
|
||||
int nosc_poll();
|
||||
void nosc_finish();
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
/* phasevocoder.c -- this is a stub showing how you might hook a
|
||||
phase vocoder into Nyquist using pvshell
|
||||
*/
|
||||
|
||||
#include "stdio.h"
|
||||
#ifndef mips
|
||||
#include "stdlib.h"
|
||||
#endif
|
||||
#include "xlisp.h"
|
||||
#include "sound.h"
|
||||
|
||||
#include "falloc.h"
|
||||
#include "cext.h"
|
||||
#include "pvshell.h"
|
||||
|
||||
#include "phasevocoder.h"
|
||||
|
||||
/* use the state[] info for sample interpolation */
|
||||
#define X_VALUE state[0] /* a parameter value */
|
||||
#define F_COUNT state[1] /* counts samples of f */
|
||||
#define G_COUNT state[2] /* counts samples of g */
|
||||
#define G_PREV state[3] /* previous value from g */
|
||||
#define G_NEXT state[4] /* next (current?) value from g */
|
||||
/* invariant: G_NEXT is the G_COUNT'th sample of g */
|
||||
|
||||
/* pv_fetch -- this is an example, but it doesn't really do
|
||||
* phase vocoding. Instead, it will just multiply f, g, and x
|
||||
*
|
||||
* To make things a bit more interesting, we will assume g has
|
||||
* an arbitrary sample rate with respect to f, and will interpolate.
|
||||
*
|
||||
*/
|
||||
long pv_fetch(pvshell_type susp,
|
||||
sample_block_values_type out, long *n)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < *n; i++) {
|
||||
long new_flags;
|
||||
sample_type f;
|
||||
double g;
|
||||
/* NOTE: in DSP terms, this is poor code because of the
|
||||
* division operations -- it could be made faster
|
||||
*/
|
||||
/* To get a value from g, first compute the time */
|
||||
double f_time = susp->F_COUNT / susp->f->sr;
|
||||
/* Now compute g count that is past the time */
|
||||
double g_count = f_time * susp->g->sr;
|
||||
while (susp->G_COUNT < g_count) {
|
||||
PVSHELL_TEST_G(susp); /* prepare to get a sample */
|
||||
/* ignore flags from g -- we could, if we wanted,
|
||||
* terminate when either f or g terminated, etc.
|
||||
*/
|
||||
susp->G_PREV = susp->G_NEXT;
|
||||
susp->G_NEXT = PVSHELL_FETCH_G(susp);
|
||||
susp->G_COUNT++;
|
||||
}
|
||||
/* now interpolate to get the value of g at f_time */
|
||||
g = susp->G_PREV + (susp->G_NEXT - susp->G_PREV) *
|
||||
(g_count - (susp->G_COUNT - 1));
|
||||
new_flags = PVSHELL_TEST_F(susp);
|
||||
susp->flags |= new_flags;
|
||||
if (new_flags) break;
|
||||
f = PVSHELL_FETCH_F(susp);
|
||||
susp->F_COUNT++; /* count how many samples we have taken */
|
||||
|
||||
/* now we have f, g, x */
|
||||
*out++ = f * g * susp->X_VALUE;
|
||||
}
|
||||
/* i is the number of samples we acutally computed */
|
||||
*n = i;
|
||||
/* if we computed samples, we want to return them before
|
||||
* returning flags that say we're done or stopped
|
||||
*/
|
||||
return (i ? 0 : susp->flags);
|
||||
}
|
||||
|
||||
|
||||
sound_type snd_phasevocoder(sound_type f, sound_type g, double x)
|
||||
{
|
||||
/* we're using 5 doubles of state. The first is a parameter,
|
||||
* and the rest are initialized to zero except for state[2],
|
||||
* aka G_COUNT. This is the number of samples we have read
|
||||
* from G. Since we're interpolating we need a one-sample
|
||||
* lookahead, and initializing the count to -1 causes an
|
||||
* extra fetch and hence 1-sample lookahead. This state is copied
|
||||
* into the pvshell structure, so we don't need to allocate
|
||||
* a vector on the heap.
|
||||
*/
|
||||
double state[5] = {0, 0, -1, 0, 0};
|
||||
state[0] = x;
|
||||
/* If f and g do not start at the same time, we should really
|
||||
* should do something about it, but we'll just throw an error.
|
||||
* Be careful to allow small differences (within one sample).
|
||||
*/
|
||||
if (fabs(f->t0 - g->t0) * f->sr > 0.5) {
|
||||
xlfail("phasevocoder inputs must start at the same time");
|
||||
}
|
||||
/* output the same sample rate and start time as f */
|
||||
return snd_make_pvshell("snd_phasevocoder", f->sr, f->t0,
|
||||
&pv_fetch, f, g,
|
||||
state, sizeof(state) / sizeof(state[0]));
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
/* phasevocoder.h -- this is a stub showing how you might hook a
|
||||
phase vocoder into Nyquist using pvshell
|
||||
*/
|
||||
|
||||
sound_type snd_phasevocoder(sound_type f, sound_type g, double x);
|
||||
/* LISP: (snd-phasevocoder SOUND SOUND ANYNUM) */
|
|
@ -3,6 +3,7 @@
|
|||
#include "stdio.h"
|
||||
#include "string.h"
|
||||
#include "xlisp.h"
|
||||
#include "sound.h"
|
||||
|
||||
static FILE* probefile = NULL;
|
||||
static long line_num = 0;
|
||||
|
|
|
@ -0,0 +1,206 @@
|
|||
// pvshell.c -- This is a skeleton for a Nyquist primitive that
|
||||
// returns a sound. The sound is obtained by calling a function
|
||||
// with a request consisting of a location to put samples and
|
||||
// a count of how many samples are needed. The function returns
|
||||
// the actual number of samples computed and flags indicating
|
||||
// if the signal has reached the logical stop or termination.
|
||||
// In addition, there are interfaces for extracting samples
|
||||
// from input sounds.
|
||||
// This code is designed for a time-stretching phase vocoder,
|
||||
// but could be used for other purposes. It is derived from
|
||||
// compose.c, which might have been implmented with this
|
||||
// skeleton had we started out with this abstraction.
|
||||
|
||||
#include "stdio.h"
|
||||
#ifndef mips
|
||||
#include "stdlib.h"
|
||||
#endif
|
||||
#include "xlisp.h"
|
||||
#include "sound.h"
|
||||
|
||||
#include "falloc.h"
|
||||
#include "cext.h"
|
||||
#include "pvshell.h"
|
||||
#include "assert.h"
|
||||
|
||||
/* CHANGE LOG
|
||||
* --------------------------------------------------------------------
|
||||
* 28Apr03 dm changes for portability and fix compiler warnings
|
||||
*/
|
||||
|
||||
void pvshell_free();
|
||||
|
||||
|
||||
typedef struct pvshell_susp_struct {
|
||||
snd_susp_node susp;
|
||||
long terminate_cnt;
|
||||
boolean logically_stopped;
|
||||
boolean started;
|
||||
|
||||
pvshell_node pvshell;
|
||||
} pvshell_susp_node, *pvshell_susp_type;
|
||||
|
||||
|
||||
/* pvshell_test_f -- get next sample block and check flags
|
||||
*
|
||||
* Only call this from PVSHELL_TEST_F macro
|
||||
*/
|
||||
long pvshell_test_f(pvshell_type susp)
|
||||
{
|
||||
long flags = 0;
|
||||
susp_get_samples(f, f_ptr, f_cnt); /* warning: macro references susp */
|
||||
if (susp->f->logical_stop_cnt == susp->f->current - susp->f_cnt) {
|
||||
flags |= PVSHELL_FLAG_LOGICAL_STOP;
|
||||
}
|
||||
if (susp->f_ptr == zero_block->samples) {
|
||||
flags |= PVSHELL_FLAG_TERMINATE;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
/* pvshell_test_g -- get next sample block and check flags
|
||||
*
|
||||
* Only call this from PVSHELL_TEST_G macro
|
||||
*/
|
||||
long pvshell_test_g(pvshell_type susp)
|
||||
{
|
||||
long flags = 0;
|
||||
susp_get_samples(g, g_ptr, g_cnt); /* warning: macro references susp */
|
||||
if (susp->g->logical_stop_cnt == susp->g->current - susp->g_cnt) {
|
||||
flags |= PVSHELL_FLAG_LOGICAL_STOP;
|
||||
}
|
||||
if (susp->g_ptr == zero_block->samples) {
|
||||
flags |= PVSHELL_FLAG_TERMINATE;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
/* pvshell_fetch -- computes h(f, g, x, y) where f and g are
|
||||
* sounds, x and y are doubles, and h implemented via a function
|
||||
* pointer. This could certainly be generalized further, but
|
||||
* maybe we should take this one step at a time.
|
||||
*/
|
||||
void pvshell_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
pvshell_susp_type susp = (pvshell_susp_type) a_susp;
|
||||
long n, flags;
|
||||
sample_block_type out;
|
||||
sample_block_values_type out_ptr;
|
||||
|
||||
falloc_sample_block(out, "pvshell_fetch");
|
||||
out_ptr = out->samples;
|
||||
snd_list->block = out;
|
||||
|
||||
/* don't run past the f input sample block: */
|
||||
/* most fetch routines call susp_check_term_log_samples() here
|
||||
* but we can't becasue susp_check_term_log_samples() assumes
|
||||
* that output time progresses at the same rate as input time.
|
||||
* Here, some time warping might be going on, so this doesn't work.
|
||||
* It is up to the user to tell us when it is the logical stop
|
||||
* time and the terminate time.
|
||||
*/
|
||||
/* don't run past terminate time */
|
||||
// if (susp->terminate_cnt != UNKNOWN &&
|
||||
// susp->terminate_cnt <= susp->susp.current + cnt + togo) {
|
||||
// togo = susp->terminate_cnt - (susp->susp.current + cnt);
|
||||
// if (togo == 0) break;
|
||||
// }
|
||||
/* don't run past logical stop time */
|
||||
// if (!susp->logically_stopped && susp->susp.log_stop_cnt != UNKNOWN) {
|
||||
// int to_stop = susp->susp.log_stop_cnt - (susp->susp.current + cnt);
|
||||
// if (to_stop < togo && ((togo = to_stop) == 0)) break;
|
||||
// }
|
||||
n = max_sample_block_len; // ideally, compute a whole block of samples
|
||||
|
||||
flags = (susp->pvshell.h)(&(susp->pvshell), out_ptr, &n);
|
||||
|
||||
/* test for termination */
|
||||
if (flags & PVSHELL_FLAG_TERMINATE) {
|
||||
snd_list_terminate(snd_list);
|
||||
} else {
|
||||
snd_list->block_len = n;
|
||||
susp->susp.current += n;
|
||||
}
|
||||
/* test for logical stop */
|
||||
if (flags & PVSHELL_FLAG_LOGICAL_STOP || susp->logically_stopped) {
|
||||
snd_list->logically_stopped = true;
|
||||
susp->logically_stopped = true;
|
||||
}
|
||||
} /* pvshell_fetch */
|
||||
|
||||
|
||||
void pvshell_mark(snd_susp_type a_susp)
|
||||
{
|
||||
pvshell_susp_type susp = (pvshell_susp_type) a_susp;
|
||||
sound_xlmark(susp->pvshell.f);
|
||||
sound_xlmark(susp->pvshell.g);
|
||||
}
|
||||
|
||||
|
||||
void pvshell_free(snd_susp_type a_susp)
|
||||
{
|
||||
pvshell_susp_type susp = (pvshell_susp_type) a_susp;
|
||||
/* note that f or g can be NULL */
|
||||
sound_unref(susp->pvshell.f);
|
||||
sound_unref(susp->pvshell.g);
|
||||
ffree_generic(susp, sizeof(pvshell_susp_node), "pvshell_free");
|
||||
}
|
||||
|
||||
|
||||
void pvshell_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
pvshell_susp_type susp = (pvshell_susp_type) a_susp;
|
||||
indent(n);
|
||||
stdputstr("f:");
|
||||
sound_print_tree_1(susp->pvshell.f, n);
|
||||
|
||||
indent(n);
|
||||
stdputstr("g:");
|
||||
sound_print_tree_1(susp->pvshell.g, n);
|
||||
}
|
||||
|
||||
|
||||
sound_type snd_make_pvshell(char *name, rate_type sr, time_type t0,
|
||||
h_fn_type h, sound_type f, sound_type g,
|
||||
double *state, long n)
|
||||
{
|
||||
register pvshell_susp_type susp;
|
||||
int i;
|
||||
|
||||
falloc_generic(susp, pvshell_susp_node, "snd_make_pvshell");
|
||||
susp->susp.fetch = pvshell_fetch;
|
||||
susp->terminate_cnt = UNKNOWN;
|
||||
|
||||
/* initialize susp state */
|
||||
susp->susp.free = pvshell_free;
|
||||
susp->susp.sr = sr;
|
||||
susp->susp.t0 = t0;
|
||||
susp->susp.mark = pvshell_mark;
|
||||
susp->susp.print_tree = pvshell_print_tree;
|
||||
susp->susp.name = name;
|
||||
susp->logically_stopped = false;
|
||||
susp->susp.log_stop_cnt = UNKNOWN;
|
||||
susp->susp.current = 0;
|
||||
|
||||
/* copy the sound so that we have a private "reader" object */
|
||||
susp->pvshell.f = (f ? sound_copy(f) : f);
|
||||
susp->pvshell.f_cnt = 0;
|
||||
|
||||
susp->pvshell.g = (g ? sound_copy(g) : g);
|
||||
susp->pvshell.g_cnt = 0;
|
||||
|
||||
susp->pvshell.h = h;
|
||||
|
||||
susp->pvshell.flags = 0; /* terminated and logically stopped flags -- these
|
||||
are for the client of pvshell to use */
|
||||
|
||||
assert(n <= PVSHELL_STATE_MAX);
|
||||
for (i = 0; i < n; i++) {
|
||||
susp->pvshell.state[i] = state[i];
|
||||
}
|
||||
|
||||
susp->started = false;
|
||||
return sound_create((snd_susp_type)susp, t0, sr, 1.0);
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
/* pvshell.h -- a generic Nyquist primitive, esp. for phase vocoder */
|
||||
|
||||
/* how many doubles to provide for miscellaneous state info */
|
||||
#define PVSHELL_STATE_MAX 8
|
||||
|
||||
/* define some bits to return conditions */
|
||||
#define PVSHELL_FLAG_TERMINATE 4
|
||||
#define PVSHELL_FLAG_LOGICAL_STOP 8
|
||||
|
||||
/* this function is called to compute samples. It should compute n
|
||||
* samples (floats == sample_type) and store them at out[i].
|
||||
* You can return less than n samples by writing the actual number
|
||||
* of samples computed into *n. Normally, you return zero.
|
||||
* To indicate that the time of the FIRST sample is the logical stop
|
||||
* time, return PVSHELL_FLAG_LOGICAL_STOP. (If the logical stop time
|
||||
* is not at the first sample, but instead at sample j, then just
|
||||
* return j samples (from 0 to j-1), save the rest of the samples,
|
||||
* and the next time, the first sample will correspond to the logical
|
||||
* stop time, so you can return PVSHELL_FLAG_LOGICAL_STOP.
|
||||
* To indicate that the sound has terminated, return
|
||||
* PVSHELL_FLAG_TERMINATE. This should be the only time you return
|
||||
* zero samples. (As with logical stop time, if you have samples to
|
||||
* return before termination, then do it, and return
|
||||
* PVSHELL_FLAG_TERMINATE the next time you are called, at which
|
||||
* point you've returned all the samples, so you can set *n = 0.
|
||||
*/
|
||||
struct pvshell_struct;
|
||||
|
||||
typedef long (*h_fn_type)(struct pvshell_struct *susp,
|
||||
sample_block_values_type out, long *n);
|
||||
|
||||
typedef struct pvshell_struct {
|
||||
sound_type f;
|
||||
long f_cnt;
|
||||
sample_block_values_type f_ptr;
|
||||
|
||||
sound_type g;
|
||||
long g_cnt;
|
||||
sample_block_values_type g_ptr;
|
||||
|
||||
long flags; /* for terminated and logically stopped flags */
|
||||
|
||||
// state is extra storage for whatever you like
|
||||
double state[PVSHELL_STATE_MAX];
|
||||
|
||||
// h is a function that computes sound from f, g, x, y, state
|
||||
h_fn_type h;
|
||||
} pvshell_node, *pvshell_type;
|
||||
|
||||
|
||||
/* to get samples from f or g, use these macros. For each sample, call
|
||||
* PVSHELL_TEST_X to get logical stop and terminate flags (but do not
|
||||
* fetch a sample). Then, if you want, call PVSHELL_FETCH_X to get the
|
||||
* next sample. You can call PVSHELL_TEST_X multiple times before
|
||||
* calling PVSHELL_FETCH_X, e.g. you can return exit a loop when you
|
||||
* see a logical stop flag and later call PVSHELL_TEST_X again. You
|
||||
* CANNOT call PVSHELL_FETCH_X multiples times without an intervening
|
||||
* call to PVSHELL_TEST_X. Finally, the logical stop flag is only
|
||||
* returned once. Normally you should write something like:
|
||||
* new_flags = PVSHELL_TEST_F(susp);
|
||||
* susp->flags | = new_flags; // remember flags
|
||||
* if (new_flags) break;
|
||||
* in the sample loop so that you will break when you see logical_stop.
|
||||
* Outside the loop, you can return (*n ? 0 : susp->flags) which will
|
||||
* return 0 if you computed samples before the logical stop was detected.
|
||||
* Then the next time you are called, you will return the logical_stop
|
||||
* flag because you saved it in susp->flags, and the flag applies to the
|
||||
* *beginning* of the sample block. This code handles terminate too.
|
||||
*/
|
||||
long pvshell_test_f(pvshell_type susp);
|
||||
long pvshell_test_g(pvshell_type susp);
|
||||
#define PVSHELL_TEST_F(susp) ((susp)->f_cnt == 0 ? pvshell_test_f(susp) : 0)
|
||||
#define PVSHELL_FETCH_F(susp) ((susp)->f_cnt--, (*(susp)->f_ptr++))
|
||||
|
||||
#define PVSHELL_TEST_G(susp) ((susp)->g_cnt == 0 ? pvshell_test_g(susp) : 0)
|
||||
#define PVSHELL_FETCH_G(susp) ((susp)->g_cnt--, (*(susp)->g_ptr++))
|
||||
|
||||
/* snd_make_pvshell -- create an instance of pvshell.
|
||||
name -- string name of the operation, for debugging & printing
|
||||
(name is not copied. It must be a permanent, immutable string.)
|
||||
sr -- sample rate of output sound
|
||||
t0 -- start time of output sound
|
||||
h -- function that computes samples of output
|
||||
f -- first input sound, e.g. sound to be time-stretched
|
||||
g -- second input sound, e.g. sound to control varying stretch factor
|
||||
state -- initial state information needed by h
|
||||
n -- number of doubles in state (< PVSHELL_STATE_MAX)
|
||||
*/
|
||||
sound_type snd_make_pvshell(char *name, rate_type sr, time_type t0,
|
||||
h_fn_type h, sound_type f, sound_type g,
|
||||
double *state, long n);
|
||||
|
|
@ -156,10 +156,10 @@ static int SrcUD(float X[], float Y[], double factor, double *Time,
|
|||
}
|
||||
|
||||
|
||||
void resample__fetch(register resample_susp_type susp, snd_list_type snd_list)
|
||||
void resample__fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
resample_susp_type susp = (resample_susp_type) a_susp;
|
||||
int togo;
|
||||
int n;
|
||||
int Nout;
|
||||
sample_block_type out;
|
||||
/* note that in this fetch routine, out_ptr is used to remember where
|
||||
|
@ -167,9 +167,6 @@ void resample__fetch(register resample_susp_type susp, snd_list_type snd_list)
|
|||
* loop that copies input samples into X, a buffer
|
||||
*/
|
||||
register sample_block_values_type out_ptr;
|
||||
register sample_block_values_type X_ptr_reg;
|
||||
|
||||
register sample_type *s_ptr_reg;
|
||||
falloc_sample_block(out, "resample__fetch");
|
||||
out_ptr = out->samples;
|
||||
snd_list->block = out;
|
||||
|
@ -268,22 +265,25 @@ samples need to be shifted from the end of X to the beginning.
|
|||
} /* resample__fetch */
|
||||
|
||||
|
||||
void resample_mark(resample_susp_type susp)
|
||||
void resample_mark(snd_susp_type a_susp)
|
||||
{
|
||||
resample_susp_type susp = (resample_susp_type) a_susp;
|
||||
sound_xlmark(susp->s);
|
||||
}
|
||||
|
||||
|
||||
void resample_free(resample_susp_type susp)
|
||||
void resample_free(snd_susp_type a_susp)
|
||||
{
|
||||
resample_susp_type susp = (resample_susp_type) a_susp;
|
||||
sound_unref(susp->s);
|
||||
free(susp->X);
|
||||
ffree_generic(susp, sizeof(resample_susp_node), "resample_free");
|
||||
}
|
||||
|
||||
|
||||
void resample_print_tree(resample_susp_type susp, int n)
|
||||
void resample_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
resample_susp_type susp = (resample_susp_type) a_susp;
|
||||
indent(n);
|
||||
stdputstr("s:");
|
||||
sound_print_tree_1(susp->s, n);
|
||||
|
|
|
@ -142,8 +142,9 @@ static float SrcUD(float X[], double dt, double Time,
|
|||
}
|
||||
|
||||
|
||||
void resamplev__fetch(register resamplev_susp_type susp, snd_list_type snd_list)
|
||||
void resamplev__fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
resamplev_susp_type susp = (resamplev_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
sample_block_type out;
|
||||
/* note that in this fetch routine, out_ptr is used to remember where
|
||||
|
@ -304,15 +305,17 @@ void resampv_refill(resamplev_susp_type susp) {
|
|||
|
||||
|
||||
|
||||
void resamplev_mark(resamplev_susp_type susp)
|
||||
void resamplev_mark(snd_susp_type a_susp)
|
||||
{
|
||||
resamplev_susp_type susp = (resamplev_susp_type) a_susp;
|
||||
sound_xlmark(susp->f);
|
||||
sound_xlmark(susp->g);
|
||||
}
|
||||
|
||||
|
||||
void resamplev_free(resamplev_susp_type susp)
|
||||
void resamplev_free(snd_susp_type a_susp)
|
||||
{
|
||||
resamplev_susp_type susp = (resamplev_susp_type) a_susp;
|
||||
sound_unref(susp->f);
|
||||
sound_unref(susp->g);
|
||||
free(susp->X);
|
||||
|
@ -320,8 +323,9 @@ void resamplev_free(resamplev_susp_type susp)
|
|||
}
|
||||
|
||||
|
||||
void resamplev_print_tree(resamplev_susp_type susp, int n)
|
||||
void resamplev_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
resamplev_susp_type susp = (resamplev_susp_type) a_susp;
|
||||
indent(n);
|
||||
nyquist_printf("f:");
|
||||
sound_print_tree_1(susp->f, n);
|
||||
|
|
|
@ -210,7 +210,10 @@ LVAL snd_fetch_array(sound_type s, long len, long step)
|
|||
long i, maxlen, skip, fillptr;
|
||||
float *samples;
|
||||
LVAL result;
|
||||
|
||||
LVAL rslt_symbol = xlenter("*RSLT*");
|
||||
|
||||
setvalue(rslt_symbol, NULL);
|
||||
|
||||
if (len < 1) xlfail("len < 1");
|
||||
|
||||
if (!s->extra) { /* this is the first call, so fix up s */
|
||||
|
@ -232,6 +235,7 @@ LVAL snd_fetch_array(sound_type s, long len, long step)
|
|||
if (s->INDEX == s->CNT) {
|
||||
sound_get_next(s, &(s->CNT));
|
||||
if (s->SAMPLES == zero_block->samples) {
|
||||
setvalue(rslt_symbol, cvfixnum(fillptr));
|
||||
if (s->TERMCNT < 0) s->TERMCNT = fillptr;
|
||||
}
|
||||
s->INDEX = 0;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
/* sliderdata.c -- shared data for slider abstraction in nyquist
|
||||
*
|
||||
* Roger B. Dannenberg
|
||||
* Jan 2013
|
||||
*/
|
||||
|
||||
#include "sliderdata.h"
|
||||
|
||||
float slider_array[SLIDERS_MAX];
|
||||
|
||||
void set_slider(int index, float value)
|
||||
{
|
||||
if (index >= 0 && index < SLIDERS_MAX) {
|
||||
slider_array[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
/* sliderdata.h -- shared data for slider abstraction in nyquist
|
||||
*
|
||||
* Roger B. Dannenberg
|
||||
* Jan 2013
|
||||
*/
|
||||
|
||||
/* define the shared data */
|
||||
#define SLIDERS_MAX 1024
|
||||
extern float slider_array[SLIDERS_MAX];
|
||||
|
||||
/* access from the GUI to shared data */
|
||||
void set_slider(int index, float value);
|
|
@ -1,11 +0,0 @@
|
|||
/* sliders.h -- support for graphical sliders in Nyquist IDE */
|
||||
|
||||
/* probably these 3 should be elsewhere */
|
||||
int nosc_init();
|
||||
int nosc_poll();
|
||||
void nosc_finish();
|
||||
|
||||
#define SLIDERS_MAX 1024
|
||||
extern float slider_array[SLIDERS_MAX];
|
||||
void set_slider(int index, float value);
|
||||
|
|
@ -54,7 +54,9 @@ error here
|
|||
/* LISP-SRC: (setf snd-head-CAF 19) */
|
||||
#define SND_HEAD_RAW 20
|
||||
/* LISP-SRC: (setf snd-head-raw 20) */
|
||||
#define SND_NUM_HEADS 21
|
||||
#define SND_HEAD_OGG 21
|
||||
/* LISP-SRC: (setf snd-head-OGG 21) */
|
||||
#define SND_NUM_HEADS 22
|
||||
|
||||
/* bitfields for soundheaders */
|
||||
#define SND_HEAD_CHANNELS (1<<0)
|
||||
|
@ -103,7 +105,9 @@ error here
|
|||
/* microsoft ADPCM */
|
||||
#define SND_MODE_MSADPCM 11
|
||||
/* LISP-SRC: (setf snd-mode-msadpcm 11) */
|
||||
#define SND_NUM_MODES 12
|
||||
#define SND_MODE_VORBIS 12
|
||||
/* LISP-SRC: (setf snd-mode-vorbis 11) */
|
||||
#define SND_NUM_MODES 13
|
||||
|
||||
|
||||
#define SND_LOOP_NONE 0
|
||||
|
|
|
@ -1,27 +1,54 @@
|
|||
nyqsrc/sndfnint sndfile.h nyqsrc/sndfmt.h nyqsrc/sound.h nyqsrc/add.h
|
||||
nyqsrc/avg.h nyqsrc/compose.h nyqsrc/convolve.h nyqsrc/downsample.h
|
||||
tran/fmfb.h tran/fmfbv.h
|
||||
nyqsrc/fft.h nyqsrc/inverse.h nyqsrc/multiseq.h nyqsrc/resamp.h
|
||||
nyqsrc/resampv.h nyqsrc/samples.h nyqsrc/sndmax.h nyqsrc/sndread.h
|
||||
nyqsrc/sndseq.h nyqsrc/sndsliders.h nyqsrc/sndwrite.h nyqsrc/yin.h
|
||||
nyqsrc/trigger.h nyqsrc/lpanal.h tran/abs.h
|
||||
tran/allpoles.h tran/alpass.h tran/alpasscv.h tran/alpassvv.h
|
||||
tran/amosc.h tran/areson.h tran/aresonvc.h tran/aresoncv.h
|
||||
tran/aresonvv.h tran/atone.h tran/atonev.h tran/biquadfilt.h
|
||||
tran/buzz.h tran/chase.h tran/clip.h tran/congen.h
|
||||
tran/const.h tran/coterm.h tran/delaycc.h tran/delaycv.h
|
||||
tran/eqbandvvv.h tran/exp.h tran/follow.h tran/fmosc.h
|
||||
tran/fromobject.h tran/fromarraystream.h tran/gate.h tran/ifft.h
|
||||
tran/instrclar.h tran/instrclarall.h tran/instrclarfreq.h tran/instrsax.h
|
||||
tran/instrsaxall.h tran/instrsaxfreq.h tran/integrate.h tran/log.h
|
||||
tran/lpreson.h tran/maxv.h tran/offset.h tran/oneshot.h
|
||||
tran/osc.h tran/partial.h tran/pluck.h tran/prod.h
|
||||
tran/pwl.h tran/quantize.h tran/recip.h tran/reson.h
|
||||
tran/resonvc.h tran/resoncv.h tran/resonvv.h tran/sampler.h
|
||||
tran/scale.h tran/shape.h tran/sine.h tran/siosc.h
|
||||
tran/slope.h tran/sqrt.h tran/tapf.h tran/tapv.h
|
||||
tran/tone.h tran/tonev.h tran/upsample.h tran/white.h
|
||||
tran/stkrev.h tran/stkpitshift.h tran/stkchorus.h tran/instrbow.h
|
||||
tran/instrbowedfreq.h tran/instrbanded.h tran/instrmandolin.h tran/instrsitar.h
|
||||
tran/instrmodalbar.h tran/instrflute.h tran/instrflutefreq.h tran/instrfluteall.h
|
||||
nyqsrc/sndfnint nylsf/sndfile.h nyqsrc/sndfmt.h
|
||||
nyqsrc/sound.h nyqsrc/add.h
|
||||
nyqsrc/avg.h nyqsrc/compose.h
|
||||
nyqsrc/convolve.h nyqsrc/downsample.h
|
||||
nyqsrc/fft.h nyqsrc/inverse.h
|
||||
nyqsrc/multiseq.h nyqsrc/resamp.h
|
||||
nyqsrc/resampv.h nyqsrc/samples.h
|
||||
nyqsrc/sndmax.h nyqsrc/sndread.h
|
||||
nyqsrc/sndseq.h nyqsrc/sndsliders.h
|
||||
nyqsrc/sndwrite.h nyqsrc/yin.h
|
||||
nyqsrc/nyq-osc-server.h nyqsrc/trigger.h
|
||||
nyqsrc/lpanal.h nyqsrc/phasevocoder.h
|
||||
nyqsrc/pvshell.h
|
||||
tran/abs.h tran/allpoles.h
|
||||
tran/alpass.h tran/alpasscv.h
|
||||
tran/alpassvv.h tran/amosc.h
|
||||
tran/areson.h tran/aresonvc.h
|
||||
tran/aresoncv.h tran/aresonvv.h
|
||||
tran/atone.h tran/atonev.h
|
||||
tran/biquadfilt.h tran/buzz.h
|
||||
tran/chase.h tran/clip.h
|
||||
tran/congen.h tran/const.h
|
||||
tran/coterm.h tran/delaycc.h
|
||||
tran/delaycv.h tran/eqbandvvv.h
|
||||
tran/exp.h tran/follow.h
|
||||
tran/fmosc.h tran/fromobject.h
|
||||
tran/fromarraystream.h tran/gate.h
|
||||
tran/ifft.h tran/instrclar.h
|
||||
tran/instrclarall.h tran/instrclarfreq.h
|
||||
tran/instrsax.h tran/instrsaxall.h
|
||||
tran/instrsaxfreq.h tran/integrate.h
|
||||
tran/log.h tran/lpreson.h
|
||||
tran/maxv.h tran/offset.h
|
||||
tran/oneshot.h tran/osc.h
|
||||
tran/partial.h tran/pluck.h
|
||||
tran/prod.h tran/pwl.h
|
||||
tran/quantize.h tran/recip.h
|
||||
tran/reson.h tran/resonvc.h
|
||||
tran/resoncv.h tran/resonvv.h
|
||||
tran/sampler.h tran/scale.h
|
||||
tran/shape.h tran/sine.h
|
||||
tran/siosc.h tran/slope.h
|
||||
tran/sqrt.h tran/tapf.h
|
||||
tran/tapv.h tran/tone.h
|
||||
tran/tonev.h tran/upsample.h
|
||||
tran/white.h tran/stkrev.h
|
||||
tran/stkpitshift.h tran/stkchorus.h
|
||||
tran/instrbow.h tran/instrbowedfreq.h
|
||||
tran/instrbanded.h tran/instrmandolin.h
|
||||
tran/instrsitar.h tran/instrmodalbar.h
|
||||
tran/instrflute.h tran/instrflutefreq.h
|
||||
tran/instrfluteall.h tran/fmfb.h
|
||||
tran/fmfbv.h
|
||||
|
||||
|
|
|
@ -1,26 +1,54 @@
|
|||
nyqsrc\sndfnint ~sndfile.h ~sndfmt.h nyqsrc\sound.h nyqsrc\add.h
|
||||
nyqsrc\avg.h nyqsrc\compose.h nyqsrc\convolve.h nyqsrc\downsample.h
|
||||
nyqsrc\fft.h nyqsrc\inverse.h nyqsrc\multiseq.h nyqsrc\resamp.h
|
||||
nyqsrc\resampv.h nyqsrc\samples.h nyqsrc\sndmax.h nyqsrc\sndread.h
|
||||
nyqsrc\sndseq.h nyqsrc\sndsliders.h nyqsrc\sndwrite.h nyqsrc\yin.h
|
||||
nyqsrc\trigger.h nyqsrc\lpanal.h ~nyqsrc\sndheader.h tran\abs.h
|
||||
tran\allpoles.h tran\alpass.h tran\alpasscv.h tran\alpassvv.h
|
||||
tran\amosc.h tran\areson.h tran\aresonvc.h tran\aresoncv.h
|
||||
tran\aresonvv.h tran\atone.h tran\atonev.h tran\biquad.h
|
||||
tran\buzz.h tran\chase.h tran\clip.h tran\congen.h
|
||||
tran\const.h tran\coterm.h tran\delaycc.h tran\delaycv.h
|
||||
tran\eqbandvvv.h tran\exp.h tran\follow.h tran\fmosc.h
|
||||
tran\fromobject.h tran\fromarraystream.h tran\gate.h tran\ifft.h
|
||||
tran\instrclar.h tran\instrclarall.h tran\instrclarfreq.h tran\instrsax.h
|
||||
tran\instrsaxall.h tran\instrsaxfreq.h tran\integrate.h tran\log.h
|
||||
tran\lpreson.h tran\maxv.h tran\offset.h tran\oneshot.h
|
||||
tran\osc.h tran\partial.h tran\pluck.h tran\prod.h
|
||||
tran\pwl.h tran\quantize.h tran\recip.h tran\reson.h
|
||||
tran\resonvc.h tran\resoncv.h tran\resonvv.h tran\sampler.h
|
||||
tran\scale.h tran\shape.h tran\sine.h tran\siosc.h
|
||||
tran\slope.h tran\sqrt.h tran\tapf.h tran\tapv.h
|
||||
tran\tone.h tran\tonev.h tran\upsample.h tran\white.h
|
||||
tran\stkrev.h tran\stkpitshift.h tran\stkchorus.h tran\instrbow.h
|
||||
tran\instrbowedfreq.h tran\instrbanded.h tran\instrmandolin.h tran\instrsitar.h
|
||||
tran\instrmodalbar.h tran\instrflute.h tran\instrflutefreq.h tran\instrfluteall.h
|
||||
nyqsrc\sndfnint snd\snd.h
|
||||
nyqsrc\sound.h nyqsrc\add.h
|
||||
nyqsrc\avg.h nyqsrc\compose.h
|
||||
nyqsrc\convolve.h nyqsrc\downsample.h
|
||||
nyqsrc\fft.h nyqsrc\inverse.h
|
||||
nyqsrc\multiseq.h nyqsrc\resamp.h
|
||||
nyqsrc\resampv.h nyqsrc\samples.h
|
||||
nyqsrc\sndmax.h nyqsrc\sndread.h
|
||||
nyqsrc\sndseq.h nyqsrc\sndsliders.h
|
||||
nyqsrc\sndwrite.h nyqsrc\yin.h
|
||||
nyqsrc\nyq-osc-server.h nyqsrc\trigger.h
|
||||
nyqsrc\lpanal.h nyqsrc\phasevocoder.h
|
||||
nyqsrc\pvshell.h ~nyqsrc\sndheader.h
|
||||
tran\abs.h tran\allpoles.h
|
||||
tran\alpass.h tran\alpasscv.h
|
||||
tran\alpassvv.h tran\amosc.h
|
||||
tran\areson.h tran\aresonvc.h
|
||||
tran\aresoncv.h tran\aresonvv.h
|
||||
tran\atone.h tran\atonev.h
|
||||
tran\biquadfilt.h tran\buzz.h
|
||||
tran\chase.h tran\clip.h
|
||||
tran\congen.h tran\const.h
|
||||
tran\coterm.h tran\delaycc.h
|
||||
tran\delaycv.h tran\eqbandvvv.h
|
||||
tran\exp.h tran\follow.h
|
||||
tran\fmosc.h tran\fromobject.h
|
||||
tran\fromarraystream.h tran\gate.h
|
||||
tran\ifft.h tran\instrclar.h
|
||||
tran\instrclarall.h tran\instrclarfreq.h
|
||||
tran\instrsax.h tran\instrsaxall.h
|
||||
tran\instrsaxfreq.h tran\integrate.h
|
||||
tran\log.h tran\lpreson.h
|
||||
tran\maxv.h tran\offset.h
|
||||
tran\oneshot.h tran\osc.h
|
||||
tran\partial.h tran\pluck.h
|
||||
tran\prod.h tran\pwl.h
|
||||
tran\quantize.h tran\recip.h
|
||||
tran\reson.h tran\resonvc.h
|
||||
tran\resoncv.h tran\resonvv.h
|
||||
tran\sampler.h tran\scale.h
|
||||
tran\shape.h tran\sine.h
|
||||
tran\siosc.h tran\slope.h
|
||||
tran\sqrt.h tran\tapf.h
|
||||
tran\tapv.h tran\tone.h
|
||||
tran\tonev.h tran\upsample.h
|
||||
tran\white.h tran\stkrev.h
|
||||
tran\stkpitshift.h tran\stkchorus.h
|
||||
tran\instrbow.h tran\instrbowedfreq.h
|
||||
tran\instrbanded.h tran\instrmandolin.h
|
||||
tran\instrsitar.h tran\instrmodalbar.h
|
||||
tran\instrflute.h tran\instrflutefreq.h
|
||||
tran\instrfluteall.h tran\fmfb.h
|
||||
tran\fmfbv.h
|
||||
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
* nyqsrc/downsample.h, nyqsrc/fft.h, nyqsrc/inverse.h,
|
||||
* nyqsrc/multiseq.h, nyqsrc/resamp.h, nyqsrc/resampv.h,
|
||||
* nyqsrc/samples.h, nyqsrc/sndmax.h, nyqsrc/sndread.h,
|
||||
* nyqsrc/sndseq.h, nyqsrc/sndsliders.h, nyqsrc/sndwrite.h,
|
||||
* nyqsrc/yin.h, nyqsrc/nyq-osc-server.h, nyqsrc/trigger.h,
|
||||
* nyqsrc/lpanal.h, tran/abs.h, tran/allpoles.h,
|
||||
* nyqsrc/sndseq.h, nyqsrc/sndsliders.h,
|
||||
* nyqsrc/sliderdata.h, nyqsrc/sndwritepa.h, nyqsrc/yin.h,
|
||||
* nyqsrc/nyq-osc-server.h, nyqsrc/trigger.h,
|
||||
* nyqsrc/lpanal.h, nyqsrc/phasevocoder.h,
|
||||
* nyqsrc/pvshell.h, tran/abs.h, tran/allpoles.h,
|
||||
* tran/alpass.h, tran/alpasscv.h, tran/alpassvv.h,
|
||||
* tran/amosc.h, tran/areson.h, tran/aresonvc.h,
|
||||
* tran/aresoncv.h, tran/aresonvv.h, tran/atone.h,
|
||||
|
@ -33,7 +35,8 @@
|
|||
* tran/instrbanded.h, tran/instrmandolin.h,
|
||||
* tran/instrsitar.h, tran/instrmodalbar.h,
|
||||
* tran/instrflute.h, tran/instrflutefreq.h,
|
||||
* tran/instrfluteall.h, tran/fmfb.h, tran/fmfbv.h */
|
||||
* tran/instrfluteall.h, tran/fmfb.h, tran/fmfbv.h,
|
||||
* nyqsrc/sndwrite.h */
|
||||
|
||||
#ifndef mips
|
||||
#include "stdlib.h"
|
||||
|
@ -698,63 +701,9 @@ LVAL xlc_snd_slider(void)
|
|||
}
|
||||
|
||||
|
||||
#include "sndwrite.h"
|
||||
|
||||
/* xlc_snd_save -- interface to C routine sound_save */
|
||||
/**/
|
||||
LVAL xlc_snd_save(void)
|
||||
{
|
||||
LVAL arg1 = xlgetarg();
|
||||
long arg2 = getfixnum(xlgafixnum());
|
||||
unsigned char * arg3 = getstring(xlgastring());
|
||||
long arg4 = getfixnum(xlgafixnum());
|
||||
long arg5 = getfixnum(xlgafixnum());
|
||||
long arg6 = getfixnum(xlgafixnum());
|
||||
long arg7 = getfixnum(xlgafixnum());
|
||||
double arg8 = 0.0;
|
||||
long arg9 = 0;
|
||||
double arg10 = 0.0;
|
||||
LVAL arg11 = xlgetarg();
|
||||
double result;
|
||||
|
||||
xllastarg();
|
||||
result = sound_save(arg1, arg2, arg3, arg4, arg5, arg6, arg7, &arg8, &arg9, &arg10, arg11);
|
||||
{ LVAL *next = &getvalue(RSLT_sym);
|
||||
*next = cons(NIL, NIL);
|
||||
car(*next) = cvflonum(arg8); next = &cdr(*next);
|
||||
*next = cons(NIL, NIL);
|
||||
car(*next) = cvfixnum(arg9); next = &cdr(*next);
|
||||
*next = cons(NIL, NIL);
|
||||
car(*next) = cvflonum(arg10);
|
||||
}
|
||||
return cvflonum(result);
|
||||
}
|
||||
|
||||
|
||||
/* xlc_snd_overwrite -- interface to C routine sound_overwrite */
|
||||
/**/
|
||||
LVAL xlc_snd_overwrite(void)
|
||||
{
|
||||
LVAL arg1 = xlgetarg();
|
||||
long arg2 = getfixnum(xlgafixnum());
|
||||
unsigned char * arg3 = getstring(xlgastring());
|
||||
double arg4 = testarg2(xlgaanynum());
|
||||
long arg5 = getfixnum(xlgafixnum());
|
||||
long arg6 = getfixnum(xlgafixnum());
|
||||
long arg7 = getfixnum(xlgafixnum());
|
||||
long arg8 = getfixnum(xlgafixnum());
|
||||
double arg9 = 0.0;
|
||||
double result;
|
||||
|
||||
xllastarg();
|
||||
result = sound_overwrite(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, &arg9);
|
||||
{ LVAL *next = &getvalue(RSLT_sym);
|
||||
*next = cons(NIL, NIL);
|
||||
car(*next) = cvflonum(arg9);
|
||||
}
|
||||
return cvflonum(result);
|
||||
}
|
||||
#include "sliderdata.h"
|
||||
|
||||
#include "sndwritepa.h"
|
||||
|
||||
#include "yin.h"
|
||||
|
||||
|
@ -808,6 +757,25 @@ LVAL xlc_snd_lpanal(void)
|
|||
}
|
||||
|
||||
|
||||
#include "phasevocoder.h"
|
||||
|
||||
/* xlc_snd_phasevocoder -- interface to C routine snd_phasevocoder */
|
||||
/**/
|
||||
LVAL xlc_snd_phasevocoder(void)
|
||||
{
|
||||
sound_type arg1 = getsound(xlgasound());
|
||||
sound_type arg2 = getsound(xlgasound());
|
||||
double arg3 = testarg2(xlgaanynum());
|
||||
sound_type result;
|
||||
|
||||
xllastarg();
|
||||
result = snd_phasevocoder(arg1, arg2, arg3);
|
||||
return cvsound(result);
|
||||
}
|
||||
|
||||
|
||||
#include "pvshell.h"
|
||||
|
||||
#include "abs.h"
|
||||
|
||||
/* xlc_snd_abs -- interface to C routine snd_abs */
|
||||
|
@ -1959,11 +1927,10 @@ LVAL xlc_snd_stkrev(void)
|
|||
sound_type arg2 = getsound(xlgasound());
|
||||
double arg3 = testarg2(xlgaanynum());
|
||||
double arg4 = testarg2(xlgaanynum());
|
||||
double arg5 = testarg2(xlgaanynum());
|
||||
sound_type result;
|
||||
|
||||
xllastarg();
|
||||
result = snd_stkrev(arg1, arg2, arg3, arg4, arg5);
|
||||
result = snd_stkrev(arg1, arg2, arg3, arg4);
|
||||
return cvsound(result);
|
||||
}
|
||||
|
||||
|
@ -1977,11 +1944,10 @@ LVAL xlc_snd_stkpitshift(void)
|
|||
sound_type arg1 = getsound(xlgasound());
|
||||
double arg2 = testarg2(xlgaanynum());
|
||||
double arg3 = testarg2(xlgaanynum());
|
||||
double arg4 = testarg2(xlgaanynum());
|
||||
sound_type result;
|
||||
|
||||
xllastarg();
|
||||
result = snd_stkpitshift(arg1, arg2, arg3, arg4);
|
||||
result = snd_stkpitshift(arg1, arg2, arg3);
|
||||
return cvsound(result);
|
||||
}
|
||||
|
||||
|
@ -1997,11 +1963,10 @@ LVAL xlc_snd_stkchorus(void)
|
|||
double arg3 = testarg2(xlgaanynum());
|
||||
double arg4 = testarg2(xlgaanynum());
|
||||
double arg5 = testarg2(xlgaanynum());
|
||||
double arg6 = testarg2(xlgaanynum());
|
||||
sound_type result;
|
||||
|
||||
xllastarg();
|
||||
result = snd_stkchorus(arg1, arg2, arg3, arg4, arg5, arg6);
|
||||
result = snd_stkchorus(arg1, arg2, arg3, arg4, arg5);
|
||||
return cvsound(result);
|
||||
}
|
||||
|
||||
|
@ -2210,3 +2175,61 @@ LVAL xlc_snd_fmfbv(void)
|
|||
}
|
||||
|
||||
|
||||
#include "sndwrite.h"
|
||||
|
||||
/* xlc_snd_save -- interface to C routine sound_save */
|
||||
/**/
|
||||
LVAL xlc_snd_save(void)
|
||||
{
|
||||
LVAL arg1 = xlgetarg();
|
||||
long arg2 = getfixnum(xlgafixnum());
|
||||
unsigned char * arg3 = getstring(xlgastring());
|
||||
long arg4 = getfixnum(xlgafixnum());
|
||||
long arg5 = getfixnum(xlgafixnum());
|
||||
long arg6 = getfixnum(xlgafixnum());
|
||||
long arg7 = getfixnum(xlgafixnum());
|
||||
double arg8 = 0.0;
|
||||
long arg9 = 0;
|
||||
double arg10 = 0.0;
|
||||
LVAL arg11 = xlgetarg();
|
||||
double result;
|
||||
|
||||
xllastarg();
|
||||
result = sound_save(arg1, arg2, arg3, arg4, arg5, arg6, arg7, &arg8, &arg9, &arg10, arg11);
|
||||
{ LVAL *next = &getvalue(RSLT_sym);
|
||||
*next = cons(NIL, NIL);
|
||||
car(*next) = cvflonum(arg8); next = &cdr(*next);
|
||||
*next = cons(NIL, NIL);
|
||||
car(*next) = cvfixnum(arg9); next = &cdr(*next);
|
||||
*next = cons(NIL, NIL);
|
||||
car(*next) = cvflonum(arg10);
|
||||
}
|
||||
return cvflonum(result);
|
||||
}
|
||||
|
||||
|
||||
/* xlc_snd_overwrite -- interface to C routine sound_overwrite */
|
||||
/**/
|
||||
LVAL xlc_snd_overwrite(void)
|
||||
{
|
||||
LVAL arg1 = xlgetarg();
|
||||
long arg2 = getfixnum(xlgafixnum());
|
||||
unsigned char * arg3 = getstring(xlgastring());
|
||||
double arg4 = testarg2(xlgaanynum());
|
||||
long arg5 = getfixnum(xlgafixnum());
|
||||
long arg6 = getfixnum(xlgafixnum());
|
||||
long arg7 = getfixnum(xlgafixnum());
|
||||
long arg8 = getfixnum(xlgafixnum());
|
||||
double arg9 = 0.0;
|
||||
double result;
|
||||
|
||||
xllastarg();
|
||||
result = sound_overwrite(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, &arg9);
|
||||
{ LVAL *next = &getvalue(RSLT_sym);
|
||||
*next = cons(NIL, NIL);
|
||||
car(*next) = cvflonum(arg9);
|
||||
}
|
||||
return cvflonum(result);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
|
||||
(setf snd-head-raw 20)
|
||||
|
||||
(setf snd-head-OGG 21)
|
||||
|
||||
(setf snd-head-channels 1)
|
||||
|
||||
(setf snd-head-mode 2)
|
||||
|
@ -78,6 +80,8 @@
|
|||
|
||||
(setf snd-mode-msadpcm 11)
|
||||
|
||||
(setf snd-mode-vorbis 11)
|
||||
|
||||
(SETF MAX-STOP-TIME 10E20)
|
||||
|
||||
(SETF MIN-START-TIME -10E20)
|
||||
|
|
|
@ -40,11 +40,10 @@ extern LVAL xlc_snd_max(void);
|
|||
extern LVAL xlc_snd_read(void);
|
||||
extern LVAL xlc_snd_seq(void);
|
||||
extern LVAL xlc_snd_slider(void);
|
||||
extern LVAL xlc_snd_save(void);
|
||||
extern LVAL xlc_snd_overwrite(void);
|
||||
extern LVAL xlc_snd_yin(void);
|
||||
extern LVAL xlc_snd_trigger(void);
|
||||
extern LVAL xlc_snd_lpanal(void);
|
||||
extern LVAL xlc_snd_phasevocoder(void);
|
||||
extern LVAL xlc_snd_abs(void);
|
||||
extern LVAL xlc_snd_allpoles(void);
|
||||
extern LVAL xlc_snd_alpass(void);
|
||||
|
@ -124,3 +123,5 @@ extern LVAL xlc_snd_flute_freq(void);
|
|||
extern LVAL xlc_snd_flute_all(void);
|
||||
extern LVAL xlc_snd_fmfb(void);
|
||||
extern LVAL xlc_snd_fmfbv(void);
|
||||
extern LVAL xlc_snd_save(void);
|
||||
extern LVAL xlc_snd_overwrite(void);
|
||||
|
|
|
@ -40,11 +40,10 @@
|
|||
{ "SND-READ", S, xlc_snd_read},
|
||||
{ "SND-SEQ", S, xlc_snd_seq},
|
||||
{ "SND-SLIDER", S, xlc_snd_slider},
|
||||
{ "SND-SAVE", S, xlc_snd_save},
|
||||
{ "SND-OVERWRITE", S, xlc_snd_overwrite},
|
||||
{ "SND-YIN", S, xlc_snd_yin},
|
||||
{ "SND-TRIGGER", S, xlc_snd_trigger},
|
||||
{ "SND-LPANAL", S, xlc_snd_lpanal},
|
||||
{ "SND-PHASEVOCODER", S, xlc_snd_phasevocoder},
|
||||
{ "SND-ABS", S, xlc_snd_abs},
|
||||
{ "SND-ALLPOLES", S, xlc_snd_allpoles},
|
||||
{ "SND-ALPASS", S, xlc_snd_alpass},
|
||||
|
@ -124,3 +123,5 @@
|
|||
{ "SND-FLUTE_ALL", S, xlc_snd_flute_all},
|
||||
{ "SND-FMFB", S, xlc_snd_fmfb},
|
||||
{ "SND-FMFBV", S, xlc_snd_fmfbv},
|
||||
{ "SND-SAVE", S, xlc_snd_save},
|
||||
{ "SND-OVERWRITE", S, xlc_snd_overwrite},
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
#include "io.h"
|
||||
#else
|
||||
#include <stat.h>
|
||||
#endif
|
||||
#endif /* WINDOWS */
|
||||
#define L_SET SEEK_SET
|
||||
#define L_INCR SEEK_CUR
|
||||
#define PROTECTION
|
||||
#endif
|
||||
#endif /* UNIX */
|
||||
#ifndef mips
|
||||
#include "stdlib.h"
|
||||
#endif
|
||||
|
@ -86,15 +86,16 @@ void read__fetch(susp, snd_list)
|
|||
} /* read__fetch */
|
||||
|
||||
|
||||
void read_free(read_susp_type susp)
|
||||
void read_free(snd_susp_type a_susp)
|
||||
{
|
||||
read_susp_type susp = (read_susp_type) a_susp;
|
||||
sf_close(susp->sndfile);
|
||||
sndread_file_open_count--;
|
||||
ffree_generic(susp, sizeof(read_susp_node), "read_free");
|
||||
}
|
||||
|
||||
|
||||
void read_print_tree(read_susp_type susp, int n)
|
||||
void read_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -169,12 +170,15 @@ LVAL snd_make_read(
|
|||
susp->sf_info.format |= format;
|
||||
}
|
||||
|
||||
susp->sndfile = sf_open((const char *) filename, SFM_READ,
|
||||
&(susp->sf_info));
|
||||
susp->sndfile = NULL;
|
||||
if (ok_to_open((const char *) filename, "rb"))
|
||||
susp->sndfile = sf_open((const char *) filename, SFM_READ,
|
||||
&(susp->sf_info));
|
||||
|
||||
if (!susp->sndfile) {
|
||||
char error[240];
|
||||
sprintf(error, "SND-READ: Cannot open file '%s'", filename);
|
||||
sprintf(error, "SND-READ: Cannot open file '%s' because of %s", filename,
|
||||
sf_strerror(susp->sndfile));
|
||||
xlfail(error);
|
||||
}
|
||||
if (susp->sf_info.channels < 1) {
|
||||
|
@ -239,6 +243,7 @@ LVAL snd_make_read(
|
|||
case SF_FORMAT_SD2: *format = SND_HEAD_SD2; break;
|
||||
case SF_FORMAT_FLAC: *format = SND_HEAD_FLAC; break;
|
||||
case SF_FORMAT_CAF: *format = SND_HEAD_CAF; break;
|
||||
case SF_FORMAT_OGG: *format = SND_HEAD_OGG; break;
|
||||
default: *format = SND_HEAD_NONE; break;
|
||||
}
|
||||
*channels = susp->sf_info.channels;
|
||||
|
|
|
@ -59,16 +59,15 @@ typedef struct sndseq_susp_struct {
|
|||
} sndseq_susp_node, *sndseq_susp_type;
|
||||
|
||||
|
||||
void sndseq_fetch(sndseq_susp_type, snd_list_type);
|
||||
void sndseq_fetch(snd_susp_type a_susp, snd_list_type snd_list);
|
||||
void sndseq_zero_fill_fetch(sndseq_susp_type, snd_list_type);
|
||||
void sndseq_free();
|
||||
void sndseq_free(snd_susp_type susp);
|
||||
|
||||
extern LVAL s_stdout;
|
||||
|
||||
void sndseq_mark(sndseq_susp_type susp)
|
||||
void sndseq_mark(snd_susp_type a_susp)
|
||||
{
|
||||
/* nyquist_printf("sndseq_mark(%x)\n", susp);*/
|
||||
/* nyquist_printf("marking s1@%x in sndseq@%x\n", susp->s1, susp); */
|
||||
sndseq_susp_type susp = (sndseq_susp_type) a_susp;
|
||||
sound_xlmark(susp->s1);
|
||||
if (susp->closure) mark(susp->closure);
|
||||
}
|
||||
|
@ -77,10 +76,9 @@ void sndseq_mark(sndseq_susp_type susp)
|
|||
|
||||
/* sndseq_fetch returns blocks of s1 until the logical stop time of s1 */
|
||||
/**/
|
||||
void sndseq_fetch(susp, snd_list)
|
||||
register sndseq_susp_type susp;
|
||||
snd_list_type snd_list;
|
||||
void sndseq_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
sndseq_susp_type susp = (sndseq_susp_type) a_susp;
|
||||
int togo;
|
||||
int n;
|
||||
sample_block_type out;
|
||||
|
@ -173,7 +171,7 @@ D stdputstr("using add_s1_nn_fetch\n");
|
|||
susp->output_per_s2 = susp->susp.sr / susp->s2->sr;
|
||||
|
||||
D stdputstr("in sndseq: calling add's fetch\n");
|
||||
(*(susp->susp.fetch))(susp, snd_list);
|
||||
(*(susp->susp.fetch))(a_susp, snd_list);
|
||||
D stdputstr("in sndseq: returned from add's fetch\n");
|
||||
/* gc();*/
|
||||
xlpop();
|
||||
|
@ -262,16 +260,17 @@ D stdputstr("in sndseq: returned from add's fetch\n");
|
|||
} /* sndseq_fetch */
|
||||
|
||||
|
||||
void sndseq_free(sndseq_susp_type susp)
|
||||
void sndseq_free(snd_susp_type a_susp)
|
||||
{
|
||||
sound_unref(susp->s1);
|
||||
sndseq_susp_type susp = (sndseq_susp_type) a_susp;
|
||||
sound_unref(susp->s2);
|
||||
ffree_generic(susp, sizeof(sndseq_susp_node), "sndseq_free");
|
||||
}
|
||||
|
||||
|
||||
void sndseq_print_tree(sndseq_susp_type susp, int n)
|
||||
void sndseq_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
sndseq_susp_type susp = (sndseq_susp_type) a_susp;
|
||||
indent(n);
|
||||
stdputstr("s1:");
|
||||
sound_print_tree_1(susp->s1, n);
|
||||
|
|
|
@ -7,20 +7,10 @@
|
|||
|
||||
#include "falloc.h"
|
||||
#include "cext.h"
|
||||
#include "sliders.h"
|
||||
#include "nyq-osc-server.h"
|
||||
#include "sliderdata.h"
|
||||
#include "sndsliders.h"
|
||||
|
||||
float slider_array[SLIDERS_MAX];
|
||||
|
||||
|
||||
void set_slider(int index, float value)
|
||||
{
|
||||
if (index >= 0 && index < SLIDERS_MAX) {
|
||||
slider_array[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LVAL xslider_read(void)
|
||||
{
|
||||
LVAL arg = xlgafixnum();
|
||||
|
@ -34,7 +24,11 @@ LVAL xslider_read(void)
|
|||
|
||||
LVAL xosc_enable(void)
|
||||
{
|
||||
LVAL arg = xlgetarg();
|
||||
/* only need arg if OSC is defined, otherwise compiler complains */
|
||||
#ifdef OSC
|
||||
LVAL arg =
|
||||
#endif
|
||||
xlgetarg();
|
||||
xllastarg();
|
||||
#ifdef OSC
|
||||
if (nosc_enabled == !null(arg)) {
|
||||
|
@ -63,8 +57,9 @@ typedef struct slider_susp_struct {
|
|||
} slider_susp_node, *slider_susp_type;
|
||||
|
||||
|
||||
void slider__fetch(register slider_susp_type susp, snd_list_type snd_list)
|
||||
void slider__fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
slider_susp_type susp = (slider_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
int togo;
|
||||
int n;
|
||||
|
@ -116,13 +111,14 @@ void slider__fetch(register slider_susp_type susp, snd_list_type snd_list)
|
|||
} /* slider__fetch */
|
||||
|
||||
|
||||
void slider_free(slider_susp_type susp)
|
||||
void slider_free(snd_susp_type a_susp)
|
||||
{
|
||||
slider_susp_type susp = (slider_susp_type) a_susp;
|
||||
ffree_generic(susp, sizeof(slider_susp_node), "slider_free");
|
||||
}
|
||||
|
||||
|
||||
void slider_print_tree(slider_susp_type susp, int n)
|
||||
void slider_print_tree(snd_susp_type susp, int n)
|
||||
{
|
||||
}
|
||||
|
|
@ -1,5 +1,10 @@
|
|||
/* sndsliders.h -- support for graphical sliders in Nyquist IDE */
|
||||
/* Roger Dannenberg
|
||||
* Jan 2013
|
||||
*/
|
||||
|
||||
|
||||
/* access from Nyquist unit generators to shared data */
|
||||
sound_type snd_make_slider(int index, time_type t0, rate_type sr, time_type d);
|
||||
sound_type snd_slider(int index, time_type t0, rate_type sr, time_type d);
|
||||
/* LISP: (SND-SLIDER FIXNUM ANYNUM ANYNUM ANYNUM) */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* sndwrite.c -- write sounds to files */
|
||||
/* sndwrite.c -- write sounds to files */
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "switches.h"
|
||||
|
@ -93,12 +93,8 @@
|
|||
max_sample = -s; \
|
||||
}
|
||||
|
||||
|
||||
/* jlh Changed these to the <> format, so it will be sought for in the
|
||||
include path */
|
||||
#include <portaudio.h>
|
||||
/* #include "exitpa.h" jlh obsolete? or windows only? PortAudio 2007
|
||||
has no such thing. Is it PA 19 or PA 2.0??? */
|
||||
// should be looking for local portaudio
|
||||
#include "portaudio.h"
|
||||
|
||||
long flush_count = 0; /* how many samples to write to finish */
|
||||
|
||||
|
@ -138,8 +134,9 @@ static int portaudio_error(PaError err, char *problem)
|
|||
{
|
||||
char msgbuffer[256];
|
||||
if (err != paNoError) {
|
||||
sprintf(msgbuffer, "%s, error %ld, %s.", problem, err,
|
||||
Pa_GetErrorText(err));
|
||||
snprintf(msgbuffer, sizeof(msgbuffer),
|
||||
"%s, error %d, %s.", problem, (int) err,
|
||||
Pa_GetErrorText(err));
|
||||
xlerrprint("warning", NULL, msgbuffer, s_unbound);
|
||||
return true;
|
||||
}
|
||||
|
@ -242,7 +239,8 @@ long lookup_format(long format, long mode, long bits, long swap)
|
|||
case SND_HEAD_SD2: sf_format = SF_FORMAT_SD2; break;
|
||||
case SND_HEAD_FLAC: sf_format = SF_FORMAT_FLAC; break;
|
||||
case SND_HEAD_CAF: sf_format = SF_FORMAT_CAF; break;
|
||||
case SND_HEAD_RAW:
|
||||
case SND_HEAD_OGG: sf_format = SF_FORMAT_OGG; mode = SND_MODE_VORBIS; break; /* ZEYU */
|
||||
case SND_HEAD_RAW:
|
||||
sf_format = SF_FORMAT_RAW;
|
||||
#ifdef XL_BIG_ENDIAN
|
||||
sf_format |= (swap ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG);
|
||||
|
@ -267,7 +265,7 @@ long lookup_format(long format, long mode, long bits, long swap)
|
|||
"using PCM instead\n");
|
||||
} /* no break here, fall through to SND_MODE_PCM... */
|
||||
default:
|
||||
nyquist_printf("s-save: unrecognized mode (%d), using PCM\n",
|
||||
nyquist_printf("s-save: unrecognized mode (%ld), using PCM\n",
|
||||
mode);
|
||||
/* no break, fall through as SND_MODE_PCM */
|
||||
case SND_MODE_PCM:
|
||||
|
@ -278,7 +276,7 @@ long lookup_format(long format, long mode, long bits, long swap)
|
|||
else {
|
||||
sf_mode = SF_FORMAT_PCM_16;
|
||||
nyquist_printf(
|
||||
"s-save: bad bits parameter (%d), using 16-bit PCM\n",
|
||||
"s-save: bad bits parameter (%ld), using 16-bit PCM\n",
|
||||
bits);
|
||||
}
|
||||
break;
|
||||
|
@ -287,7 +285,7 @@ long lookup_format(long format, long mode, long bits, long swap)
|
|||
case SND_MODE_FLOAT: sf_mode = SF_FORMAT_FLOAT; break;
|
||||
case SND_MODE_DOUBLE: sf_mode = SF_FORMAT_DOUBLE; break;
|
||||
case SND_MODE_UNKNOWN: sf_mode = SF_FORMAT_PCM_16; break;
|
||||
case SND_MODE_GSM610: sf_mode = SF_FORMAT_GSM610; break;
|
||||
case SND_MODE_GSM610: sf_mode = SF_FORMAT_GSM610; break;
|
||||
case SND_MODE_DWVW:
|
||||
if (bits <= 12) sf_mode = SF_FORMAT_DWVW_12;
|
||||
else if (bits <= 16) sf_mode = SF_FORMAT_DWVW_16;
|
||||
|
@ -300,11 +298,12 @@ long lookup_format(long format, long mode, long bits, long swap)
|
|||
else {
|
||||
sf_mode = SF_FORMAT_DPCM_16;
|
||||
nyquist_printf(
|
||||
"s-save: bad bits parameter (%d), using 16-bit DPCM\n",
|
||||
"s-save: bad bits parameter (%ld), using 16-bit DPCM\n",
|
||||
bits);
|
||||
}
|
||||
break;
|
||||
case SND_MODE_MSADPCM: sf_mode = SF_FORMAT_MS_ADPCM; break;
|
||||
case SND_MODE_VORBIS: sf_mode = SF_FORMAT_VORBIS; break;
|
||||
}
|
||||
return sf_format | sf_mode;
|
||||
}
|
||||
|
@ -330,6 +329,7 @@ double sound_save(
|
|||
SNDFILE *sndfile = NULL;
|
||||
SF_INFO sf_info;
|
||||
PaStream *audio_stream = NULL;
|
||||
if (SAFE_NYQUIST) play = FALSE;
|
||||
|
||||
gc();
|
||||
|
||||
|
@ -356,7 +356,9 @@ double sound_save(
|
|||
* write the file if (filename[0])
|
||||
*/
|
||||
if (filename[0]) {
|
||||
sndfile = sf_open((char *) filename, SFM_WRITE, &sf_info);
|
||||
sndfile = NULL;
|
||||
if (ok_to_open((char *) filename, "wb"))
|
||||
sndfile = sf_open((char *) filename, SFM_WRITE, &sf_info);
|
||||
if (sndfile) {
|
||||
/* use proper scale factor: 8000 vs 7FFF */
|
||||
sf_command(sndfile, SFC_SET_CLIPPING, NULL, SF_TRUE);
|
||||
|
@ -381,10 +383,19 @@ double sound_save(
|
|||
sf_info.samplerate = ROUND((getsound(result))->sr);
|
||||
*sr = sf_info.samplerate;
|
||||
if (filename[0]) {
|
||||
sndfile = sf_open((char *) filename, SFM_WRITE, &sf_info);
|
||||
if (sndfile) {
|
||||
/* use proper scale factor: 8000 vs 7FFF */
|
||||
sf_command(sndfile, SFC_SET_CLIPPING, NULL, SF_TRUE);
|
||||
sndfile = NULL;
|
||||
if (ok_to_open((char *) filename, "wb")) {
|
||||
sndfile = sf_open((char *) filename, SFM_WRITE, &sf_info);
|
||||
if (sndfile) {
|
||||
/* use proper scale factor: 8000 vs 7FFF */
|
||||
sf_command(sndfile, SFC_SET_CLIPPING, NULL, SF_TRUE);
|
||||
} else {
|
||||
char error[240];
|
||||
sprintf(error, "snd_save -- %s", sf_error_number(sf_error(sndfile)));
|
||||
xlabort(error);
|
||||
}
|
||||
} else {
|
||||
xlabort("snd_save -- write not permitted by -W option");
|
||||
}
|
||||
}
|
||||
if (play)
|
||||
|
@ -432,10 +443,12 @@ SNDFILE *open_for_write(unsigned char *filename, long direction,
|
|||
} else {
|
||||
sf_info->format = 0;
|
||||
}
|
||||
sndfile = sf_open((const char *) filename, direction, sf_info);
|
||||
sndfile = NULL;
|
||||
if (ok_to_open((char *) filename, "w"))
|
||||
sndfile = sf_open((const char *) filename, direction, sf_info);
|
||||
|
||||
if (!sndfile) {
|
||||
sprintf(error, "snd_overwrite: cannot open file %s", filename);
|
||||
snprintf(error, sizeof(error), "snd_overwrite: cannot open file %s", filename);
|
||||
xlabort(error);
|
||||
}
|
||||
/* use proper scale factor: 8000 vs 7FFF */
|
||||
|
@ -444,12 +457,12 @@ SNDFILE *open_for_write(unsigned char *filename, long direction,
|
|||
frames = round(offset * sf_info->samplerate);
|
||||
rslt = sf_seek(sndfile, frames, SEEK_SET);
|
||||
if (rslt < 0) {
|
||||
sprintf(error, "snd_overwrite: cannot seek to frame %lld of %s",
|
||||
snprintf(error, sizeof(error), "snd_overwrite: cannot seek to frame %lld of %s",
|
||||
frames, filename);
|
||||
xlabort(error);
|
||||
}
|
||||
if (sf_info->channels != channels) {
|
||||
sprintf(error, "%s%ld%s%ld%s",
|
||||
snprintf(error, sizeof(error), "%s%d%s%d%s",
|
||||
"snd_overwrite: number of channels in sound (",
|
||||
channels,
|
||||
") does not match\n number of channels in file (",
|
||||
|
@ -459,7 +472,7 @@ SNDFILE *open_for_write(unsigned char *filename, long direction,
|
|||
}
|
||||
|
||||
if (sf_info->samplerate != srate) {
|
||||
sprintf(error, "%s%g%s%ld%s",
|
||||
snprintf(error, sizeof(error), "%s%ld%s%d%s",
|
||||
"snd_overwrite: sample rate in sound (",
|
||||
srate,
|
||||
") does not match\n sample rate in file (",
|
||||
|
@ -496,7 +509,9 @@ double sound_overwrite(
|
|||
long flags;
|
||||
*/
|
||||
// first check if sound file exists, do not create new file
|
||||
FILE *file = fopen((char *) filename, "rb");
|
||||
FILE *file = NULL;
|
||||
if (ok_to_open((char *) filename, "rb"))
|
||||
file = fopen((char *) filename, "rb");
|
||||
// if not then fail
|
||||
if (!file) {
|
||||
*duration = 0;
|
||||
|
@ -513,6 +528,7 @@ double sound_overwrite(
|
|||
float *buf; // buffer for samples read in from sound file
|
||||
/* make sure all elements are of type a_sound */
|
||||
long i = getsize(result);
|
||||
long channels = i;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
if (!exttypep(getelement(result, i), a_sound)) {
|
||||
|
@ -520,7 +536,7 @@ double sound_overwrite(
|
|||
result);
|
||||
}
|
||||
}
|
||||
sndfile = open_for_write(filename, SFM_RDWR, format, &sf_info, i,
|
||||
sndfile = open_for_write(filename, SFM_RDWR, format, &sf_info, channels,
|
||||
ROUND(getsound(getelement(result, 0))->sr),
|
||||
offset_secs, &buf);
|
||||
|
||||
|
@ -569,7 +585,6 @@ sample_type sound_save_sound(LVAL s_as_lval, long n, SF_INFO *sf_info,
|
|||
sample_type threshold = 0.0F;
|
||||
/* jlh cvtfn_type cvtfn; */
|
||||
*ntotal = 0;
|
||||
|
||||
/* if snd_expr was simply a symbol, then s now points to
|
||||
a shared sound_node. If we read samples from it, then
|
||||
the sound bound to the symbol will be destroyed, so
|
||||
|
@ -746,7 +761,7 @@ D nyquist_printf("save scale factor %ld = %g\n", i, state[i].scale);
|
|||
for (i = 0; i < chans; i++) {
|
||||
if (state[i].cnt == 0) {
|
||||
if (sndwrite_trace) {
|
||||
nyquist_printf("CALLING SOUND_GET_NEXT ON CHANNEL %ld (%x)\n",
|
||||
nyquist_printf("CALLING SOUND_GET_NEXT ON CHANNEL %ld (%lx)\n",
|
||||
i, (unsigned long) state[i].sound); /* jlh 64 bit issue */
|
||||
sound_print_tree(state[i].sound);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// sndwritepa.h -- headers for sndwritepa.c
|
||||
//
|
||||
// Roger Dannenberg
|
||||
// Jan 2013
|
||||
//
|
||||
// Since sndwritepa.c is a PortAudio based implementation of the sndwrite.h
|
||||
// interface, we just include sndwrite.h (By doing this, we regularize the
|
||||
// system so that there is a .h file corresponding to each .c file.)
|
||||
|
||||
#include "sndwrite.h"
|
|
@ -73,6 +73,16 @@ double snd_set_latency(double latency)
|
|||
}
|
||||
|
||||
|
||||
long check_terminate_cnt(long tc)
|
||||
{
|
||||
if (tc < 0) {
|
||||
xlfail("duration is less than 0 samples");
|
||||
tc = 0; /* this should not be reached */
|
||||
}
|
||||
return tc;
|
||||
}
|
||||
|
||||
|
||||
/* xlbadsr - report a "bad combination of sample rates" error */
|
||||
LVAL snd_badsr(void)
|
||||
{
|
||||
|
@ -1572,12 +1582,19 @@ double hz_to_step(double hz)
|
|||
}
|
||||
|
||||
|
||||
double step_to_hz(steps)
|
||||
double steps;
|
||||
double step_to_hz(double steps)
|
||||
{
|
||||
return exp(steps * p1 + p2);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#define RECIP_LOG_2 1.44269504088895364453
|
||||
|
||||
double log2(double x)
|
||||
{
|
||||
return log(x) * RECIP_LOG_2;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* from old stuff...
|
||||
|
@ -1616,9 +1633,9 @@ static unsigned char *sound_xlrestore(FILE *fp)
|
|||
|
||||
/* sound_xlmark -- mark LVAL nodes reachable from this sound */
|
||||
/**/
|
||||
void sound_xlmark(s)
|
||||
sound_type s;
|
||||
void sound_xlmark(void *a_sound)
|
||||
{
|
||||
sound_type s = (sound_type) a_sound;
|
||||
snd_list_type snd_list;
|
||||
long counter = 0;
|
||||
#ifdef TRACESNDGC
|
||||
|
|
|
@ -53,6 +53,14 @@ extern int nosc_enabled; /* enable polling for OSC messages */
|
|||
#define INTERP_ss 5
|
||||
#define INTERP_si 6
|
||||
#define INTERP_sr 7
|
||||
#define INTERP_in 8
|
||||
#define INTERP_is 9
|
||||
#define INTERP_ii 10
|
||||
#define INTERP_ir 11
|
||||
#define INTERP_rn 12
|
||||
#define INTERP_rs 13
|
||||
#define INTERP_ri 14
|
||||
#define INTERP_rr 15
|
||||
|
||||
#define INTERP_nnn 0
|
||||
#define INTERP_nns 1
|
||||
|
@ -87,6 +95,39 @@ extern int nosc_enabled; /* enable polling for OSC messages */
|
|||
#define INTERP_sri 30
|
||||
#define INTERP_srr 31
|
||||
|
||||
#define INTERP_inn 32
|
||||
#define INTERP_ins 33
|
||||
#define INTERP_ini 34
|
||||
#define INTERP_inr 35
|
||||
#define INTERP_isn 36
|
||||
#define INTERP_iss 37
|
||||
#define INTERP_isi 38
|
||||
#define INTERP_isr 39
|
||||
#define INTERP_iin 40
|
||||
#define INTERP_iis 41
|
||||
#define INTERP_iii 42
|
||||
#define INTERP_iir 43
|
||||
#define INTERP_irn 44
|
||||
#define INTERP_irs 45
|
||||
#define INTERP_iri 46
|
||||
#define INTERP_irr 47
|
||||
#define INTERP_rnn 48
|
||||
#define INTERP_rns 49
|
||||
#define INTERP_rni 50
|
||||
#define INTERP_rnr 51
|
||||
#define INTERP_rsn 52
|
||||
#define INTERP_rss 53
|
||||
#define INTERP_rsi 54
|
||||
#define INTERP_rsr 55
|
||||
#define INTERP_rin 56
|
||||
#define INTERP_ris 57
|
||||
#define INTERP_rii 58
|
||||
#define INTERP_rir 59
|
||||
#define INTERP_rrn 60
|
||||
#define INTERP_rrs 61
|
||||
#define INTERP_rri 62
|
||||
#define INTERP_rrr 63
|
||||
|
||||
#define INTERP_nnnn 0
|
||||
#define INTERP_nnns 1
|
||||
#define INTERP_nnsn 4
|
||||
|
@ -95,6 +136,7 @@ extern int nosc_enabled; /* enable polling for OSC messages */
|
|||
#define INTERP_nsns 17
|
||||
#define INTERP_nssn 20
|
||||
#define INTERP_nsss 21
|
||||
#define INTERP_nrrr 63
|
||||
#define INTERP_snnn 64
|
||||
#define INTERP_snns 65
|
||||
#define INTERP_snsn 68
|
||||
|
@ -105,11 +147,76 @@ extern int nosc_enabled; /* enable polling for OSC messages */
|
|||
#define INTERP_ssss 85
|
||||
#define INTERP_niii 42
|
||||
#define INTERP_siii 106
|
||||
#define INTERP_nrrr 63
|
||||
#define INTERP_srrr 127
|
||||
#define INTERP_iiii 170
|
||||
#define INTERP_rrrr 255
|
||||
|
||||
#define INTERP_nnnnnn 0
|
||||
#define INTERP_nnnnnn 0
|
||||
#define INTERP_nnnnns 1
|
||||
#define INTERP_nnnnsn 4
|
||||
#define INTERP_nnnnss 5
|
||||
#define INTERP_nnnsnn 16
|
||||
#define INTERP_nnnsns 17
|
||||
#define INTERP_nnnssn 20
|
||||
#define INTERP_nnnsss 21
|
||||
#define INTERP_nnsnnn 64
|
||||
#define INTERP_nnsnns 65
|
||||
#define INTERP_nnsnsn 68
|
||||
#define INTERP_nnsnss 69
|
||||
#define INTERP_nnssnn 80
|
||||
#define INTERP_nnssns 81
|
||||
#define INTERP_nnsssn 84
|
||||
#define INTERP_nnssss 85
|
||||
#define INTERP_nsnnnn 256
|
||||
#define INTERP_nsnnns 257
|
||||
#define INTERP_nsnnsn 260
|
||||
#define INTERP_nsnnss 261
|
||||
#define INTERP_nsnsnn 272
|
||||
#define INTERP_nsnsns 273
|
||||
#define INTERP_nsnssn 276
|
||||
#define INTERP_nsnsss 277
|
||||
#define INTERP_nssnnn 320
|
||||
#define INTERP_nssnns 321
|
||||
#define INTERP_nssnsn 324
|
||||
#define INTERP_nssnss 325
|
||||
#define INTERP_nsssnn 336
|
||||
#define INTERP_nsssns 337
|
||||
#define INTERP_nssssn 340
|
||||
#define INTERP_nsssss 341
|
||||
#define INTERP_snnnnn 1024
|
||||
#define INTERP_snnnns 1025
|
||||
#define INTERP_snnnsn 1028
|
||||
#define INTERP_snnnss 1029
|
||||
#define INTERP_snnsnn 1040
|
||||
#define INTERP_snnsns 1041
|
||||
#define INTERP_snnssn 1044
|
||||
#define INTERP_snnsss 1045
|
||||
#define INTERP_snsnnn 1088
|
||||
#define INTERP_snsnns 1089
|
||||
#define INTERP_snsnsn 1092
|
||||
#define INTERP_snsnss 1093
|
||||
#define INTERP_snssnn 1104
|
||||
#define INTERP_snssns 1105
|
||||
#define INTERP_snsssn 1108
|
||||
#define INTERP_snssss 1109
|
||||
#define INTERP_ssnnnn 1280
|
||||
#define INTERP_ssnnns 1281
|
||||
#define INTERP_ssnnsn 1284
|
||||
#define INTERP_ssnnss 1285
|
||||
#define INTERP_ssnsnn 1296
|
||||
#define INTERP_ssnsns 1297
|
||||
#define INTERP_ssnssn 1300
|
||||
#define INTERP_ssnsss 1301
|
||||
#define INTERP_sssnnn 1344
|
||||
#define INTERP_sssnns 1345
|
||||
#define INTERP_sssnsn 1348
|
||||
#define INTERP_sssnss 1349
|
||||
#define INTERP_ssssnn 1360
|
||||
#define INTERP_ssssns 1361
|
||||
#define INTERP_sssssn 1364
|
||||
#define INTERP_ssssss 1365
|
||||
#define INTERP_iiiiii 2730
|
||||
#define INTERP_rrrrrr 4095
|
||||
|
||||
#define INTERP_nnnnnnnn 0
|
||||
#define INTERP_ssssssss 21845
|
||||
|
@ -119,6 +226,7 @@ extern int nosc_enabled; /* enable polling for OSC messages */
|
|||
#define INTERP_SHIFT 2
|
||||
|
||||
LVAL snd_badsr(void);
|
||||
long check_terminate_cnt(long tc);
|
||||
|
||||
typedef double time_type;
|
||||
typedef double rate_type;
|
||||
|
@ -141,6 +249,11 @@ typedef double promoted_sample_type;
|
|||
#define max_sample_block_len 1020
|
||||
/* #define max_sample_block_len 4 */
|
||||
|
||||
/* longest allowed sample is basically 2^31 but a bit lower to
|
||||
allow for rounding */
|
||||
#define MAX_SND_LEN (MAX_STOP - max_sample_block_len * 2)
|
||||
|
||||
|
||||
/* Defines needed for xlisp */
|
||||
#define getsound(x) ((sound_type) getinst(x))
|
||||
#define xlgasound() (testarg(typearg(soundp)))
|
||||
|
@ -156,18 +269,21 @@ typedef struct {
|
|||
} sample_block_node, *sample_block_type;
|
||||
|
||||
|
||||
/* forward declaration for circular type dependencies */
|
||||
typedef struct snd_list_struct *snd_list_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 */
|
||||
void (*fetch)(struct snd_susp_struct *, snd_list_type snd_list);
|
||||
void (*keep_fetch)(struct snd_susp_struct *, snd_list_type snd_list);
|
||||
void (*free)(struct snd_susp_struct *);
|
||||
void (*mark)(struct snd_susp_struct *); /* marks LVAL nodes for GC */
|
||||
void (*print_tree)(struct snd_susp_struct *, int); /* 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;
|
||||
|
||||
|
@ -177,11 +293,11 @@ typedef struct snd_list_struct {
|
|||
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;
|
||||
} u;
|
||||
short refcnt;
|
||||
short block_len;
|
||||
boolean logically_stopped;
|
||||
} snd_list_node; /* , *snd_list_type; -- defined above */
|
||||
|
||||
extern snd_list_type list_watch; //DBY
|
||||
|
||||
|
@ -200,7 +316,7 @@ typedef struct table_struct {
|
|||
#define UNKNOWN (-10-max_sample_block_len)
|
||||
|
||||
typedef struct sound_struct {
|
||||
sample_block_type (*get_next)(/* struct sound_struct *snd, long *cnt */);
|
||||
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. */
|
||||
|
@ -216,7 +332,7 @@ typedef struct sound_struct {
|
|||
long prepend_cnt; /* how many zeros to prepend */
|
||||
/* function to use as get_next after prepended zeros are generated: */
|
||||
sample_block_type (*after_prepend)
|
||||
(/* struct sound_struct * snd, long * cnt */);
|
||||
(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
|
||||
|
@ -242,14 +358,14 @@ double snd_set_latency(double latency);
|
|||
double compute_phase(double phase, double key, long n, double srate,
|
||||
double new_srate, double freq, double *incr_ptr);
|
||||
|
||||
boolean soundp();
|
||||
boolean soundp(LVAL);
|
||||
/* 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();
|
||||
LVAL cvsound(sound_type);
|
||||
extern LVAL a_sound;
|
||||
|
||||
sample_block_type SND_get_next(sound_type snd, long * cnt);
|
||||
|
@ -257,9 +373,9 @@ 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) */
|
||||
double hz_to_step(double); /* 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) */
|
||||
void set_logical_stop_time(sound_type sound, time_type when); /* LISP: (SND-SET-LOGICAL-STOP SOUND ANYNUM) */
|
||||
|
||||
#define xlog(x) log(x)
|
||||
/* LISP: double (LOG FLONUM) */
|
||||
|
@ -307,17 +423,17 @@ long sound_nth_block(sound_type snd, long n);
|
|||
|
||||
sound_type sound_copy(sound_type snd);
|
||||
/* LISP: (SND-COPY SOUND) */
|
||||
void sound_xlmark(sound_type s);
|
||||
void sound_xlmark(void *a_sound);
|
||||
void sound_print(LVAL snd_expr, long n);
|
||||
/* LISP: (SND-PRINT ANY FIXNUM) */
|
||||
void sound_play(LVAL snd_expr);
|
||||
/* LISP: (SND-PLAY ANY) */
|
||||
void stats();
|
||||
void stats(void);
|
||||
/* LISP: (STATS) */
|
||||
void sound_print_tree(sound_type snd);
|
||||
/* LISP: (SND-PRINT-TREE SOUND) */
|
||||
|
||||
void mark_audio_time();
|
||||
void mark_audio_time(void);
|
||||
|
||||
void sound_print_tree_1(sound_type snd, int n);
|
||||
|
||||
|
@ -338,9 +454,13 @@ sound_type sound_zero(time_type t0, rate_type sr);
|
|||
|
||||
#define susp_print_tree(s, n) (*((s)->print_tree))(s, n)
|
||||
|
||||
double step_to_hz();
|
||||
double step_to_hz(double);
|
||||
/* LISP: (STEP-TO-HZ ANYNUM) */
|
||||
|
||||
#ifdef WIN32
|
||||
double log2(double x);
|
||||
#endif WIN32
|
||||
|
||||
/* macros for access to samples within a suspension */
|
||||
/* NOTE: assume suspension structure is named "susp" */
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "sound.h"
|
||||
#include "falloc.h"
|
||||
|
||||
|
||||
void stats()
|
||||
{
|
||||
nyquist_printf("\n\nNyquist statistics:\n\n");
|
||||
|
|
|
@ -80,13 +80,14 @@ typedef struct trigger_susp_struct {
|
|||
} trigger_susp_node, *trigger_susp_type;
|
||||
|
||||
|
||||
void trigger_fetch(trigger_susp_type, snd_list_type);
|
||||
void trigger_fetch(snd_susp_type, snd_list_type);
|
||||
void trigger_free();
|
||||
|
||||
extern LVAL s_stdout;
|
||||
|
||||
void trigger_mark(trigger_susp_type susp)
|
||||
void trigger_mark(snd_susp_type a_susp)
|
||||
{
|
||||
trigger_susp_type susp = (trigger_susp_type) a_susp;
|
||||
sound_xlmark(susp->s1);
|
||||
if (susp->closure) mark(susp->closure);
|
||||
}
|
||||
|
@ -95,8 +96,9 @@ void trigger_mark(trigger_susp_type susp)
|
|||
|
||||
/* trigger_fetch returns zero blocks until s1 goes from <=0 to >0 */
|
||||
/**/
|
||||
void trigger_fetch(trigger_susp_type susp, snd_list_type snd_list)
|
||||
void trigger_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
trigger_susp_type susp = (trigger_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
int togo;
|
||||
int n;
|
||||
|
@ -208,7 +210,7 @@ D nyquist_printf("in trigger: after evaluation; "
|
|||
|
||||
D stdputstr("in trigger: calling add's fetch\n");
|
||||
/* fetch will get called later ..
|
||||
(*(susp->susp.fetch))(susp, snd_list); */
|
||||
(*(susp->susp.fetch))(a_susp, snd_list); */
|
||||
D stdputstr("in trigger: returned from add's fetch\n");
|
||||
xlpop();
|
||||
|
||||
|
@ -217,8 +219,9 @@ D stdputstr("in trigger: returned from add's fetch\n");
|
|||
/* but if cnt == 0, then we haven't computed any samples */
|
||||
/* call on new fetch routine to get some samples */
|
||||
if (cnt == 0) {
|
||||
ffree_sample_block(out, "trigger-pre-adder"); // because adder will reallocate
|
||||
(*susp->susp.fetch)(susp, snd_list);
|
||||
// because adder will reallocate
|
||||
ffree_sample_block(out, "trigger-pre-adder");
|
||||
(*susp->susp.fetch)(a_susp, snd_list);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
|
@ -244,16 +247,18 @@ D stdputstr("in trigger: returned from add's fetch\n");
|
|||
} /* trigger_fetch */
|
||||
|
||||
|
||||
void trigger_free(trigger_susp_type susp)
|
||||
void trigger_free(snd_susp_type a_susp)
|
||||
{
|
||||
trigger_susp_type susp = (trigger_susp_type) a_susp;
|
||||
sound_unref(susp->s1);
|
||||
sound_unref(susp->s2);
|
||||
ffree_generic(susp, sizeof(trigger_susp_node), "trigger_free");
|
||||
}
|
||||
|
||||
|
||||
void trigger_print_tree(trigger_susp_type susp, int n)
|
||||
void trigger_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
trigger_susp_type susp = (trigger_susp_type) a_susp;
|
||||
indent(n);
|
||||
stdputstr("s1:");
|
||||
sound_print_tree_1(susp->s1, n);
|
||||
|
|
|
@ -271,8 +271,9 @@ void yin_compute(yin_susp_type susp, float *pitch, float *harmonicity)
|
|||
* deallocated, because it can only be referenced through the
|
||||
* snd_list nodes to which there are backpointers.
|
||||
*/
|
||||
void yin_fetch(yin_susp_type susp, snd_list_type snd_list)
|
||||
void yin_fetch(snd_susp_type a_susp, snd_list_type snd_list)
|
||||
{
|
||||
yin_susp_type susp = (yin_susp_type) a_susp;
|
||||
int cnt = 0; /* how many samples computed */
|
||||
int togo;
|
||||
int n;
|
||||
|
@ -478,14 +479,16 @@ void yin_fetch(yin_susp_type susp, snd_list_type snd_list)
|
|||
} /* yin_fetch */
|
||||
|
||||
|
||||
void yin_mark(yin_susp_type susp)
|
||||
void yin_mark(snd_susp_type a_susp)
|
||||
{
|
||||
yin_susp_type susp = (yin_susp_type) a_susp;
|
||||
sound_xlmark(susp->s);
|
||||
}
|
||||
|
||||
|
||||
void yin_free(yin_susp_type susp)
|
||||
void yin_free(snd_susp_type a_susp)
|
||||
{
|
||||
yin_susp_type susp = (yin_susp_type) a_susp;
|
||||
int j;
|
||||
boolean active = false;
|
||||
/* stdputstr("yin_free: "); */
|
||||
|
@ -509,8 +512,9 @@ void yin_free(yin_susp_type susp)
|
|||
}
|
||||
|
||||
|
||||
void yin_print_tree(yin_susp_type susp, int n)
|
||||
void yin_print_tree(snd_susp_type a_susp, int n)
|
||||
{
|
||||
yin_susp_type susp = (yin_susp_type) a_susp;
|
||||
indent(n);
|
||||
stdputstr("s:");
|
||||
sound_print_tree_1(susp->s, n);
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/***************************************************/
|
||||
/*! \class ReedTabl
|
||||
\brief STK reed table class.
|
||||
|
||||
This class implements a simple one breakpoint,
|
||||
non-linear reed function, as described by
|
||||
Smith (1986). This function is based on a
|
||||
memoryless non-linear spring model of the reed
|
||||
(the reed mass is ignored) which saturates when
|
||||
the reed collides with the mouthpiece facing.
|
||||
|
||||
See McIntyre, Schumacher, & Woodhouse (1983),
|
||||
Smith (1986), Hirschman, Cook, Scavone, and
|
||||
others for more information.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2002.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
#if !defined(__REEDTABL_H)
|
||||
#define __REEDTABL_H
|
||||
|
||||
#include "Stk.h"
|
||||
|
||||
class ReedTabl : public Stk
|
||||
{
|
||||
public:
|
||||
//! Default constructor.
|
||||
ReedTabl();
|
||||
|
||||
//! Class destructor.
|
||||
~ReedTabl();
|
||||
|
||||
//! Set the table offset value.
|
||||
/*!
|
||||
The table offset roughly corresponds to the size
|
||||
of the initial reed tip opening (a greater offset
|
||||
represents a smaller opening).
|
||||
*/
|
||||
void setOffset(MY_FLOAT aValue);
|
||||
|
||||
//! Set the table slope value.
|
||||
/*!
|
||||
The table slope roughly corresponds to the reed
|
||||
stiffness (a greater slope represents a harder
|
||||
reed).
|
||||
*/
|
||||
void setSlope(MY_FLOAT aValue);
|
||||
|
||||
//! Return the last output value.
|
||||
MY_FLOAT lastOut() const;
|
||||
|
||||
//! Return the function value for \e input.
|
||||
/*!
|
||||
The function input represents the differential
|
||||
pressure across the reeds.
|
||||
*/
|
||||
MY_FLOAT tick(MY_FLOAT input);
|
||||
|
||||
//! Take \e vectorSize inputs and return the corresponding function values in \e vector.
|
||||
MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
|
||||
|
||||
protected:
|
||||
MY_FLOAT offSet;
|
||||
MY_FLOAT slope;
|
||||
MY_FLOAT lastOutput;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -36,6 +36,15 @@
|
|||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
|
||||
/* this is defined in xlisp.h, but it seems a bad idea
|
||||
* to create an stk dependency on xlisp, or to add a new
|
||||
* security.h file to share between xlisp.h and stk
|
||||
*/
|
||||
extern "C" {
|
||||
int ok_to_open(const char *filename, const char *mode);
|
||||
}
|
||||
|
||||
using namespace Nyq;
|
||||
|
||||
|
@ -47,7 +56,7 @@ FileRead :: FileRead()
|
|||
FileRead :: FileRead( std::string fileName, bool typeRaw )
|
||||
: fd_(0)
|
||||
{
|
||||
open( fileName, typeRaw );
|
||||
open( fileName, typeRaw );
|
||||
}
|
||||
|
||||
FileRead :: ~FileRead()
|
||||
|
@ -75,7 +84,9 @@ void FileRead :: open( std::string fileName, bool typeRaw )
|
|||
close();
|
||||
|
||||
// Try to open the file.
|
||||
fd_ = fopen( fileName.c_str(), "rb" );
|
||||
fd_ = NULL;
|
||||
if (ok_to_open(fileName.c_str(), "rb"))
|
||||
fd_ = fopen( fileName.c_str(), "rb" );
|
||||
if ( !fd_ ) {
|
||||
errorString_ << "FileRead::open: could not open or find file (" << fileName << ")!";
|
||||
handleError( StkError::FILE_NOT_FOUND );
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
/***************************************************/
|
||||
/*! \class ReedTabl
|
||||
\brief STK reed table class.
|
||||
|
||||
This class implements a simple one breakpoint,
|
||||
non-linear reed function, as described by
|
||||
Smith (1986). This function is based on a
|
||||
memoryless non-linear spring model of the reed
|
||||
(the reed mass is ignored) which saturates when
|
||||
the reed collides with the mouthpiece facing.
|
||||
|
||||
See McIntyre, Schumacher, & Woodhouse (1983),
|
||||
Smith (1986), Hirschman, Cook, Scavone, and
|
||||
others for more information.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2002.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
#include "ReedTabl.h"
|
||||
|
||||
ReedTabl :: ReedTabl()
|
||||
{
|
||||
offSet = (MY_FLOAT) 0.6; // Offset is a bias, related to reed rest position.
|
||||
slope = (MY_FLOAT) -0.8; // Slope corresponds loosely to reed stiffness.
|
||||
}
|
||||
|
||||
ReedTabl :: ~ReedTabl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ReedTabl :: setOffset(MY_FLOAT aValue)
|
||||
{
|
||||
offSet = aValue;
|
||||
}
|
||||
|
||||
void ReedTabl :: setSlope(MY_FLOAT aValue)
|
||||
{
|
||||
slope = aValue;
|
||||
}
|
||||
|
||||
MY_FLOAT ReedTabl :: lastOut() const
|
||||
{
|
||||
return lastOutput;
|
||||
}
|
||||
|
||||
MY_FLOAT ReedTabl :: tick(MY_FLOAT input)
|
||||
{
|
||||
// The input is differential pressure across the reed.
|
||||
lastOutput = offSet + (slope * input);
|
||||
|
||||
// If output is > 1, the reed has slammed shut and the
|
||||
// reflection function value saturates at 1.0.
|
||||
if (lastOutput > 1.0) lastOutput = (MY_FLOAT) 1.0;
|
||||
|
||||
// This is nearly impossible in a physical system, but
|
||||
// a reflection function value of -1.0 corresponds to
|
||||
// an open end (and no discontinuity in bore profile).
|
||||
if (lastOutput < -1.0) lastOutput = (MY_FLOAT) -1.0;
|
||||
return lastOutput;
|
||||
}
|
||||
|
||||
MY_FLOAT *ReedTabl :: tick(MY_FLOAT *vector, unsigned int vectorSize)
|
||||
{
|
||||
for (unsigned int i=0; i<vectorSize; i++)
|
||||
vector[i] = tick(vector[i]);
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/* Handle required apple events -EAD */
|
||||
|
||||
#include <Files.h>
|
||||
#include <string.h>
|
||||
#include <AppleEvents.h>
|
||||
#include "macstuff.h"
|
||||
#include "MacCommandWin.h"
|
||||
#include "MacFileUtils.h"
|
||||
//#include "MiscellaneousUtilities.h"
|
||||
|
||||
#define TEXTREC (*hTERec) // the command
|
||||
extern TEHandle hTERec; // window text record
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// Handle quit apple event
|
||||
//=========================================================================
|
||||
|
||||
pascal OSErr AEQuit (AppleEvent *theAppleEvent, AppleEvent *theReply, long Refcon)
|
||||
{
|
||||
osfinish();
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Handle Open Document apple event by trying to load it.
|
||||
//=========================================================================
|
||||
extern xlload (char *, int, int);
|
||||
extern xlabort(char *);
|
||||
|
||||
pascal OSErr AEOpenFiles(AppleEvent *theAppleEvent, AppleEvent *theReply,
|
||||
long Refcon)
|
||||
{
|
||||
AEDescList docList;
|
||||
AEKeyword keywd;
|
||||
DescType returnedType;
|
||||
Size actualSize;
|
||||
long itemsInList;
|
||||
FSSpec theSpec;
|
||||
CInfoPBRec pb;
|
||||
Str255 name;
|
||||
short i;
|
||||
|
||||
if (AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList, &docList) !=
|
||||
noErr) return;
|
||||
if (AECountItems (&docList, &itemsInList) != noErr) return;
|
||||
|
||||
SetSelection (TEXTREC->teLength, TEXTREC->teLength);
|
||||
for (i = 1; i <= itemsInList; i++) {
|
||||
AEGetNthPtr (&docList, i, typeFSS, &keywd, &returnedType,
|
||||
(Ptr) &theSpec, sizeof(theSpec), &actualSize);
|
||||
|
||||
GetFullPath(&theSpec, name);
|
||||
P2CStr(name); // was: pstrterm(name);
|
||||
if (xlload ((char *)name + 1, 1, 0) == 0) xlabort ("load error");
|
||||
}
|
||||
macputs ("> ");
|
||||
PrepareForInput ();
|
||||
}
|
|
@ -0,0 +1,764 @@
|
|||
//=============================================================================
|
||||
// All command window updates, input, etc happen here -EAD
|
||||
//=============================================================================
|
||||
#include <Controls.h>
|
||||
/* #include <ControlDefinitions.h> */
|
||||
#include <Events.h>
|
||||
#include <Fonts.h>
|
||||
#include <MacWindows.h>
|
||||
#include "MacGlobals.h"
|
||||
#include "macint.h"
|
||||
#include <ctype.h>
|
||||
#define NIL ((void *) 0)
|
||||
|
||||
//=============================================================================
|
||||
// local variables
|
||||
//=============================================================================
|
||||
|
||||
ControlHandle vScroll;
|
||||
int cursorPos; /* the cursor's position on the line */
|
||||
short linesInView; /* how many lines are in the window */
|
||||
int cmdStart; /* where (in text record) the current command starts */
|
||||
TextStyle textStyle[2]; /* styles: bold for user input, plain for output */
|
||||
/* output is buffered */
|
||||
Handle hOutputBuffer = NULL;
|
||||
enum currentStyle { plainStyle, boldStyle } currentStyle;
|
||||
|
||||
static void GoStartOfLine (void);
|
||||
static void GoEndOfLine (void);
|
||||
static void GoBackOneWord (void);
|
||||
static void GoForwardOneWord (void);
|
||||
|
||||
//=============================================================================
|
||||
// static void DoScrollBar (ControlHandle control, short change)
|
||||
//=============================================================================
|
||||
/* keep track of the user as he fiddles with the scroll bar */
|
||||
/* This routine is called while the user has the mouse down. */
|
||||
/* It makes sure the thumb isn't dragged out-of-bounds. */
|
||||
//=============================================================================
|
||||
|
||||
static void DoScrollBar (ControlHandle control, short change) {
|
||||
short value = GetControlValue (control), max = GetControlMaximum (control);
|
||||
long newval = value + change; /* this is a long in case we try to go past MAX_INT */
|
||||
if (newval < 0) newval = 0; else if (newval > max) newval = max;
|
||||
SetControlValue (control, (short) newval);
|
||||
if (newval != value) TEScroll (0, (short) (value - newval) * LINEHEIGHT, hTERec);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// pascal Boolean ScrollClickLoop (void)
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
pascal Boolean ScrollClickLoop (void) {
|
||||
Rect tempRect;
|
||||
Point mouse;
|
||||
GrafPtr oldPort;
|
||||
RgnHandle oldClip;
|
||||
short amount = 0;
|
||||
|
||||
if (FrontWindow () != gCommandWin) return false;
|
||||
|
||||
GetPort (&oldPort);
|
||||
SetPort (gCommandWin);
|
||||
GetClip (oldClip = NewRgn ());
|
||||
SetRect (&tempRect, INT_MIN, INT_MIN, INT_MAX, INT_MAX);
|
||||
ClipRect (&tempRect);
|
||||
|
||||
GetMouse (&mouse);
|
||||
if (mouse.v < TEXTREC->viewRect.top) DoScrollBar (vScroll, -1);
|
||||
else if (mouse.v > TEXTREC->viewRect.bottom) DoScrollBar (vScroll, 1);
|
||||
|
||||
SetClip (oldClip);
|
||||
DisposeRgn (oldClip);
|
||||
SetPort (oldPort);
|
||||
return true;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// static pascal void ScrollProc (ControlHandle control, short thePart)
|
||||
//=============================================================================
|
||||
// for clicks in the scroll bar or arrows; update the window properly
|
||||
//=============================================================================
|
||||
|
||||
pascal void ScrollProc (ControlHandle control, short thePart) {
|
||||
short amount;
|
||||
WindowPtr window;
|
||||
|
||||
if (!thePart) return;
|
||||
window = (*control)->contrlOwner;
|
||||
switch (thePart) {
|
||||
case kControlUpButtonPart: amount = -1; break;
|
||||
case kControlDownButtonPart: amount = 1; break;
|
||||
case kControlPageUpPart: amount = -linesInView; break;
|
||||
case kControlPageDownPart: amount = linesInView; break;
|
||||
}
|
||||
DoScrollBar (control, amount);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Rect SetTERect (void)
|
||||
//=============================================================================
|
||||
// set the dimensions of the text record in its window
|
||||
//=============================================================================
|
||||
|
||||
Rect SetTERect (void) {
|
||||
Rect teRect = gCommandWin->portRect;
|
||||
teRect.right -= SCROLLER_WIDTH;
|
||||
InsetRect (&teRect, TEXT_MARGIN, TEXT_MARGIN);
|
||||
linesInView = (teRect.bottom - teRect.top) / LINEHEIGHT;
|
||||
teRect.bottom = teRect.top + linesInView * LINEHEIGHT; /* round off */
|
||||
return teRect;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// static void AdjustCursor (EventRecord *theEvent)
|
||||
//=============================================================================
|
||||
// make the pointer an I-beam iff it's in the text window
|
||||
//=============================================================================
|
||||
|
||||
void AdjustCursor (Point theLoc, RgnHandle theRgn)
|
||||
{
|
||||
RgnHandle arrowRgn, iBeamRgn, hiliteRgn, tempRgn;
|
||||
Rect theRect;
|
||||
Point thePoint;
|
||||
|
||||
if (gInBackground)
|
||||
return;
|
||||
|
||||
arrowRgn = NewRgn();
|
||||
SetRectRgn(arrowRgn, -32767, -32767, 32767, 32767);
|
||||
|
||||
// GlobalToLocal ((theLoc); ???
|
||||
|
||||
if (gCommandWin == FrontWindow () ) {
|
||||
SetPort(gCommandWin);
|
||||
iBeamRgn = NewRgn();
|
||||
hiliteRgn = NewRgn();
|
||||
|
||||
theRect = TEXTREC->viewRect;
|
||||
LocalToGlobal((Point *)&(theRect.top));
|
||||
LocalToGlobal((Point *)&(theRect.bottom));
|
||||
RectRgn(iBeamRgn, &theRect);
|
||||
|
||||
TEGetHiliteRgn(hiliteRgn, hTERec);
|
||||
thePoint.h = thePoint.v = 0;
|
||||
LocalToGlobal(&thePoint);
|
||||
OffsetRgn(hiliteRgn, thePoint.h, thePoint.v);
|
||||
|
||||
DiffRgn(arrowRgn, hiliteRgn, arrowRgn);
|
||||
DiffRgn(arrowRgn, iBeamRgn, arrowRgn);
|
||||
|
||||
DiffRgn(iBeamRgn, hiliteRgn, iBeamRgn);
|
||||
|
||||
if (PtInRgn(theLoc, iBeamRgn)) {
|
||||
SetCursor(*GetCursor(iBeamCursor));
|
||||
CopyRgn(iBeamRgn, theRgn);
|
||||
} else if (PtInRgn(theLoc, hiliteRgn)) {
|
||||
SetCursor(&qd.arrow);
|
||||
CopyRgn(hiliteRgn, theRgn);
|
||||
} else {
|
||||
SetCursor(&qd.arrow);
|
||||
CopyRgn(arrowRgn, theRgn);
|
||||
}
|
||||
|
||||
DisposeRgn(iBeamRgn);
|
||||
DisposeRgn(hiliteRgn);
|
||||
|
||||
} else {
|
||||
SetCursor(&qd.arrow);
|
||||
CopyRgn(arrowRgn, theRgn);
|
||||
}
|
||||
|
||||
DisposeRgn(arrowRgn);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// static void SetScrollRect (void)
|
||||
//=============================================================================
|
||||
// Set Scroll bar rec size
|
||||
//=============================================================================
|
||||
|
||||
void SetScrollRect (void) {
|
||||
/* set the dimensions of the scroll bar in its window */
|
||||
|
||||
// This change fixes the double flash on window resize -EAD
|
||||
|
||||
// MoveControl (vScroll, commandWin->portRect.right - SCROLLER_WIDTH, -1);
|
||||
// SizeControl (vScroll, SCROLLER_WIDTH + 1,
|
||||
// (commandWin->portRect.bottom - commandWin->portRect.top) - (SCROLLER_WIDTH - 2));
|
||||
(*vScroll)->contrlRect.left = gCommandWin->portRect.right - SCROLLER_WIDTH;
|
||||
(*vScroll)->contrlRect.top = -1;
|
||||
(*vScroll)->contrlRect.right = gCommandWin->portRect.right + 1;
|
||||
(*vScroll)->contrlRect.bottom = gCommandWin->portRect.bottom - (SCROLLER_WIDTH - 1);
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// static void AdjustScrollBar (void)
|
||||
//=============================================================================
|
||||
// Set the thumb on scrollbar
|
||||
//=============================================================================
|
||||
|
||||
static void AdjustScrollBar (void) {
|
||||
/* adjust the scroll bar to match the position of the text view */
|
||||
short oldval = GetControlValue (vScroll), oldmax = GetControlMaximum (vScroll);
|
||||
short value, max;
|
||||
short test;
|
||||
|
||||
max = TEXTREC->nLines - linesInView;
|
||||
if ((TEXTREC->teLength > 0) && (*(*TEXTREC->hText + TEXTREC->teLength - 1) == '\r')) max++;
|
||||
if (max < 0) max = 0;
|
||||
if (max != oldmax) SetControlMaximum (vScroll, max);
|
||||
value = (short)((TEXTREC->viewRect.top - TEXTREC->destRect.top) / LINEHEIGHT);
|
||||
// value = roundup ((TEXTREC->viewRect.top - TEXTREC->destRect.top) / LINEHEIGHT);
|
||||
if (value < 0) value = 0; else if (value > max) value = max;
|
||||
if (value != oldval) SetControlValue (vScroll, value);
|
||||
}
|
||||
|
||||
static short roundup (float x) { /* a kludge to round up a float to an int */
|
||||
if (((int) x) != ((int) (x += 0.5))) x += 0.5;
|
||||
return (int) x;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// void DoKeyPress (EventRecord *theEvent)
|
||||
//=============================================================================
|
||||
// Hanlde Keyboard Input
|
||||
//=============================================================================
|
||||
|
||||
void DoKeyPress (EventRecord *theEvent) {
|
||||
short whatKey = theEvent->message & charCodeMask;
|
||||
if (theEvent->modifiers & cmdKey) {
|
||||
long choice;
|
||||
AdjustMenus ();
|
||||
if (choice = MenuKey (theEvent->message)) DoMenu (choice);
|
||||
else if (((whatKey == 'w') || (whatKey == 'W')) && (FrontWindow () == gGraphicsWin))
|
||||
HideGrafWin ();
|
||||
else if (whatKey == LEFTARROW) GoStartOfLine ();
|
||||
else if (whatKey == RIGHTARROW) GoEndOfLine ();
|
||||
else if (whatKey == UPARROW) DoScrollBar (vScroll, - linesInView);
|
||||
else if (whatKey == DOWNARROW) DoScrollBar (vScroll, linesInView);
|
||||
}
|
||||
else if (theEvent->modifiers & optionKey) {
|
||||
if (whatKey == LEFTARROW) GoBackOneWord ();
|
||||
else if (whatKey == RIGHTARROW) GoForwardOneWord ();
|
||||
}
|
||||
else switch (whatKey) {
|
||||
case PAGEUP: DoScrollBar (vScroll, -linesInView); break;
|
||||
case PAGEDN: DoScrollBar (vScroll, linesInView); break;
|
||||
case HOMEKEY: DoScrollBar (vScroll, INT_MIN); break;
|
||||
case ENDKEY: DoScrollBar (vScroll, INT_MAX); break;
|
||||
case FNKEY: break;
|
||||
case HELPKEY: break;
|
||||
default: recentChar = theEvent->message & charCodeMask;
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// static void DrawOnlyGrowIcon (WindowPtr window)
|
||||
//=============================================================================
|
||||
// draw growbox on command window with no scoll bars
|
||||
//=============================================================================
|
||||
|
||||
static void DrawOnlyGrowIcon (WindowPtr window)
|
||||
{
|
||||
RgnHandle saveRgn;
|
||||
Rect growRect;
|
||||
|
||||
growRect = window->portRect;
|
||||
growRect.top = growRect.bottom - SCROLLER_WIDTH;
|
||||
growRect.left = growRect.right - SCROLLER_WIDTH;
|
||||
GetClip (saveRgn = NewRgn ());
|
||||
ClipRect (&growRect);
|
||||
DrawGrowIcon (window);
|
||||
SetClip (saveRgn);
|
||||
DisposeRgn (saveRgn);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// void SetSelection (short start, short end)
|
||||
//=============================================================================
|
||||
// set text selection in the command window
|
||||
//=============================================================================
|
||||
|
||||
void SetSelection (short start, short end) {
|
||||
TEXTREC->clikStuff = 255; /* to make sure the caret appears at the start of a line when it should */
|
||||
/* see tech note "TextEdit EOL Ambiguity" for more information */
|
||||
TESetSelect (start, end, hTERec);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// static void CancelFlash (void)
|
||||
//=============================================================================
|
||||
// cancel the matching-paren flashing
|
||||
//=============================================================================
|
||||
|
||||
static void CancelFlash (void) {
|
||||
if (flashTime) {
|
||||
flashTime = 0;
|
||||
SetSelection (cursorBeforeFlash, cursorBeforeFlash);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// static void StopPasting (void)
|
||||
//=============================================================================
|
||||
// clean up after finishing a paste
|
||||
//=============================================================================
|
||||
|
||||
void StopPasting (void) {
|
||||
pastedLength = 0;
|
||||
if (pastedTextH) {
|
||||
DisposeHandle (pastedTextH);
|
||||
pastedTextH = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// static void DoStyle (int whatStyle)
|
||||
//=============================================================================
|
||||
// set the text to a certain style
|
||||
//=============================================================================
|
||||
|
||||
static void DoStyle (int whatStyle) {
|
||||
TESetStyle (doFace, &(textStyle[whatStyle]), false, hTERec);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// static void FlushOutput (void)
|
||||
//=============================================================================
|
||||
// clear out the output buffer, dumping its contents to the window
|
||||
//=============================================================================
|
||||
|
||||
void FlushOutput (void) {
|
||||
short totalLines, scrollAmount, max;
|
||||
|
||||
if (outputBufferLength == 0) return;
|
||||
CancelFlash ();
|
||||
DoStyle (plainStyle);
|
||||
HLock (hOutputBuffer);
|
||||
TEInsert (*hOutputBuffer, outputBufferLength, hTERec);
|
||||
HUnlock (hOutputBuffer);
|
||||
outputBufferLength = 0;
|
||||
|
||||
if (TEXTREC->teLength > SCROLLBACK_THRESHHOLD) {
|
||||
/* make sure TE record isn't too long */
|
||||
#ifdef ORIGINALCODE
|
||||
/* I replaced this because Nyquist was crashing after the
|
||||
buffer got filled. The replacement below is simpler and
|
||||
eliminates the crashes, although it probably could cause
|
||||
problems by clearing the selection.
|
||||
*/
|
||||
int i = 1, newLength;
|
||||
TEPtr textPtr;
|
||||
while ((TEXTREC->teLength - TEXTREC->lineStarts[i]) >
|
||||
(SCROLLBACK_THRESHHOLD - DELETE_BLOCK)) i++;
|
||||
i = TEXTREC->lineStarts[i];
|
||||
newLength = TEXTREC->teLength - i;
|
||||
textPtr = (TEPtr)(*(TEXTREC->hText));
|
||||
BlockMoveData ((Ptr)((long)textPtr + i), textPtr, newLength);
|
||||
SetHandleSize (TEXTREC->hText, newLength);
|
||||
TEXTREC->destRect.top += LINEHEIGHT;
|
||||
TECalText (hTERec);
|
||||
TEUpdate (&(TEXTREC->viewRect), hTERec);
|
||||
#else
|
||||
/* find the line start after DELETE_BLOCK */
|
||||
int i = 1;
|
||||
while (TEXTREC->lineStarts[i] < DELETE_BLOCK) i++;
|
||||
TESetSelect(0, TEXTREC->lineStarts[i], hTERec);
|
||||
TEDelete(hTERec);
|
||||
/* after deletion, put cursor back at end of buffer */
|
||||
TESetSelect(TEXTREC->teLength, TEXTREC->teLength, hTERec);
|
||||
#endif
|
||||
}
|
||||
TESelView (hTERec);
|
||||
AdjustScrollBar ();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// void PrepareForInput (void)
|
||||
//=============================================================================
|
||||
// get ready to take input
|
||||
//=============================================================================
|
||||
|
||||
void PrepareForInput (void) {
|
||||
FlushOutput ();
|
||||
cmdStart = TEXTREC->selStart;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// static void DeleteRange (void)
|
||||
//=============================================================================
|
||||
// delete the selected range of text, updating cmdStart as necessary
|
||||
//=============================================================================
|
||||
|
||||
void DeleteRange (void) {
|
||||
if (TEXTREC->selEnd <= cmdStart) return;
|
||||
if (TEXTREC->selStart < cmdStart) SetSelection (cmdStart, TEXTREC->selEnd);
|
||||
TEDelete (hTERec);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// static void CopyThisLineToEnd (void)
|
||||
//=============================================================================
|
||||
// copy the line the caret is on to the end
|
||||
//=============================================================================
|
||||
|
||||
static void CopyThisLineToEnd (void) {
|
||||
char *buffer;
|
||||
short b, i, caretOffset;
|
||||
|
||||
/* first find out exactly where it starts */
|
||||
i = TEXTREC->nLines-1; /* first find which line */
|
||||
while (TEXTREC->selStart < TEXTREC->lineStarts[i]) i--;
|
||||
while ((i > 0) && ((*(TEXTREC->hText))[TEXTREC->lineStarts[i]-1] != '\r'))
|
||||
i--; /* for wrapped lines */
|
||||
i = TEXTREC->lineStarts[i]; /* now zero in on the exact character where it begins */
|
||||
while ((TEXTCHAR(i) >= '0') && (TEXTCHAR(i) <= '9')) i++; /* skip error level */
|
||||
if ((TEXTCHAR(i) == '>') && (TEXTCHAR(i+1) == ' ')) i+=2; /* get rid of leading prompt */
|
||||
|
||||
caretOffset = TEXTREC->selStart - i; /* how many characters in is the caret? */
|
||||
|
||||
/* now put the line into the buffer */
|
||||
b = 0;
|
||||
while ((TEXTCHAR(i+b) != '\r') && (i+b < TEXTREC->teLength)) b++; /* find the end of the line */
|
||||
buffer = (char *) NewPtr (b);
|
||||
BlockMoveData (*TEXTREC->hText + i, buffer, b);
|
||||
buffer[b] = '\0';
|
||||
|
||||
/* delete whatever's already on the last line */
|
||||
SetSelection (cmdStart, TEXTREC->teLength);
|
||||
TEDelete (hTERec);
|
||||
|
||||
DoStyle (boldStyle);
|
||||
TEInsert (buffer, b, hTERec);
|
||||
DisposePtr (buffer);
|
||||
|
||||
if (caretOffset < 0) caretOffset = b;
|
||||
SetSelection (cmdStart + caretOffset, cmdStart + caretOffset);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Next four functions possition cursor in text
|
||||
//=============================================================================
|
||||
|
||||
static void GoStartOfLine (void) {
|
||||
short whichLine = TEXTREC->nLines - 1; /* look for the caret; start at the end and go up */
|
||||
while (TEXTREC->lineStarts[whichLine] > TEXTREC->selStart) whichLine--;
|
||||
SetSelection (TEXTREC->lineStarts[whichLine], TEXTREC->lineStarts[whichLine]);
|
||||
AdjustScrollBar ();
|
||||
}
|
||||
|
||||
static void GoEndOfLine (void) {
|
||||
short whichLine = TEXTREC->nLines - 1; /* look for the caret; start at the end and go up */
|
||||
while (TEXTREC->lineStarts[whichLine] > TEXTREC->selStart) whichLine--;
|
||||
if (whichLine == TEXTREC->nLines - 1)
|
||||
SetSelection (TEXTREC->teLength, TEXTREC->teLength);
|
||||
else SetSelection (TEXTREC->lineStarts[whichLine+1] - 1, TEXTREC->lineStarts[whichLine+1] - 1);
|
||||
AdjustScrollBar ();
|
||||
}
|
||||
|
||||
static void GoBackOneWord (void) {
|
||||
short i = TEXTREC->selStart;
|
||||
while ((i > 0) && !isalnum (TEXTCHAR(i-1))) i--;
|
||||
while ((i > 0) && isalnum (TEXTCHAR(i-1))) i--;
|
||||
SetSelection (i, i);
|
||||
}
|
||||
|
||||
static void GoForwardOneWord (void) {
|
||||
short i = TEXTREC->selStart;
|
||||
while ((i < TEXTREC->teLength) && !isalnum (TEXTCHAR(i))) i++;
|
||||
while ((i < TEXTREC->teLength) && isalnum (TEXTCHAR(i))) i++;
|
||||
SetSelection (i, i);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// static void EditFreely (void)
|
||||
//=============================================================================
|
||||
// Enter text into the command windows
|
||||
//=============================================================================
|
||||
|
||||
static void EditFreely (void) {
|
||||
Boolean done;
|
||||
do {
|
||||
done = false;
|
||||
DoEvent ();
|
||||
if (pastedLength > 0) { /* if there is still text to paste, paste it */
|
||||
int i = 0;
|
||||
CancelFlash ();
|
||||
if (TEXTREC->selStart < cmdStart) StopPasting ();
|
||||
else {
|
||||
while ((i < pastedLength) && (((char *)(*pastedTextH))[i] != '\r')) i++;
|
||||
DoStyle (boldStyle);
|
||||
TEInsert (*pastedTextH, i, hTERec);
|
||||
AdjustScrollBar ();
|
||||
if (i < pastedLength) { /* we were stopped by a carriage return, so eat it */
|
||||
i++;
|
||||
done = true;
|
||||
}
|
||||
pastedLength -= i;
|
||||
if (pastedLength > 0) {
|
||||
BlockMoveData ((Ptr)((long)(*pastedTextH) + i), *pastedTextH, pastedLength);
|
||||
SetHandleSize (pastedTextH, pastedLength);
|
||||
} else StopPasting ();
|
||||
}
|
||||
}
|
||||
else if (recentChar) { /* if the last event got us a character, process it */
|
||||
int i;
|
||||
Boolean wasOnLastLine;
|
||||
CancelFlash ();
|
||||
|
||||
if ((TEXTREC->selEnd <= cmdStart) && (TEXTREC->selStart != TEXTREC->selEnd)) continue;
|
||||
if (TEXTREC->selStart < cmdStart) SetSelection (cmdStart, TEXTREC->selEnd);
|
||||
wasOnLastLine = (TEXTREC->selStart >= cmdStart);
|
||||
|
||||
if ((recentChar & 0xfc) == 0x1c) { /* was this an arrow key? */
|
||||
TEXTREC->clikStuff = 255; /* to make sure the caret appears where it should */
|
||||
TEKey (recentChar, hTERec);
|
||||
AdjustScrollBar ();
|
||||
continue;
|
||||
}
|
||||
if (!wasOnLastLine) CopyThisLineToEnd ();
|
||||
switch (recentChar) {
|
||||
case FWDDEL:
|
||||
if (TEXTREC->selStart != TEXTREC->selEnd) DeleteRange ();
|
||||
else if ((TEXTREC->selStart >= cmdStart) && (TEXTREC->selStart < TEXTREC->teLength)) {
|
||||
TEDeactivate (hTERec);
|
||||
SetSelection (TEXTREC->selStart, TEXTREC->selStart + 1);
|
||||
TEDelete (hTERec);
|
||||
if (FrontWindow () == gCommandWin) TEActivate (hTERec);
|
||||
}
|
||||
break;
|
||||
case CLRKEY:
|
||||
if (TEXTREC->selStart != TEXTREC->selEnd) DeleteRange ();
|
||||
break;
|
||||
case DELETE:
|
||||
if (TEXTREC->selStart != TEXTREC->selEnd) DeleteRange ();
|
||||
else if (TEXTREC->selStart > cmdStart) {
|
||||
TEXTREC->clikStuff = 255; /* to make sure the caret appears where it should */
|
||||
TEKey (DELETE, hTERec);
|
||||
}
|
||||
break;
|
||||
case RETURN:
|
||||
if (wasOnLastLine) done = true;
|
||||
break;
|
||||
case ENTER: /* ENTER ends command no matter what */
|
||||
done = true;
|
||||
break;
|
||||
default:
|
||||
DoStyle (boldStyle);
|
||||
TEXTREC->clikStuff = 255; /* to make sure the caret appears where it should */
|
||||
TEKey (recentChar, hTERec);
|
||||
if ((recentChar == ')') && (TEXTREC->selStart > cmdStart)) {
|
||||
short parenCount = -1;
|
||||
Boolean inQuotes = false;
|
||||
i = TEXTREC->selStart - 1;
|
||||
while ((--i >= cmdStart) && (parenCount != 0))
|
||||
switch ((*TEXTREC->hText)[i]) {
|
||||
case DBLQUOTE: inQuotes = !inQuotes; break;
|
||||
case '(': if (!inQuotes) parenCount++; break;
|
||||
case ')': if (!inQuotes) parenCount--; break;
|
||||
}
|
||||
if (parenCount == 0) {
|
||||
cursorBeforeFlash = TEXTREC->selStart;
|
||||
SetSelection (i+1, i+2); /* flash the matching open-paren */
|
||||
flashTime = 10;
|
||||
}
|
||||
} else if ((recentChar == DBLQUOTE) && (TEXTREC->selStart > cmdStart)) {
|
||||
i = TEXTREC->selStart - 1;
|
||||
while ((--i >= cmdStart) && ((*TEXTREC->hText)[i] != DBLQUOTE)) ;
|
||||
if ((*TEXTREC->hText)[i] == DBLQUOTE) {
|
||||
cursorBeforeFlash = TEXTREC->selStart;
|
||||
SetSelection (i, i+1); /* flash the matching double-quote */
|
||||
flashTime = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
AdjustScrollBar ();
|
||||
}
|
||||
} while (!done);
|
||||
}
|
||||
|
||||
char *macgets (void) {
|
||||
/* retrieve a typed character */
|
||||
/* Note that this uses some extensive (and clever, if I may say so myself) buffering. */
|
||||
int i, b, bufSize;
|
||||
char *ptr, *buffer;
|
||||
Boolean done, onLastLine;
|
||||
|
||||
PrepareForInput ();
|
||||
do { /* repeat until a full expression has been typed */
|
||||
EditFreely (); /* allow free editing for a while */
|
||||
|
||||
/* Now, we have a complete command to parse, if and only if: */
|
||||
/* - the cursor was on the last line when the user pressed Return or Enter, and */
|
||||
/* - the user either pressed Enter, or else every '(' since the beginning */
|
||||
/* of the command is matched by a ')'. */
|
||||
/* Quoting is watched for. ( ") is not a complete expression. */
|
||||
|
||||
done = true;
|
||||
if (TEXTREC->selStart != TEXTREC->teLength) /* if we're not at the end already */
|
||||
SetSelection (TEXTREC->teLength, TEXTREC->teLength); /* send cursor to end */
|
||||
TEXTREC->clikStuff = 255; /* to make sure the caret appears where it should */
|
||||
TEKey ('\r', hTERec);
|
||||
|
||||
/* check and see if we've completed the command yet */
|
||||
if (recentChar != ENTER) {
|
||||
Boolean inQuotes = false;
|
||||
short parenCount = 0;
|
||||
for (i = cmdStart; i < TEXTREC->teLength; i++)
|
||||
switch ((*TEXTREC->hText)[i]) {
|
||||
case DBLQUOTE: inQuotes = !inQuotes; break;
|
||||
case '(': if (!inQuotes) parenCount++; break;
|
||||
case ')': if (!inQuotes) parenCount--; break;
|
||||
}
|
||||
if ((parenCount > 0) || inQuotes) done = false;
|
||||
}
|
||||
|
||||
AdjustScrollBar ();
|
||||
} while (!done);
|
||||
|
||||
/* put the entire command into the buffer, and return it */
|
||||
bufSize = TEXTREC->teLength - cmdStart;
|
||||
buffer = (char *) NewPtr (bufSize + 1);
|
||||
BlockMoveData (*TEXTREC->hText + cmdStart, buffer, bufSize);
|
||||
buffer[bufSize] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void macputc (int ch) {
|
||||
/* put a char into the output buffer, and flush the buffer if necessary */
|
||||
switch (ch) {
|
||||
case '\t':
|
||||
do { macputc (' '); } while (cursorPos & 7);
|
||||
break;
|
||||
case DELETE:
|
||||
if (cursorPos) cursorPos--; /* and fall through to default */
|
||||
default:
|
||||
if (outputBufferLength == MAX_BUF) FlushOutput ();
|
||||
if (ch == '\n') {
|
||||
cursorPos = 0;
|
||||
(*hOutputBuffer)[outputBufferLength++] = '\r';
|
||||
} else {
|
||||
cursorPos++;
|
||||
(*hOutputBuffer)[outputBufferLength++] = ch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void macputs (char *s) {
|
||||
/* for completeness */
|
||||
while (*s) macputc (*s++);
|
||||
}
|
||||
|
||||
void scrflush (void) {
|
||||
extern void osflush (void);
|
||||
/* clear out everything */
|
||||
FlushOutput ();
|
||||
osflush ();
|
||||
}
|
||||
|
||||
void scrclear (void) {
|
||||
/* clear text window -- not implemented */
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// static void UpdateCmdWindow (void)
|
||||
//=============================================================================
|
||||
// main command window update procedure
|
||||
//=============================================================================
|
||||
|
||||
|
||||
void UpdateCmdWindow (void) {
|
||||
long textBottom;
|
||||
Rect tempRect;
|
||||
|
||||
InvalRect (&(gCommandWin->portRect));
|
||||
BeginUpdate (gCommandWin);
|
||||
BlockMoveData(&(gCommandWin->portRect), &tempRect, sizeof(Rect));
|
||||
tempRect.right -= SCROLLER_WIDTH;
|
||||
EraseRect (&tempRect);
|
||||
if (gCommandWinResized) {
|
||||
TEXTREC->viewRect = SetTERect ();
|
||||
TEXTREC->destRect.right = TEXTREC->viewRect.right;
|
||||
TECalText (hTERec);
|
||||
SetScrollRect ();
|
||||
gCommandWinResized = false;
|
||||
}
|
||||
DrawOnlyGrowIcon (gCommandWin);
|
||||
FlushOutput ();
|
||||
|
||||
TEXTREC->viewRect = SetTERect (); /* adjust for possible change in height of status line */
|
||||
|
||||
textBottom = TEXTREC->destRect.top + (TEXTREC->nLines * LINEHEIGHT);
|
||||
if (TEXTREC->destRect.top > TEXTREC->viewRect.top)
|
||||
TEScroll (0, (TEXTREC->viewRect.top - TEXTREC->destRect.top), hTERec);
|
||||
|
||||
if (TEXTREC->destRect.top < TEXTREC->viewRect.top) { /* make sure we don't get fractions of lineheights */
|
||||
int amountOffTheTop = TEXTREC->viewRect.top - TEXTREC->destRect.top;
|
||||
if (amountOffTheTop % LINEHEIGHT) TEScroll (0, amountOffTheTop % LINEHEIGHT, hTERec);
|
||||
}
|
||||
TEUpdate (&(TEXTREC->viewRect), hTERec);
|
||||
AdjustScrollBar ();
|
||||
UpdateControls (gCommandWin, gCommandWin->visRgn);
|
||||
EndUpdate (gCommandWin);
|
||||
}
|
||||
|
||||
void ActivateCmdWindow(void)
|
||||
{
|
||||
TEActivate (hTERec);
|
||||
HiliteControl (vScroll, 0);
|
||||
DrawOnlyGrowIcon (gCommandWin);
|
||||
}
|
||||
|
||||
void DeactivateCmdWindow(void)
|
||||
{
|
||||
TEDeactivate (hTERec);
|
||||
HiliteControl (vScroll, 255);
|
||||
DrawOnlyGrowIcon (gCommandWin);
|
||||
}
|
||||
|
||||
void InitalizeCmdWindow(void)
|
||||
{
|
||||
|
||||
/* setup the font, size and writing mode for the command window */
|
||||
TextFont (kFontIDMonaco);
|
||||
TextSize (9);
|
||||
TextFace (0);
|
||||
TextMode (srcCopy);
|
||||
textStyle[plainStyle].tsFace = 0;
|
||||
textStyle[boldStyle].tsFace = bold;
|
||||
|
||||
currentStyle = plainStyle;
|
||||
|
||||
{ /* set up scroll bar */
|
||||
Rect scrollRect;
|
||||
vScroll = NewControl (gCommandWin, &scrollRect, "\p", 0, 0, 0, 0, scrollBarProc, 0L);
|
||||
SetScrollRect ();
|
||||
ShowControl (vScroll);
|
||||
}
|
||||
|
||||
{ /* set up command text record */
|
||||
Rect teRect = SetTERect ();
|
||||
hTERec = (TEHandle)TEStyleNew (&teRect, &teRect);
|
||||
TECalText (hTERec);
|
||||
TEAutoView (true, hTERec);
|
||||
TESetClickLoop (uppScrollClickLoop, hTERec);
|
||||
TEActivate (hTERec);
|
||||
}
|
||||
|
||||
hOutputBuffer = NewHandle (MAX_BUF); /* a handle to a buffer for text to be displayed */
|
||||
}
|
||||
|
||||
void CleanupCmdWindow(void)
|
||||
{
|
||||
StopPasting ();
|
||||
CloseWindow (gCommandWin);
|
||||
TEDispose (hTERec);
|
||||
DisposeHandle (hOutputBuffer);
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
/* MacCommandWin.h -- headers for more mac stuff */
|
||||
|
||||
void SetSelection (short start, short end);
|
||||
void macputc(int ch);
|
||||
void macputs(char *s);
|
||||
void PrepareForInput(void);
|
||||
void InitalizeCmdWindow(void);
|
||||
void UpdateCmdWindow(void);
|
||||
void StopPasting(void);
|
||||
void DeleteRange(void);
|
||||
void scrflush(void);
|
||||
void SetScrollRect(void);
|
||||
void AdjustCursor(Point theLoc, RgnHandle theRgn);
|
||||
void DoKeyPress(EventRecord *theEvent);
|
||||
void ActivateCmdWindow(void);
|
||||
void DeactivateCmdWindow(void);
|
||||
void CleanupCmdWindow(void);
|
|
@ -0,0 +1,3 @@
|
|||
/* MacDrag.h -- drag text */
|
||||
|
||||
Boolean DragText(EventRecord *ev);
|
|
@ -0,0 +1,81 @@
|
|||
// Routines that deal with some mac file system stuff -EAD
|
||||
|
||||
#include <Files.h>
|
||||
#include <TextUtils.h>
|
||||
#include <string.h>
|
||||
//#include "MiscellaneousUtilities.h"
|
||||
|
||||
//=========================================================================
|
||||
// Function prototypes
|
||||
//=========================================================================
|
||||
|
||||
void set_mac_file_type(char *filename);
|
||||
void GetFullPath(FSSpec *theSpec, StringPtr theName);
|
||||
void PathNameFromDirID(long dirID, short vRefNum, StringPtr fullPathName);
|
||||
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// Set the output soundfile type and creator
|
||||
//=========================================================================
|
||||
|
||||
void set_mac_file_type(char *filename)
|
||||
{
|
||||
Str255 fName;
|
||||
FSSpec fSpec;
|
||||
FInfo fFInfo;
|
||||
|
||||
fFInfo.fdType = 'AIFF';
|
||||
fFInfo.fdCreator = 'Sd2a';
|
||||
|
||||
BlockMoveData(filename, &fName[1], 256);
|
||||
fName[0] = strlen(filename);
|
||||
FSMakeFSSpec(0, 0, fName, &fSpec);
|
||||
FSpSetFInfo(&fSpec, &fFInfo);
|
||||
}
|
||||
|
||||
//==================================================================================================================================
|
||||
// void GetFullPath(FSSpec *theSpec, StringPtr theName)
|
||||
//==================================================================================================================================
|
||||
// Extracts the full pathname for the file pointed to by theSpec and returns it in theName.
|
||||
//==================================================================================================================================
|
||||
|
||||
void GetFullPath(FSSpec *theSpec, StringPtr theName)
|
||||
{
|
||||
*theName = 0;
|
||||
if (theSpec->parID != 1) PathNameFromDirID(theSpec->parID, theSpec->vRefNum, theName);
|
||||
// was: pstrcat(theName, theSpec->name);
|
||||
strcat(P2CStr(theName), P2CStr(theSpec->name));
|
||||
C2PStr((char *) theName);
|
||||
C2PStr((char *) theSpec->name);
|
||||
//pstrcat(theName, "\p:");
|
||||
theName[*theName + 1] = 0;
|
||||
}
|
||||
|
||||
//==================================================================================================================================
|
||||
// void PathNameFromDirID(long dirID, short vRefNum, StringPtr fullPathName)
|
||||
//==================================================================================================================================
|
||||
// Given a vRefNum and a directory ID, creates a full path specification.
|
||||
//==================================================================================================================================
|
||||
|
||||
void PathNameFromDirID(long dirID, short vRefNum, StringPtr fullPathName)
|
||||
{
|
||||
Str255 directoryName;
|
||||
DirInfo block;
|
||||
OSErr err;
|
||||
fullPathName[0] = 0;
|
||||
block.ioDrDirID = block.ioDrParID = dirID;
|
||||
block.ioNamePtr = directoryName;
|
||||
do {
|
||||
block.ioVRefNum = vRefNum;
|
||||
block.ioFDirIndex = -1;
|
||||
block.ioDrDirID = block.ioDrParID;
|
||||
err = PBGetCatInfo((CInfoPBPtr)&block, false);
|
||||
//pstrcat(directoryName, (StringPtr)"\p:");
|
||||
//pstrinsert(fullPathName, directoryName);
|
||||
strcat(P2CStr(directoryName), ":");
|
||||
strcat((char *) directoryName, (char *) fullPathName);
|
||||
strcpy((char *)fullPathName, (char *) directoryName);
|
||||
} while (block.ioDrDirID != 2);
|
||||
C2PStr((char *) fullPathName);
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
/* MacFileUtils.h -- more mac stuff */
|
||||
|
||||
void GetFullPath(FSSpec *theSpec, StringPtr theName);
|
|
@ -0,0 +1,50 @@
|
|||
// Window pointers
|
||||
|
||||
extern WindowPtr gCommandWin, gGraphicsWin;
|
||||
|
||||
extern Boolean gCommandWinResized;
|
||||
|
||||
|
||||
|
||||
// Menu Handles
|
||||
|
||||
extern MenuHandle appleMenu, fileMenu, editMenu, controlMenu;
|
||||
|
||||
|
||||
|
||||
// The command window text handle
|
||||
|
||||
extern TEHandle hTERec;
|
||||
|
||||
#define TEXTREC (*hTERec)
|
||||
|
||||
#define TEXTCHAR(i) ((*(TEXTREC->hText))[i])
|
||||
|
||||
|
||||
|
||||
// more comand window text stuff
|
||||
|
||||
extern CharsHandle pastedTextH; /* a handle to pasted text */
|
||||
|
||||
extern int pastedLength; /* how many chars there are in the paste buffer */
|
||||
|
||||
extern int outputBufferLength;
|
||||
|
||||
extern Rect dragRect, sizeRect;
|
||||
|
||||
extern int flashTime, cursorBeforeFlash;
|
||||
|
||||
extern char recentChar; /* the last character typed */
|
||||
|
||||
|
||||
|
||||
// Allocate space for UPPs
|
||||
|
||||
extern ControlActionUPP uppScrollProc;
|
||||
|
||||
extern TEClickLoopUPP uppScrollClickLoop;
|
||||
|
||||
|
||||
|
||||
extern Boolean gInBackground;
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
#include <MacTypes.h>
|
||||
#include <Quickdraw.h>
|
||||
#include <Windows.h>
|
||||
#include <Controls.h>
|
||||
#include <ToolUtils.h>
|
||||
#include "macint.h"
|
||||
|
||||
extern WindowPtr gCommandWin, gGraphicsWin;
|
||||
extern Boolean gCommandWinResized;
|
||||
extern Rect dragRect, sizeRect;
|
||||
|
||||
//=============================================================================
|
||||
// Hanlde Mouse Down Events
|
||||
//=============================================================================
|
||||
|
||||
void DoMouseDown (EventRecord *theEvent) {
|
||||
WindowPtr whichWindow;
|
||||
short int thePart = FindWindow (theEvent->where, &whichWindow);
|
||||
|
||||
switch (thePart) {
|
||||
case inSysWindow:
|
||||
SystemClick (theEvent, whichWindow);
|
||||
break;
|
||||
case inDrag:
|
||||
DragWindow (whichWindow, theEvent->where, &dragRect);
|
||||
break;
|
||||
case inMenuBar: {
|
||||
long choice;
|
||||
AdjustMenus ();
|
||||
choice = MenuSelect (theEvent->where);
|
||||
if (choice) DoMenu (choice);
|
||||
break;
|
||||
}
|
||||
case inGoAway:
|
||||
if ((whichWindow == gGraphicsWin)
|
||||
&& (TrackGoAway (whichWindow, theEvent->where)))
|
||||
HideGrafWin ();
|
||||
break;
|
||||
case inContent:
|
||||
if ((FrontWindow () == gCommandWin) && (whichWindow == gCommandWin))
|
||||
DoContent (theEvent);
|
||||
else SelectWindow (whichWindow);
|
||||
break;
|
||||
case inGrow:
|
||||
case inZoomIn:
|
||||
case inZoomOut: {
|
||||
long newSize;
|
||||
GrafPtr oldPort;
|
||||
if (thePart == inGrow) newSize = GrowWindow (whichWindow, theEvent->where, &sizeRect);
|
||||
if (((thePart == inGrow) && newSize)
|
||||
|| ((thePart != inGrow) && TrackBox (whichWindow, theEvent->where, thePart))) {
|
||||
GetPort (&oldPort);
|
||||
SetPort (whichWindow);
|
||||
EraseRect (&whichWindow->portRect);
|
||||
if (thePart == inGrow) SizeWindow (whichWindow, LoWord (newSize), HiWord (newSize), -1);
|
||||
else ZoomWindow (whichWindow, thePart, 0);
|
||||
gCommandWinResized = true;
|
||||
InvalRect (&whichWindow->portRect);
|
||||
SetPort (oldPort);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
/* MacHandelEv.h -- event handlers */
|
||||
|
||||
void DoMouseDown(EventRecord *theEvent);
|
|
@ -0,0 +1,69 @@
|
|||
README.txt -- information on Nyquist for Mac OS X
|
||||
|
||||
Installation
|
||||
------------
|
||||
The simplest way to install and run Nyquist is to get the pre-compiled
|
||||
NyquistIDE application, which includes executables, documentation, and
|
||||
libraries all in one package.
|
||||
|
||||
When the pre-compiled package is uncompressed, it produces two directories:
|
||||
nyquist
|
||||
NyquistIDE.app
|
||||
You should always keep these together. The nyquist directory initially
|
||||
contains documentation, but when NyquistIDE.app is run, the nyquist
|
||||
folder is also populated with links to the lib and demos folders,
|
||||
which contain example code and more documentation. The symbolic links
|
||||
allow you to easily find these files.
|
||||
|
||||
You can copy both nyquist and NyquistIDE.app to the /Applications folder
|
||||
if you wish, and you can add NyquistIDE.app to the Dock.
|
||||
|
||||
You will probably run Nyquist using the NyquistIDE application, but
|
||||
you can also run nyquist from the command line. The executable is
|
||||
located in
|
||||
|
||||
NyquistIDE.app/Contents/Resources/Java/ny
|
||||
|
||||
To run from the command line, you will need to set the XLISPPATH
|
||||
environment variable using this command line (if you use the C shell,
|
||||
e.g. csh):
|
||||
|
||||
setenv XLISPPATH `pwd`/runtime:`pwd`/lib
|
||||
|
||||
If you use the bash shell, use:
|
||||
|
||||
export XLISPPATH=`pwd`/runtime:`pwd`/lib
|
||||
|
||||
Note that this sets XLISPPATH in the environment of the current
|
||||
command line shell. If you exit the shell or switch to another shell,
|
||||
the XLISPPATH variable will not be set. Your shell reads an
|
||||
initialization file when it starts. You can add the XLISPPATH
|
||||
initialization command to this file if you want the variable to be set
|
||||
automatically in every instance of your command line shell.
|
||||
|
||||
On the topic of the XLISPPATH, note that this variable is set by
|
||||
NyquistIDE when running with that application, overriding any other
|
||||
value. You can extend the search path by creating the file xlisppath
|
||||
in the same directory as the nyquist executable ny. The xlisppath file
|
||||
should have colon-separated paths on a single line of text.
|
||||
|
||||
You can also build Nyquist from sources, as described below.
|
||||
|
||||
|
||||
How To Build Nyquist on Mac OS X
|
||||
--------------------------------
|
||||
You need to install Xcode, Apple's free software development system
|
||||
for OS X.
|
||||
|
||||
Xcode 4.3.2 and later
|
||||
-------
|
||||
The nyquist project for Xcode v4 is in nyquist/macosxproject/nyquist.xcodeproj
|
||||
|
||||
To build Nyquist or NyquistIDE:
|
||||
- Open nyquist.wxworkspace in Xcode
|
||||
- Set the active target to "Nyquist" or "NyquistIDE"
|
||||
- Click on "build active target"
|
||||
- ny or NyquistIDE will be produced in a temporary folder managed by Xcode.
|
||||
To find the files Right click on the Products/NyquistIDE.app of the project
|
||||
navigator, and select "reveal in finder".
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
/* macaboutbox.c - Display the "about box" of the application. */
|
||||
/* Written by Brian Kendig. */
|
||||
/* The functions here are only used by macint.c. */
|
||||
|
||||
//#include <THINK.h>
|
||||
#include <Dialogs.h>
|
||||
#include <Fonts.h>
|
||||
#include <Menus.h>
|
||||
#include <Quickdraw.h>
|
||||
#include <Resources.h>
|
||||
#include <ToolUtils.h>
|
||||
#include <Traps.h>
|
||||
#include <Windows.h>
|
||||
#include "macint.h"
|
||||
#define NIL ((void *) 0)
|
||||
|
||||
static DialogPtr aboutBox;
|
||||
extern Boolean hasColorQD;
|
||||
|
||||
static enum {
|
||||
theOKButton = 1,
|
||||
theOKOutline = 2,
|
||||
theIcon = 3,
|
||||
theName = 4,
|
||||
theAboutText = 5,
|
||||
theCopyright = 6
|
||||
} ;
|
||||
|
||||
pascal void DrawOKOutline (WindowPtr dialogWindow, short theItem) {
|
||||
PenState oldPen;
|
||||
short iType;
|
||||
Handle iHandle;
|
||||
Rect iRect;
|
||||
|
||||
GetPenState (&oldPen);
|
||||
PenNormal ();
|
||||
PenSize (3,3);
|
||||
|
||||
GetDialogItem (aboutBox, theOKButton, &iType, &iHandle, &iRect);
|
||||
InsetRect (&iRect, -4, -4);
|
||||
FrameRoundRect (&iRect, 16, 16);
|
||||
|
||||
SetPenState (&oldPen);
|
||||
}
|
||||
|
||||
pascal void DrawIcon (WindowPtr dialogWindow, short theItem) {
|
||||
short iType;
|
||||
Handle iHandle;
|
||||
Rect iRect;
|
||||
|
||||
GetDialogItem (aboutBox, theIcon, &iType, &iHandle, &iRect);
|
||||
PlotIcon (&iRect, GetResource ('ICN#', 128));
|
||||
}
|
||||
|
||||
pascal void DrawName (WindowPtr dialogWindow, short theItem) {
|
||||
short iType;
|
||||
Handle iHandle;
|
||||
Rect iRect;
|
||||
Str255 string;
|
||||
|
||||
TextFont (kFontIDHelvetica);
|
||||
TextSize (24);
|
||||
TextFace (0);
|
||||
GetDialogItem (aboutBox, theName, &iType, &iHandle, &iRect);
|
||||
GetIndString (string, STRINGS_RES, 1);
|
||||
TETextBox (string+1, string[0], &iRect, teFlushLeft);
|
||||
}
|
||||
|
||||
pascal void DrawAboutText (WindowPtr dialogWindow, short theItem) {
|
||||
short iType;
|
||||
Handle iHandle;
|
||||
Rect iRect;
|
||||
Str255 string;
|
||||
|
||||
TextFont (kFontIDMonaco);
|
||||
TextSize (9);
|
||||
TextFace (0);
|
||||
GetDialogItem (aboutBox, theAboutText, &iType, &iHandle, &iRect);
|
||||
GetIndString (string, STRINGS_RES, 2);
|
||||
TETextBox (string+1, string[0], &iRect, teFlushLeft);
|
||||
}
|
||||
|
||||
pascal void DrawCopyright (WindowPtr dialogWindow, short theItem) {
|
||||
short iType;
|
||||
Handle iHandle;
|
||||
Rect iRect;
|
||||
Str255 string;
|
||||
|
||||
TextFont (systemFont);
|
||||
TextSize (12);
|
||||
TextFace (0);
|
||||
GetDialogItem (aboutBox, theCopyright, &iType, &iHandle, &iRect);
|
||||
GetIndString (string, STRINGS_RES, 3);
|
||||
TETextBox (string+1, string[0], &iRect, teFlushLeft);
|
||||
}
|
||||
|
||||
void DoAboutBox (void) {
|
||||
short itemType, itemHit = 0;
|
||||
Handle itemHandle;
|
||||
Rect aboutRect;
|
||||
short width, hight;
|
||||
PicHandle aboutPict;
|
||||
|
||||
aboutPict = GetPicture(ABOUT_PICT);
|
||||
aboutRect = (*aboutPict)->picFrame;
|
||||
width = aboutRect.right - aboutRect.left;
|
||||
hight = aboutRect.bottom - aboutRect.top;
|
||||
|
||||
aboutBox = GetNewDialog (ABOUT_BOX, NIL, (WindowPtr) -1);
|
||||
SizeWindow(aboutBox, width, hight, false);
|
||||
|
||||
ShowWindow (aboutBox);
|
||||
SetPort(aboutBox);
|
||||
DrawPicture(aboutPict, &(*aboutPict)->picFrame);
|
||||
|
||||
//itemHit = 0;
|
||||
//while (itemHit != ok) ModalDialog (NIL, &itemHit);
|
||||
while (!Button());
|
||||
|
||||
DisposeDialog (aboutBox);
|
||||
|
||||
FlushEvents(everyEvent, 0); // dmazzoni
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
/* macaboutbox.h -- header for about box implementation */
|
||||
|
||||
void DoAboutBox(void);
|
|
@ -0,0 +1,161 @@
|
|||
#include <Drag.h>
|
||||
#include <Errors.h>
|
||||
#include <TextEdit.h>
|
||||
#include <QuickDraw.h>
|
||||
|
||||
extern TEHandle hTERec;
|
||||
// Handle drag from newswatcher -EAD
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
DragText
|
||||
|
||||
Drag selected text.
|
||||
|
||||
Entry: ev = pointer to mouse down event record.
|
||||
where = location of mouse down event in local coords.
|
||||
theTE = handle to TextEdit record.
|
||||
|
||||
Exit: function result = error code.
|
||||
*dragged =
|
||||
true if text was dragged.
|
||||
false if mouse down was not over text selection, or
|
||||
user did not move the mouse before releasing the
|
||||
mouse button.
|
||||
*trashed = true if text was dragged to trash.
|
||||
----------------------------------------------------------------------------*/
|
||||
extern RgnHandle rgn;
|
||||
//extern EventRecord theEvent;
|
||||
|
||||
Boolean DragText (EventRecord *ev)
|
||||
{
|
||||
DragReference dragRef;
|
||||
OSErr err = noErr;
|
||||
Boolean haveDragRef = false;
|
||||
Handle hText;
|
||||
RgnHandle dragRgn, tempRgn;
|
||||
short selStart, selEnd;
|
||||
char state;
|
||||
Point theLoc;
|
||||
GrafPtr curPort;
|
||||
|
||||
// if (!PtInTEHiliteRgn(where, hTERec)) return noErr;
|
||||
if (!WaitMouseMoved(ev->where)) return noErr;
|
||||
|
||||
GetPort(&curPort);
|
||||
|
||||
CopyRgn(rgn, dragRgn = NewRgn());
|
||||
SetPt(&theLoc, 0, 0);
|
||||
LocalToGlobal(&theLoc);
|
||||
OffsetRgn(dragRgn, theLoc.h, theLoc.v);
|
||||
|
||||
hText = (**hTERec).hText;
|
||||
selStart = (**hTERec).selStart;
|
||||
selEnd = (**hTERec).selEnd;
|
||||
|
||||
err = NewDrag(&dragRef);
|
||||
if (err != noErr) goto exit;
|
||||
haveDragRef = true;
|
||||
state = HGetState(hText);
|
||||
HLock(hText);
|
||||
err = AddDragItemFlavor(dragRef, 1, 'TEXT', *hText + selStart, selEnd - selStart, 0);
|
||||
HSetState(hText, state);
|
||||
if (err != noErr) goto exit;
|
||||
// dragRgn = NewRgn();
|
||||
// err = TEGetHiliteRgn(dragRgn, hTERec);
|
||||
// if (err != noErr) goto exit;
|
||||
// LocalToGlobalRgn(dragRgn);
|
||||
// OutlineRegion(dragRgn);
|
||||
SetDragItemBounds(dragRef, 1, &(**dragRgn).rgnBBox);
|
||||
tempRgn = NewRgn();
|
||||
CopyRgn(dragRgn, tempRgn);
|
||||
InsetRgn(tempRgn, 1, 1);
|
||||
DiffRgn(dragRgn, tempRgn, dragRgn);
|
||||
DisposeRgn(tempRgn);
|
||||
|
||||
err = TrackDrag(dragRef, ev, dragRgn);
|
||||
if (err != noErr && err != userCanceledErr) goto exit;
|
||||
//*trashed = DragTargetWasTrash(dragRef);
|
||||
// DisposeRgn(dragRgn);
|
||||
|
||||
DisposeDrag(dragRef);
|
||||
return true;
|
||||
|
||||
exit:
|
||||
|
||||
if (haveDragRef) DisposeDrag(dragRef);
|
||||
// if (dragRgn != nil) DisposeRgn(dragRgn);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
LocalToGlobalRgn
|
||||
|
||||
Convert a region from local to global coordinates.
|
||||
|
||||
Entry: rgn = handle to region.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void LocalToGlobalRgn (RgnHandle rgn)
|
||||
{
|
||||
Point where;
|
||||
|
||||
SetPt(&where, 0, 0);
|
||||
LocalToGlobal(&where);
|
||||
OffsetRgn(rgn, where.h, where.v);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
OutlineRegion
|
||||
|
||||
Change a region into a tracing of its border which is appropriate
|
||||
for normal dragging.
|
||||
|
||||
Entry: theRgn = handle to region.
|
||||
|
||||
Exit: Region changed to outline of region.
|
||||
|
||||
From Apple "HFS Drag Sample" sample code.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void OutlineRegion (RgnHandle theRgn)
|
||||
{
|
||||
RgnHandle tempRgn;
|
||||
|
||||
tempRgn = NewRgn();
|
||||
CopyRgn(theRgn, tempRgn);
|
||||
InsetRgn(tempRgn, 1, 1);
|
||||
DiffRgn(theRgn, tempRgn, theRgn);
|
||||
DisposeRgn(tempRgn);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
PtInTEHiliteRgn
|
||||
|
||||
Determine whether or not a point is in the current TextEdit hilite
|
||||
region.
|
||||
|
||||
Entry: where = point in local coords.
|
||||
theTE = handle to TextEdit record.
|
||||
|
||||
Exit: function result = true if point is in the hilite region.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
Boolean PtInTEHiliteRgn (Point where, TEHandle theTE)
|
||||
{
|
||||
Boolean result = false;
|
||||
RgnHandle rgn = nil;
|
||||
OSErr err = noErr;
|
||||
|
||||
//if (!HaveTEGetHiliteRgn()) return false;
|
||||
rgn = NewRgn();
|
||||
err = TEGetHiliteRgn(rgn, theTE);
|
||||
if (err != noErr) goto exit;
|
||||
result = PtInRgn(where, rgn);
|
||||
|
||||
exit:
|
||||
|
||||
if (rgn != nil) DisposeRgn(rgn);
|
||||
return result;
|
||||
}
|
|
@ -0,0 +1,222 @@
|
|||
/* macfun.c - macintosh user interface functions for xlisp */
|
||||
/* Written by Brian Kendig. */
|
||||
|
||||
#include <Quickdraw.h>
|
||||
#include <Windows.h>
|
||||
#include <Memory.h>
|
||||
#include "xlisp.h"
|
||||
#include "macint.h"
|
||||
|
||||
/* externals */
|
||||
extern WindowPtr gCommandWin, gGraphicsWin;
|
||||
extern Boolean hasColorQD;
|
||||
extern unsigned long startupTicks;
|
||||
extern void ShowGrafWin (void);
|
||||
|
||||
unsigned long ticks_per_second (void) { return 60; }
|
||||
unsigned long run_tick_count (void) { return ((unsigned long) TickCount ()) - startupTicks; }
|
||||
unsigned long real_tick_count (void) { return (unsigned long) TickCount (); }
|
||||
|
||||
LVAL xrealtime (void) { return cvfixnum ((FIXTYPE)real_tick_count()); } /* get-internal-real-time */
|
||||
LVAL xruntime (void) { return cvfixnum ((FIXTYPE)run_tick_count()); } /* get-internal-run-time */
|
||||
LVAL xtime (void) { return cvfixnum ((FIXTYPE)real_tick_count()); } /* time */
|
||||
|
||||
/* get an integer parameter */
|
||||
LOCAL int getNumber () {
|
||||
LVAL num = xlgafixnum ();
|
||||
return ((int) getfixnum (num));
|
||||
}
|
||||
|
||||
/* handle commands that require integer arguments */
|
||||
LOCAL LVAL GrafCmd (char funct, int nArgs) {
|
||||
short x, y, z;
|
||||
if (nArgs > 0) x = getNumber ();
|
||||
if (nArgs > 1) y = getNumber ();
|
||||
if (nArgs > 2) z = getNumber ();
|
||||
xllastarg ();
|
||||
SetPort (gGraphicsWin);
|
||||
switch (funct) {
|
||||
case 'G': ShowGrafWin (); break;
|
||||
case 'g': HideGrafWin (); break;
|
||||
case 'x': EraseRect (&gGraphicsWin->portRect); break;
|
||||
case 's': ShowPen (); break;
|
||||
case 'h': HidePen (); break;
|
||||
case 'd': PenMode (x); break;
|
||||
case 'M': Move (x, y); break;
|
||||
case 'm': MoveTo (x, y); break;
|
||||
case 'L': Line (x, y); break;
|
||||
case 'l': LineTo (x, y); break;
|
||||
case 'S': PenSize (x, y); break;
|
||||
case 'p': PenNormal (); break;
|
||||
case 'c':
|
||||
if (hasColorQD) {
|
||||
RGBColor col; col.red = x; col.green = y; col.blue = z;
|
||||
RGBForeColor (&col);
|
||||
} break;
|
||||
}
|
||||
SetPort (gCommandWin);
|
||||
return NIL;
|
||||
}
|
||||
|
||||
LVAL xshowgraphics (void) { return GrafCmd ('G', 0); } /* show graphics win */
|
||||
LVAL xhidegraphics (void) { return GrafCmd ('g', 0); } /* hide graphics win */
|
||||
LVAL xcleargraphics (void) { return GrafCmd ('x', 0); } /* clear graphics win */
|
||||
LVAL xshowpen (void) { return GrafCmd ('s', 0); } /* show the pen */
|
||||
LVAL xhidepen (void) { return GrafCmd ('h', 0); } /* hide the pen */
|
||||
LVAL xpenmode (void) { return GrafCmd ('d', 1); } /* set the pen mode */
|
||||
LVAL xmove (void) { return GrafCmd ('M', 2); } /* move pen in a specified direction */
|
||||
LVAL xmoveto (void) { return GrafCmd ('m', 2); } /* move pen to a screen location */
|
||||
LVAL xdraw (void) { return GrafCmd ('L', 2); } /* draw a line in a specified direction */
|
||||
LVAL xdrawto (void) { return GrafCmd ('l', 2); } /* draw a line to a screen location */
|
||||
LVAL xpensize (void) { return GrafCmd ('S', 2); } /* set the pen size */
|
||||
LVAL xpennormal (void) { return GrafCmd ('p', 0); } /* set the pen to normal */
|
||||
LVAL xcolor (void) { return GrafCmd ('c', 3); } /* set RGB color of pen */
|
||||
|
||||
|
||||
LVAL xgetpen (void) { /* get the pen position */
|
||||
LVAL val;
|
||||
Point p;
|
||||
xllastarg ();
|
||||
SetPort ((GrafPtr)gGraphicsWin);
|
||||
GetPen (&p);
|
||||
SetPort (gCommandWin);
|
||||
xlsave1 (val);
|
||||
val = consa (NIL);
|
||||
rplaca (val,cvfixnum ((FIXTYPE)p.h));
|
||||
rplacd (val,cvfixnum ((FIXTYPE)p.v));
|
||||
xlpop ();
|
||||
return val;
|
||||
}
|
||||
|
||||
LVAL xpenpat (void) { /* set the pen pattern */
|
||||
LVAL plist;
|
||||
Pattern pat;
|
||||
int i;
|
||||
plist = xlgalist ();
|
||||
xllastarg ();
|
||||
for (i = 0; i < 8 && consp (plist); ++i, plist = cdr (plist))
|
||||
// if (fixp (car (plist))) pat[i] = getfixnum (car (plist));
|
||||
SetPort ((GrafPtr)gGraphicsWin);
|
||||
PenPat (&pat);
|
||||
SetPort (gCommandWin);
|
||||
return NIL;
|
||||
}
|
||||
|
||||
|
||||
/* The functions below are not yet implemented. */
|
||||
|
||||
LVAL xtool (void) { /* call the toolbox */
|
||||
int trap = getNumber ();
|
||||
LVAL val;
|
||||
|
||||
/* asm {
|
||||
move.l args(A6),D0
|
||||
beq L2
|
||||
L1: move.l D0,A0
|
||||
move.l 2(A0),A1
|
||||
move.w 4(A1),-(A7)
|
||||
move.l 6(A0),D0
|
||||
bne L1
|
||||
L2: lea L3,A0
|
||||
move.w trap(A6),(A0)
|
||||
L3: dc.w 0xA000
|
||||
clr.l val(A6)
|
||||
}
|
||||
|
||||
return val; */
|
||||
return cvfixnum ((FIXTYPE) trap);
|
||||
}
|
||||
|
||||
LVAL xtool16 (void) { /* call the toolbox with a 16 bit result */
|
||||
int trap = getNumber ();
|
||||
int val;
|
||||
|
||||
/* asm {
|
||||
clr.w -(A7)
|
||||
move.l args(A6), D0
|
||||
beq L2
|
||||
L1: move.l D0, A0
|
||||
move.l 2(A0), A1
|
||||
move.w 4(A1), -(A7)
|
||||
move.l 6(A0), D0
|
||||
bne L1
|
||||
L2: lea L3, A0
|
||||
move.w trap(A6), (A0)
|
||||
L3: dc.w 0xA000
|
||||
move.w (A7)+, val(A6)
|
||||
}
|
||||
|
||||
return cvfixnum ((FIXTYPE) val); */
|
||||
return cvfixnum ((FIXTYPE) trap);
|
||||
}
|
||||
|
||||
LVAL xtool32 (void) { /* call the toolbox with a 32 bit result */
|
||||
int trap = getNumber ();
|
||||
long val;
|
||||
|
||||
/* asm {
|
||||
clr.l -(A7)
|
||||
move.l args(A6),D0
|
||||
beq L2
|
||||
L1: move.l D0,A0
|
||||
move.l 2(A0),A1
|
||||
move.w 4(A1),-(A7)
|
||||
move.l 6(A0),D0
|
||||
bne L1
|
||||
L2: lea L3,A0
|
||||
move.w trap(A6),(A0)
|
||||
L3: dc.w 0xA000
|
||||
move.l (A7)+,val(A6)
|
||||
}
|
||||
|
||||
return cvfixnum ((FIXTYPE) val); */
|
||||
return cvfixnum ((FIXTYPE) trap);
|
||||
}
|
||||
|
||||
LVAL xnewhandle (void) { /* allocate a new handle */
|
||||
LVAL num = xlgafixnum ();
|
||||
long size = getfixnum (num);
|
||||
xllastarg ();
|
||||
return cvfixnum ((FIXTYPE) NewHandle (size));
|
||||
}
|
||||
|
||||
LVAL xnewptr (void) { /* allocate memory */
|
||||
LVAL num = xlgafixnum ();
|
||||
long size = getfixnum (num);
|
||||
xllastarg ();
|
||||
return cvfixnum ((FIXTYPE) NewPtr (size));
|
||||
}
|
||||
|
||||
LVAL xhiword (void) { /* return the high order 16 bits of an integer */
|
||||
unsigned int val = (unsigned int) (getNumber () >> 16);
|
||||
xllastarg ();
|
||||
return cvfixnum ((FIXTYPE) val);
|
||||
}
|
||||
|
||||
LVAL xloword (void) { /* return the low order 16 bits of an integer */
|
||||
unsigned int val = (unsigned int) getNumber ();
|
||||
xllastarg ();
|
||||
return cvfixnum ((FIXTYPE) val);
|
||||
}
|
||||
|
||||
LVAL xrdnohang (void) { /* get the next character in the look-ahead buffer */
|
||||
int ch = 0;
|
||||
xllastarg ();
|
||||
/* if ((ch = scrnextc ()) == EOF) return NIL; */
|
||||
return cvfixnum ((FIXTYPE) ch);
|
||||
}
|
||||
|
||||
void ossymbols (void) { /* ossymbols - enter important symbols */
|
||||
LVAL sym;
|
||||
|
||||
/* setup globals for the window handles */
|
||||
sym = xlenter ("*COMMAND-WINDOW*");
|
||||
setvalue (sym, cvfixnum ((FIXTYPE) gCommandWin));
|
||||
sym = xlenter ("*GRAPHICS-WINDOW*");
|
||||
setvalue (sym, cvfixnum ((FIXTYPE) gGraphicsWin));
|
||||
}
|
||||
|
||||
void xoserror (char *msg) { /* do nothing */ }
|
||||
|
||||
LVAL xsystem (V) { return NIL; }
|
||||
LVAL xgetkey (V) { return NIL; }
|
|
@ -0,0 +1,521 @@
|
|||
/* macint.c - macintosh interface routines for xlisp 2.1e */
|
||||
/* Written by Brian Kendig. */
|
||||
/* The functions here are only called by macstuff.c. */
|
||||
|
||||
#include <Events.h>
|
||||
#include <Gestalt.h>
|
||||
#include <Memory.h>
|
||||
#include <Menus.h>
|
||||
#include <Events.h>
|
||||
#include <Quickdraw.h>
|
||||
#include <StandardFile.h>
|
||||
#include <TextEdit.h>
|
||||
#include <ToolUtils.h>
|
||||
#include <Traps.h>
|
||||
#include <Windows.h>
|
||||
#include <Controls.h>
|
||||
/* #include <ControlDefinitions.h> */
|
||||
#include <SIOUX.h>
|
||||
#include <AppleEvents.h>
|
||||
#include "macint.h"
|
||||
/* #define FALSE 0
|
||||
#define TRUE 1 */
|
||||
#define NIL ((void *) 0)
|
||||
|
||||
|
||||
#include "MacCommandWin.h"
|
||||
#include "macaboutbox.h"
|
||||
#include "MacDrag.h"
|
||||
#include "MacHandleEv.h"
|
||||
#include "macstuff.h"
|
||||
#include "stdio.h"
|
||||
#define TEXTREC (*hTERec) /* the command window text record */
|
||||
#define TEXTCHAR(i) ((*(TEXTREC->hText))[i])
|
||||
|
||||
// Struct for apple event handling
|
||||
typedef struct AEventList {
|
||||
AEEventClass evclass;
|
||||
AEEventID evid;
|
||||
void *handler;
|
||||
long refcon;
|
||||
} AEventList, *AEventListPtr;
|
||||
|
||||
//===========================================================================
|
||||
// GLOBALS DEFINED HERE USE MacGlobals.h FOR ACCESS
|
||||
//===========================================================================
|
||||
|
||||
// Menu handles
|
||||
MenuHandle appleMenu, fileMenu, editMenu, controlMenu;
|
||||
|
||||
/* command and graphics windows */
|
||||
WindowPtr gCommandWin, gGraphicsWin;
|
||||
WindowRecord commandWinRec, bwGraphicsWinRec;
|
||||
CWindowRecord colorGraphicsWinRec;
|
||||
Boolean gGraphicsShown, gCommandWinResized = false;
|
||||
|
||||
// Screen size stuff
|
||||
Rect dragRect, sizeRect;
|
||||
int screenWidth, screenHeight; /* screen dimensions */
|
||||
int sHorizontal, sVertical, sWidth, sHeight; /* command win, split screen */
|
||||
int gHorizontal, gVertical, gWidth, gHeight; /* graphics win, split screen */
|
||||
|
||||
// The Text handle
|
||||
TEHandle hTERec;
|
||||
|
||||
/* output is buffered */
|
||||
//Handle hOutputBuffer = NULL;
|
||||
int outputBufferLength = 0;
|
||||
|
||||
// Allocate space for UPPs
|
||||
ControlActionUPP uppScrollProc;
|
||||
TEClickLoopUPP uppScrollClickLoop;
|
||||
//AEEventHandlerUPP uppAEOpenFiles, uppAEQuit;
|
||||
|
||||
// Text related globals
|
||||
CharsHandle pastedTextH = NULL; /* a handle to pasted text */
|
||||
int pastedLength = 0; /* how many chars there are in the paste buffer */
|
||||
int flashTime = 0, cursorBeforeFlash; /* for flashing cursor when parens match */
|
||||
char recentChar; /* the last character typed */
|
||||
RgnHandle gMouseRgn; // holds current mouse regin
|
||||
|
||||
/* miscellaneous stuff */
|
||||
Boolean gInBackground; /* are we in background or not */
|
||||
int wneImplemented;
|
||||
unsigned long startupTicks;
|
||||
Boolean hasColorQD;
|
||||
|
||||
short howManyFiles = 0, whichFile = 0; /* keep track of files opened from Finder */
|
||||
|
||||
|
||||
// Prototypes
|
||||
static pascal OSErr AEQuit (AppleEvent *theAppleEvent, AppleEvent *theReply, long Refcon);
|
||||
static pascal OSErr AEOpenFiles (AppleEvent *theAppleEvent, AppleEvent *theReply, long Refcon);
|
||||
pascal Boolean ScrollClickLoop (void);
|
||||
pascal void ScrollProc (ControlHandle control, short thePart);
|
||||
Rect SetTERect (void);
|
||||
void FlushOutput (void);
|
||||
|
||||
void ShowGrafWin (void) {
|
||||
/* make the graphics window visible */
|
||||
ShowWindow (gGraphicsWin);
|
||||
SelectWindow (gGraphicsWin);
|
||||
SetMenuItemText (controlMenu, SHOW_GRAPHICS, "\pHide Graphics");
|
||||
//AdjustCursor ();
|
||||
gGraphicsShown = true;
|
||||
}
|
||||
|
||||
void HideGrafWin (void) {
|
||||
/* hide the graphics window */
|
||||
HideWindow (gGraphicsWin);
|
||||
SetMenuItemText (controlMenu, SHOW_GRAPHICS, "\pShow Graphics");
|
||||
gGraphicsShown = false;
|
||||
}
|
||||
|
||||
|
||||
static void UpdateGraphWindow ()
|
||||
{
|
||||
BeginUpdate (gGraphicsWin);
|
||||
EndUpdate (gGraphicsWin);
|
||||
}
|
||||
void InitMac (void) {
|
||||
// { /* set up memory properly */
|
||||
// int i;
|
||||
// fix this later. -EAD
|
||||
//if (DefltStack < STACKMIN) SetApplLimit (CurStackBase - STACKMIN);
|
||||
// MaxApplZone ();
|
||||
// for (i = 0; i < MASTERS; i++) MoreMasters ();
|
||||
// }
|
||||
AEventListPtr theAppleEvent;
|
||||
AEventList theEventList[] = {
|
||||
{ kCoreEventClass, kAEOpenDocuments, AEOpenFiles, 0 },
|
||||
{ kCoreEventClass, kAEQuitApplication, AEQuit, 0 },
|
||||
{ 0, 0, nil, 0 }
|
||||
};
|
||||
int i;
|
||||
|
||||
/* do all the necessary initialization mumbo-jumbo */
|
||||
if (StackSpace() < STACKMIN)
|
||||
SetApplLimit(GetApplLimit() - STACKMIN);
|
||||
MaxApplZone();
|
||||
/* printf("New StackSpace %lx GetApplLimit %lx\n",
|
||||
StackSpace(), GetApplLimit()); */
|
||||
for (i = 0; i < MASTERS; i++) MoreMasters ();
|
||||
/* getchar(); */
|
||||
|
||||
/* initialize the toolbox */
|
||||
InitGraf (&qd.thePort);
|
||||
InitFonts ();
|
||||
FlushEvents (everyEvent, 0);
|
||||
InitWindows ();
|
||||
InitMenus ();
|
||||
TEInit ();
|
||||
InitDialogs (NIL);
|
||||
InitCursor ();
|
||||
|
||||
// Setup Callbacks
|
||||
uppScrollClickLoop = NewTEClickLoopProc(ScrollClickLoop);
|
||||
uppScrollProc = NewControlActionProc(ScrollProc);
|
||||
|
||||
// Handlers for core apple events
|
||||
for (theAppleEvent = theEventList; theAppleEvent->handler; theAppleEvent++)
|
||||
if (AEInstallEventHandler(theAppleEvent->evclass, theAppleEvent->evid, NewAEEventHandlerProc((ProcPtr)theAppleEvent->handler),
|
||||
theAppleEvent->refcon, 0) != noErr);
|
||||
|
||||
// Set up the SIOUX window
|
||||
SIOUXSettings.initializeTB = FALSE; //Toolbox is alread inited
|
||||
SIOUXSettings.setupmenus = FALSE; //keep the csound menus
|
||||
SIOUXSettings.autocloseonquit = TRUE; //close sioux without asking for save
|
||||
SIOUXSettings.showstatusline = FALSE; //no status line
|
||||
SIOUXSettings.asktosaveonclose = FALSE; //don't ask to save
|
||||
SIOUXSettings.toppixel = 40;
|
||||
SIOUXSettings.leftpixel = 5;
|
||||
|
||||
/* see if we have WaitNextEvent and Color Quickdraw */
|
||||
wneImplemented = (NGetTrapAddress (_WaitNextEvent, ToolTrap) != NGetTrapAddress (_Unimplemented, ToolTrap));
|
||||
if (NGetTrapAddress ((short) Gestalt, ToolTrap) != NGetTrapAddress (_Unimplemented, ToolTrap)) {
|
||||
long returnCode;
|
||||
OSErr err = Gestalt (gestaltQuickdrawVersion, &returnCode);
|
||||
hasColorQD = ((err == noErr) && (returnCode >= gestalt8BitQD));
|
||||
} else hasColorQD = false;
|
||||
|
||||
{ /* set up menus */
|
||||
Handle theMenuBar = GetNewMBar (MBAR_RES);
|
||||
SetMenuBar (theMenuBar);
|
||||
appleMenu = (MenuHandle)GetMenuHandle (APPLE_MENU_RES);
|
||||
fileMenu = (MenuHandle)GetMenuHandle (FILE_MENU_RES);
|
||||
editMenu = (MenuHandle)GetMenuHandle (EDIT_MENU_RES);
|
||||
controlMenu = (MenuHandle)GetMenuHandle (CONTROL_MENU_RES);
|
||||
AppendResMenu (appleMenu, 'DRVR');
|
||||
DrawMenuBar ();
|
||||
}
|
||||
|
||||
/* get the size of the main screen */
|
||||
screenWidth = qd.screenBits.bounds.right - qd.screenBits.bounds.left;
|
||||
screenHeight = qd.screenBits.bounds.bottom - qd.screenBits.bounds.top;
|
||||
|
||||
/* compute the size of the graphics window in split-screen mode */
|
||||
gHorizontal = SCREEN_MARGIN;
|
||||
gVertical = MBAR_HEIGHT + TITLEBAR_HEIGHT - 1;
|
||||
gWidth = screenWidth - (SCREEN_MARGIN * 2);
|
||||
gHeight = GRAFWIN_HEIGHT;
|
||||
|
||||
/* compute the size of the command window in split-screen mode */
|
||||
sHorizontal = SCREEN_MARGIN;
|
||||
sVertical = MBAR_HEIGHT + TITLEBAR_HEIGHT - 1 + SCREEN_MARGIN + GRAFWIN_HEIGHT;
|
||||
sWidth = screenWidth - (SCREEN_MARGIN * 2);
|
||||
sHeight = screenHeight - MBAR_HEIGHT - TITLEBAR_HEIGHT - (SCREEN_MARGIN * 2) - GRAFWIN_HEIGHT - 1;
|
||||
|
||||
/* set up size and drag rects */
|
||||
dragRect = (*GetGrayRgn ())->rgnBBox;
|
||||
// dragRect.left += DRAG_THRESHOLD;
|
||||
// dragRect.right -= DRAG_THRESHOLD;
|
||||
// dragRect.bottom -= DRAG_THRESHOLD;
|
||||
sizeRect.top = MIN_WIN_HEIGHT;
|
||||
sizeRect.left = MIN_WIN_WIDTH;
|
||||
sizeRect.bottom = qd.screenBits.bounds.bottom - qd.screenBits.bounds.top;
|
||||
sizeRect.right = qd.screenBits.bounds.right - qd.screenBits.bounds.left;
|
||||
|
||||
/* create the command window */
|
||||
gCommandWin = GetNewWindow (CWINRES, &commandWinRec, (WindowPtr) -1L);
|
||||
SetPort (gCommandWin);
|
||||
|
||||
/* create the graphics window */
|
||||
if (hasColorQD) gGraphicsWin = GetNewCWindow (GWINRES, &colorGraphicsWinRec, (WindowPtr) -1L);
|
||||
else gGraphicsWin = GetNewWindow (GWINRES, &bwGraphicsWinRec, (WindowPtr) -1L);
|
||||
|
||||
startupTicks = TickCount (); /* take note of what time we're starting up */
|
||||
|
||||
// Create mouse regin
|
||||
gMouseRgn = NewRgn();
|
||||
|
||||
// Initalize some command window stuff
|
||||
InitalizeCmdWindow();
|
||||
|
||||
// Turn on text outlineing
|
||||
TEFeatureFlag(teFOutlineHilite, teBitSet, hTERec);
|
||||
|
||||
HideGrafWin ();
|
||||
|
||||
{ /* see if the user launched the app by opening text files from the Finder */
|
||||
short doWhat;\
|
||||
// call to CountAppFiles was commented out, but that left doWhat uninitialized
|
||||
// RBD added this ifdef, I wonder where CountAppFiles came from?
|
||||
#ifdef CountAppFilesDefined
|
||||
CountAppFiles (&doWhat, &howManyFiles);
|
||||
if (doWhat != appOpen) howManyFiles = 0;
|
||||
#else
|
||||
howManyFiles = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
UpdateCmdWindow ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void DoAppleMenu (int theItem) {
|
||||
switch (theItem) {
|
||||
case ABOUT_ITEM:
|
||||
DoAboutBox ();
|
||||
break;
|
||||
default: {
|
||||
Str255 name;
|
||||
GetMenuItemText (appleMenu, theItem, name);
|
||||
OpenDeskAcc (name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* this should really be in a header for MacFileUtils.c */
|
||||
void GetFullPath(FSSpec *theSpec, StringPtr theName);
|
||||
|
||||
|
||||
static void DoFileMenu (int theItem) {
|
||||
extern xlload (char *, int, int);
|
||||
extern xlabort(char *);
|
||||
extern xlisp_wrapup (void);
|
||||
StandardFileReply theFile;
|
||||
|
||||
SFTypeList fileTypes;
|
||||
Point pt = { 100, 100 };
|
||||
|
||||
fileTypes[0] = 'TEXT';
|
||||
switch (theItem) {
|
||||
case LOAD:
|
||||
case LOAD_NOISILY:
|
||||
StopPasting ();
|
||||
StandardGetFile(NIL, 1, fileTypes, &theFile);
|
||||
if (theFile.sfGood) {
|
||||
Str255 theFullPath;
|
||||
short wdRefNum;
|
||||
|
||||
OSErr err;
|
||||
HiliteMenu (0);
|
||||
|
||||
err = OpenWD(theFile.sfFile.vRefNum, theFile.sfFile.parID, 'Nyqu', &wdRefNum);
|
||||
err = SetVol(NIL, wdRefNum);
|
||||
SetSelection (TEXTREC->teLength, TEXTREC->teLength); /* send cursor to end */
|
||||
|
||||
GetFullPath(&theFile.sfFile, theFullPath);
|
||||
P2CStr(theFullPath);
|
||||
|
||||
if ((xlload((char *) theFullPath, 1, (theItem == LOAD_NOISILY))) == 0) {
|
||||
xlabort("load error");
|
||||
}
|
||||
macputs ("> ");
|
||||
PrepareForInput ();
|
||||
}
|
||||
break;
|
||||
case QUIT:
|
||||
xlisp_wrapup ();
|
||||
}
|
||||
}
|
||||
|
||||
static void DoEditMenu (int theItem) {
|
||||
if (SystemEdit (theItem-1) == false)
|
||||
switch (theItem) {
|
||||
case CUT: case COPY:
|
||||
if (ZeroScrap () == noErr) {
|
||||
TECopy (hTERec); /* after copying, export the TE scrap */
|
||||
if (TEToScrap () != noErr) ZeroScrap ();
|
||||
}
|
||||
if (theItem == CUT) DeleteRange ();
|
||||
break;
|
||||
case PASTE: {
|
||||
long scrapOffset;
|
||||
if (pastedTextH) DisposeHandle (pastedTextH);
|
||||
pastedTextH = (CharsHandle) NewHandle (0);
|
||||
pastedLength = GetScrap (pastedTextH, 'TEXT', &scrapOffset);
|
||||
if (pastedLength < 0) pastedLength = 0; /* error */
|
||||
else {
|
||||
SetHandleSize (pastedTextH, pastedLength + 1);
|
||||
HLock (pastedTextH);
|
||||
((char *)(*pastedTextH))[pastedLength] = '\0';
|
||||
HUnlock (pastedTextH);
|
||||
}
|
||||
} /* and fall through ... */
|
||||
case CLEAR:
|
||||
DeleteRange ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void DoControlMenu (int theItem) {
|
||||
extern xlbreak (char *, char *);
|
||||
extern char *s_unbound;
|
||||
extern xlcontinue (void);
|
||||
extern xlcleanup (void);
|
||||
extern xlabort (char *);
|
||||
extern xltoplevel (void);
|
||||
|
||||
scrflush ();
|
||||
HiliteMenu (0);
|
||||
switch (theItem) {
|
||||
case BREAK: StopPasting (); xlbreak ("user break", s_unbound); PrepareForInput (); break;
|
||||
case CONTINUE: StopPasting (); xlcontinue (); PrepareForInput (); break;
|
||||
case CLEAN_UP: StopPasting (); xlcleanup (); PrepareForInput (); break;
|
||||
case CANCEL_INPUT: StopPasting (); xlabort ("input canceled"); PrepareForInput (); break;
|
||||
case TOP_LEVEL: StopPasting (); xltoplevel (); PrepareForInput (); break;
|
||||
case SHOW_GRAPHICS:
|
||||
if (gGraphicsShown) HideGrafWin ();
|
||||
else ShowGrafWin ();
|
||||
break;
|
||||
case SPLIT_SCREEN:
|
||||
MoveWindow (gCommandWin, sHorizontal, sVertical, -1);
|
||||
SizeWindow (gCommandWin, sWidth, sHeight, -1);
|
||||
InvalRect (&gCommandWin->portRect);
|
||||
SetTERect ();
|
||||
SetScrollRect ();
|
||||
ShowGrafWin ();
|
||||
MoveWindow (gGraphicsWin, gHorizontal, gVertical, -1);
|
||||
SizeWindow (gGraphicsWin, gWidth, gHeight, -1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DoMenu (long choice) {
|
||||
int theMenu = HiWord (choice), theItem = LoWord (choice);
|
||||
|
||||
HiliteMenu (theMenu);
|
||||
switch (theMenu) {
|
||||
case APPLE_MENU_RES: DoAppleMenu (theItem); break;
|
||||
case FILE_MENU_RES: DoFileMenu (theItem); break;
|
||||
case EDIT_MENU_RES: DoEditMenu (theItem); break;
|
||||
case CONTROL_MENU_RES: DoControlMenu (theItem); break;
|
||||
}
|
||||
HiliteMenu (0);
|
||||
}
|
||||
|
||||
void AdjustMenus (void) {
|
||||
/* turn the stuff in the Edit menu on and off as necessary */
|
||||
long temp;
|
||||
DisableItem (editMenu, UNDO);
|
||||
if (TEXTREC->selStart != TEXTREC->selEnd) {
|
||||
EnableItem (editMenu, CUT);
|
||||
EnableItem (editMenu, COPY);
|
||||
EnableItem (editMenu, CLEAR);
|
||||
} else {
|
||||
DisableItem (editMenu, CUT);
|
||||
DisableItem (editMenu, COPY);
|
||||
DisableItem (editMenu, CLEAR);
|
||||
}
|
||||
if (GetScrap (NIL, 'TEXT', &temp) > 0) EnableItem (editMenu, PASTE);
|
||||
else DisableItem (editMenu, PASTE);
|
||||
}
|
||||
|
||||
RgnHandle rgn = nil;
|
||||
|
||||
void DoContent (EventRecord *theEvent) {
|
||||
/* handle a click in a window's content region */
|
||||
ControlHandle theScrollBar;
|
||||
GrafPtr oldPort;
|
||||
int scrollValue;
|
||||
Point mouse = theEvent->where;
|
||||
int thePart;
|
||||
// RgnHandle rgn = nil;
|
||||
|
||||
GetPort (&oldPort);
|
||||
SetPort (gCommandWin);
|
||||
GlobalToLocal (&mouse);
|
||||
|
||||
// Get Selected text
|
||||
rgn = NewRgn();
|
||||
TEGetHiliteRgn(rgn, hTERec);
|
||||
|
||||
if (thePart = FindControl (mouse, gCommandWin, &theScrollBar)) {
|
||||
switch (thePart) {
|
||||
case kControlUpButtonPart:
|
||||
case kControlDownButtonPart:
|
||||
case kControlPageUpPart:
|
||||
case kControlPageDownPart:
|
||||
scrollValue = TrackControl (theScrollBar, mouse, uppScrollProc);
|
||||
break;
|
||||
case kControlIndicatorPart:
|
||||
scrollValue = GetControlValue (theScrollBar);
|
||||
thePart = TrackControl (theScrollBar, mouse, NIL);
|
||||
if (thePart) {
|
||||
scrollValue -= GetControlValue (theScrollBar);
|
||||
if (scrollValue) TEScroll (0, scrollValue * LINEHEIGHT, hTERec);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (PtInRgn(mouse, rgn)) {
|
||||
if (!DragText(theEvent)) {
|
||||
TEClick(mouse, false, hTERec);
|
||||
}
|
||||
} else if (PtInRect (mouse, &(TEXTREC->viewRect))) {
|
||||
TEClick (mouse, (theEvent->modifiers & shiftKey) != 0, hTERec);
|
||||
}
|
||||
SetPort (oldPort);
|
||||
DisposeRgn(rgn);
|
||||
}
|
||||
|
||||
|
||||
void DoEvent (void) {
|
||||
EventRecord theEvent;
|
||||
|
||||
if ((flashTime) && (--flashTime == 0)) SetSelection (cursorBeforeFlash, cursorBeforeFlash);
|
||||
if (outputBufferLength) FlushOutput ();
|
||||
if (FrontWindow () == gCommandWin) TEIdle (hTERec);
|
||||
recentChar = '\0';
|
||||
|
||||
if (WaitNextEvent (everyEvent, &theEvent, 0, gMouseRgn)) {
|
||||
|
||||
AdjustCursor (theEvent.where, gMouseRgn);
|
||||
|
||||
switch (theEvent.what) {
|
||||
case kHighLevelEvent:
|
||||
AEProcessAppleEvent(&theEvent);
|
||||
break;
|
||||
case mouseDown:
|
||||
DoMouseDown (&theEvent);
|
||||
break;
|
||||
case keyDown:
|
||||
case autoKey:
|
||||
DoKeyPress (&theEvent);
|
||||
break;
|
||||
case activateEvt: {
|
||||
WindowPtr whichWindow = (WindowPtr)theEvent.message;
|
||||
SetPort (whichWindow);
|
||||
if (whichWindow == gCommandWin) {
|
||||
if ((theEvent.modifiers & activeFlag) == 1) {
|
||||
ActivateCmdWindow();
|
||||
} else {
|
||||
DeactivateCmdWindow();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case updateEvt: {
|
||||
if ((WindowPtr)theEvent.message == gCommandWin) UpdateCmdWindow ();
|
||||
if ((WindowPtr)theEvent.message == gGraphicsWin) UpdateGraphWindow ();
|
||||
break;
|
||||
}
|
||||
case osEvt:
|
||||
if (((theEvent.message >> 24) & 0xff) == suspendResumeMessage) {
|
||||
if (theEvent.message & resumeFlag) {
|
||||
gInBackground = false;
|
||||
if (FrontWindow () == gCommandWin) {
|
||||
ActivateCmdWindow();
|
||||
}
|
||||
} else {
|
||||
gInBackground = true;
|
||||
if (FrontWindow () == gCommandWin) {
|
||||
SetPort (gCommandWin);
|
||||
DeactivateCmdWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
AdjustCursor (theEvent.where, gMouseRgn);
|
||||
}
|
||||
|
||||
void MacWrapUp (void) {
|
||||
/* take everything down in preparation for quitting */
|
||||
CleanupCmdWindow();
|
||||
CloseWindow (gGraphicsWin);
|
||||
}
|
|
@ -0,0 +1,166 @@
|
|||
#define INT_MAX +32767
|
||||
|
||||
#define INT_MIN -32767
|
||||
|
||||
/* resource id's */
|
||||
|
||||
#define CWINRES 400
|
||||
|
||||
#define GWINRES 401
|
||||
|
||||
#define MBAR_RES 400
|
||||
|
||||
#define APPLE_MENU_RES 400
|
||||
|
||||
#define FILE_MENU_RES 401
|
||||
|
||||
#define EDIT_MENU_RES 402
|
||||
|
||||
#define CONTROL_MENU_RES 403
|
||||
|
||||
#define STRINGS_RES 400
|
||||
|
||||
|
||||
|
||||
/* Apple menu */
|
||||
|
||||
#define ABOUT_ITEM 1
|
||||
|
||||
#define ABOUT_BOX 400
|
||||
|
||||
#define ABOUT_PICT 400
|
||||
|
||||
|
||||
|
||||
/* File menu */
|
||||
|
||||
#define LOAD 1
|
||||
|
||||
#define LOAD_NOISILY 2
|
||||
|
||||
#define QUIT 4
|
||||
|
||||
|
||||
|
||||
/* Edit menu */
|
||||
|
||||
#define UNDO 1
|
||||
|
||||
#define CUT 3
|
||||
|
||||
#define COPY 4
|
||||
|
||||
#define PASTE 5
|
||||
|
||||
#define CLEAR 6
|
||||
|
||||
|
||||
|
||||
/* Control menu */
|
||||
|
||||
#define BREAK 1
|
||||
|
||||
#define CONTINUE 2
|
||||
|
||||
#define CLEAN_UP 3
|
||||
|
||||
#define CANCEL_INPUT 4
|
||||
|
||||
#define TOP_LEVEL 5
|
||||
|
||||
#define SHOW_GRAPHICS 7
|
||||
|
||||
#define SPLIT_SCREEN 8
|
||||
|
||||
|
||||
|
||||
/* window sizing/dragging stuff */
|
||||
|
||||
#define DRAG_THRESHOLD 8
|
||||
|
||||
#define MIN_WIN_HEIGHT 80
|
||||
|
||||
#define MIN_WIN_WIDTH 120
|
||||
|
||||
|
||||
|
||||
#define MAX_BUF 250 /* max chars in output buffer */
|
||||
|
||||
#define SCROLLBACK_THRESHHOLD 30000 /* max chars kept in window */
|
||||
|
||||
#define DELETE_BLOCK 10000 /* how many chars to delete when threshhold reached */
|
||||
|
||||
|
||||
|
||||
#define LINEHEIGHT 11 /* height in pixels of 9-point Geneva, the font used */
|
||||
|
||||
#define STACKMIN 400000 /* amout of memory for application stack */
|
||||
|
||||
#define MASTERS 3 /* arbitrary -- how many times to call MoreMasters() */
|
||||
|
||||
|
||||
|
||||
/* key codes */
|
||||
|
||||
#define RETURN 0x0d
|
||||
|
||||
#define ENTER 0x03
|
||||
|
||||
#define DELETE 0x08
|
||||
|
||||
#define FWDDEL 0x7F
|
||||
|
||||
#define CLRKEY 0x1b
|
||||
|
||||
#define PAGEUP 0x0b
|
||||
|
||||
#define PAGEDN 0x0c
|
||||
|
||||
#define HOMEKEY 0x01
|
||||
|
||||
#define ENDKEY 0x04
|
||||
|
||||
#define HELPKEY 0x05
|
||||
|
||||
#define FNKEY 0x10
|
||||
|
||||
#define LEFTARROW 0x1c
|
||||
|
||||
#define RIGHTARROW 0x1d
|
||||
|
||||
#define UPARROW 0x1e
|
||||
|
||||
#define DOWNARROW 0x1f
|
||||
|
||||
#define DBLQUOTE '\"'
|
||||
|
||||
|
||||
|
||||
/* useful definitions */
|
||||
|
||||
#define MBAR_HEIGHT 20
|
||||
|
||||
#define TITLEBAR_HEIGHT 20
|
||||
|
||||
#define SCROLLER_WIDTH 15
|
||||
|
||||
#define SCREEN_MARGIN 2
|
||||
|
||||
#define TEXT_MARGIN 4
|
||||
|
||||
#define GRAFWIN_HEIGHT 232
|
||||
|
||||
void AdjustMenus(void);
|
||||
|
||||
void DoMenu(long choice);
|
||||
|
||||
void HideGrafWin(void);
|
||||
|
||||
void DoContent(EventRecord *theEvent);
|
||||
|
||||
void InitMac(void);
|
||||
|
||||
void MacWrapUp(void);
|
||||
|
||||
|
||||
void DoEvent (void);
|
|
@ -0,0 +1,52 @@
|
|||
{ "HIDEPEN", S, xhidepen }, /* 300 */
|
||||
|
||||
{ "SHOWPEN", S, xshowpen }, /* 301 */
|
||||
|
||||
{ "GETPEN", S, xgetpen }, /* 302 */
|
||||
|
||||
{ "PENSIZE", S, xpensize }, /* 303 */
|
||||
|
||||
{ "PENMODE", S, xpenmode }, /* 304 */
|
||||
|
||||
{ "PENPAT", S, xpenpat }, /* 305 */
|
||||
|
||||
{ "PENNORMAL", S, xpennormal }, /* 306 */
|
||||
|
||||
{ "MOVETO", S, xmoveto }, /* 307 */
|
||||
|
||||
{ "MOVE", S, xmove }, /* 308 */
|
||||
|
||||
{ "LINETO", S, xdrawto }, /* 309 */
|
||||
|
||||
{ "LINE", S, xdraw }, /* 310 */
|
||||
|
||||
{ "SHOW-GRAPHICS", S, xshowgraphics }, /* 311 */
|
||||
|
||||
{ "HIDE-GRAPHICS", S, xhidegraphics }, /* 312 */
|
||||
|
||||
{ "CLEAR-GRAPHICS", S, xcleargraphics }, /* 313 */
|
||||
|
||||
{ "TOOLBOX", S, xtool }, /* 314 */
|
||||
|
||||
{ "TOOLBOX-16", S, xtool16 }, /* 315 */
|
||||
|
||||
{ "TOOLBOX-32", S, xtool32 }, /* 316 */
|
||||
|
||||
{ "NEWHANDLE", S, xnewhandle }, /* 317 */
|
||||
|
||||
{ "NEWPTR", S, xnewptr }, /* 318 */
|
||||
|
||||
{ "HIWORD", S, xhiword }, /* 319 */
|
||||
|
||||
{ "LOWORD", S, xloword }, /* 320 */
|
||||
|
||||
{ "READ-CHAR-NO-HANG", S, xrdnohang }, /* 321 */
|
||||
|
||||
|
||||
|
||||
/* not implemented - take a look at code in directory "sys:mac:old" */
|
||||
|
||||
/*{ "COMMAND-POINT-SIZE", S, xptsize }, 322 */
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,229 @@
|
|||
/* macstuff.c - macintosh interface routines for xlisp */
|
||||
/* Written by Brian Kendig. */
|
||||
/* This file contains the stuff that the other xlisp files call directly. */
|
||||
|
||||
#include "cext.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <QuickDraw.h> /* for Random */
|
||||
#include <Memory.h> /* for DisposePtr */
|
||||
#include <SegLoad.h> /* for ExitToShell */
|
||||
#include "xlisp.h"
|
||||
#include <string.h>
|
||||
#include "macint.h"
|
||||
#include "MacCommandWin.h"
|
||||
#define DELETE 0x08
|
||||
|
||||
/* externals */
|
||||
extern FILE *tfp; /* transcript file pointer */
|
||||
extern int cursorPos;
|
||||
extern char *macgets (void);
|
||||
|
||||
/* local variables */
|
||||
int lposition;
|
||||
static char *linebuf = NULL, *lineptr;
|
||||
static int numChars;
|
||||
|
||||
/* system-dependent variable definitions */
|
||||
static const char os_pathchar = ':';
|
||||
static const char os_sepchar = ',';
|
||||
|
||||
|
||||
int isascii (char c) { return 1; } /* every char is an ascii char, isn't it? */
|
||||
|
||||
void osinit (char *banner) {
|
||||
#ifdef SAFE_NYQUIST
|
||||
SAFE_NYQUIST is not supported in macstuff.c
|
||||
#endif
|
||||
int i;
|
||||
char version[] = "\nMacintosh interface by Brian Kendig, Erik A. Dahl, and Dominic Mazzoni.\n";
|
||||
InitMac (); /* initialize the mac interface routines */
|
||||
lposition = 0; /* initialize the line editor */
|
||||
for (i = 0; banner[i] != '\0'; i++) macputc (banner[i]);
|
||||
for (i = 0; version[i] != '\0'; i++) macputc (version[i]);
|
||||
}
|
||||
|
||||
FILE *osaopen (char *name, char *mode) {
|
||||
return fopen (name, mode);
|
||||
}
|
||||
|
||||
FILE *osbopen (char *name, char *mode) {
|
||||
FILE *f;
|
||||
char nmode[4];
|
||||
strcpy (nmode, mode); strcat (nmode, "b");
|
||||
f = fopen(name, nmode);
|
||||
return f;
|
||||
}
|
||||
|
||||
int osclose (FILE *fp) { return (fclose (fp)); }
|
||||
int osaputc (int ch, FILE *fp) { return (putc (ch, fp)); }
|
||||
int osbputc (int ch, FILE *fp) { return (putc (ch, fp)); }
|
||||
|
||||
/* osagetc - get a character from an ascii file */
|
||||
int osagetc(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
return (getc(fp));
|
||||
}
|
||||
|
||||
int ostgetc (void) {
|
||||
int i;
|
||||
|
||||
if (numChars <= 0) { /* get some more */
|
||||
if (linebuf) DisposePtr (linebuf);
|
||||
linebuf = macgets ();
|
||||
i = 0;
|
||||
while (linebuf[i] != '\0') i++;
|
||||
numChars = i;
|
||||
if (tfp) for (i = 0; i < numChars; i++) osaputc (linebuf[i], tfp);
|
||||
lineptr = linebuf;
|
||||
}
|
||||
numChars--;
|
||||
if (*lineptr == '\r') {
|
||||
lineptr++;
|
||||
return '\n';
|
||||
} else return (*lineptr++);
|
||||
}
|
||||
|
||||
void ostputc (int ch) {
|
||||
macputc (ch);
|
||||
if (tfp) osaputc (ch, tfp);
|
||||
}
|
||||
|
||||
void osflush (void) {
|
||||
lineptr = linebuf;
|
||||
numChars = 0;
|
||||
lposition = 0;
|
||||
}
|
||||
|
||||
void oscheck (void) { DoEvent (); }
|
||||
|
||||
void oserror (char *msg) {
|
||||
char line[100], *p;
|
||||
sprintf (line,"error: %s\n",msg);
|
||||
for (p = line; *p != '\0'; ++p) ostputc (*p);
|
||||
}
|
||||
|
||||
void osfinish(void) {
|
||||
/* dispose of everything... */
|
||||
if (linebuf) DisposePtr(linebuf);
|
||||
portaudio_exit();
|
||||
MacWrapUp ();
|
||||
ExitToShell ();
|
||||
}
|
||||
|
||||
#define GPRINTF_MESSAGE_LEN 500
|
||||
|
||||
/* nyquist_printf -- system independent version of printf */
|
||||
/*
|
||||
* this function prints to console like printf, but using GUI
|
||||
* rather than stdio when appropriate.
|
||||
*
|
||||
*/
|
||||
void nyquist_printf(char *format, ...)
|
||||
{
|
||||
char temp[GPRINTF_MESSAGE_LEN];
|
||||
va_list pvar;
|
||||
char *p = temp;
|
||||
va_start(pvar, format);
|
||||
vsnprintf(temp, GPRINTF_MESSAGE_LEN, format, pvar);
|
||||
va_end(pvar);
|
||||
while (*p) ostputc(*p++);
|
||||
}
|
||||
|
||||
int renamebackup (char *filename) { return 0; }
|
||||
|
||||
static FSSpec prefsFSSpec;
|
||||
static int need_preferences_file = false;
|
||||
static char xlisp_path[1024]; /* cache for the path */
|
||||
static int valid_xlisp_path = false;
|
||||
|
||||
/* xsetupconsole -- used to configure window in Win32 version */
|
||||
LVAL xsetupconsole() { return NIL; }
|
||||
|
||||
|
||||
/* this should really be in a header for MacFileUtils.c */
|
||||
void GetFullPath(FSSpec *theSpec, StringPtr theName);
|
||||
|
||||
|
||||
void get_xlisp_path(char *p, long p_max, int *prefs_found)
|
||||
{
|
||||
Str63 fileName = "\pXLisp Preferences";
|
||||
SInt16 foundPrefVRefNum = 0;
|
||||
SInt32 foundPrefDirID = 0;
|
||||
OSErr err = noErr;
|
||||
*p = 0; /* initialize to empty string */
|
||||
*prefs_found = false;
|
||||
/* if we find path in the cache, copy and return */
|
||||
if (valid_xlisp_path) {
|
||||
*prefs_found = true;
|
||||
strcpy(p, xlisp_path + 10); /* remember, path has XLISPPATH= at head */
|
||||
return;
|
||||
}
|
||||
/* if we've been here before, do not try opening again */
|
||||
if (need_preferences_file) return;
|
||||
err = FindFolder(kOnSystemDisk, kPreferencesFolderType,
|
||||
kDontCreateFolder, &foundPrefVRefNum,
|
||||
&foundPrefDirID);
|
||||
if (err == noErr) {
|
||||
err = FSMakeFSSpec(foundPrefVRefNum, foundPrefDirID,
|
||||
fileName, &prefsFSSpec);
|
||||
*prefs_found = (err == noErr);
|
||||
need_preferences_file = !*prefs_found;
|
||||
}
|
||||
if (*prefs_found) {
|
||||
FILE *pf;
|
||||
GetFullPath(&prefsFSSpec, (StringPtr) xlisp_path);
|
||||
P2CStr((StringPtr) xlisp_path);
|
||||
pf = fopen(xlisp_path, "r");
|
||||
if (!pf) {
|
||||
return; /* problem opening the path */
|
||||
}
|
||||
while (fgets(xlisp_path, 1023, pf)) {
|
||||
if (strncmp(xlisp_path, "XLISPPATH=", 10) == 0) {
|
||||
valid_xlisp_path = true;
|
||||
xlisp_path[strlen(xlisp_path) - 1] = 0; /* trim newline */
|
||||
strcpy(p, xlisp_path + 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(pf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* this is called when we load a file -- if need_preference_file,
|
||||
* we will build a preference file and insert the path of the file
|
||||
* we just opened, assuming it will tell us where to find init.lsp
|
||||
*/
|
||||
void setup_preferences(char *filename)
|
||||
{
|
||||
if (need_preferences_file) {
|
||||
unsigned char prefname[256];
|
||||
FILE *pf;
|
||||
char *cp;
|
||||
int len = 0;
|
||||
GetFullPath(&prefsFSSpec, prefname);
|
||||
need_preferences_file = false;
|
||||
P2CStr(prefname);
|
||||
/* we expect file-not-found error, path is valid */
|
||||
pf = fopen((char *) prefname, "w");
|
||||
if (pf == NULL) return;
|
||||
cp = strrchr((char *) filename, ':');
|
||||
if (cp == NULL) return;
|
||||
cp[1] = 0;
|
||||
/* now, filename is the path. If filename ends in runtime, this
|
||||
* is probably the standard nyquist runtime folder. We should put
|
||||
* the nyquist lib folder on the path too.
|
||||
*/
|
||||
len = cp + 1 - filename;
|
||||
if (len >= 9 &&
|
||||
strcmp(filename + len - 9, ":runtime:") == 0) {
|
||||
filename[len - 8] = 0;
|
||||
fprintf(pf, "XLISPPATH=%sruntime:,%slib:\n", filename, filename);
|
||||
} else {
|
||||
fprintf(pf, "XLISPPATH=%s\n", filename);
|
||||
}
|
||||
fclose(pf);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
/* macstuff.h -- header for mac-specific functions */
|
||||
|
||||
void osfinish(void);
|
||||
/* put searchpath into p, prefs_found tells if preference file exists */
|
||||
void get_xlisp_path(char *p, long p_max, int *prefs_found);
|
||||
void setup_preferences(char *filename);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#include "sndmac.h"
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/* switches.h for Macintosh */
|
||||
|
||||
/* CHANGE LOG
|
||||
* --------------------------------------------------------------------
|
||||
* 28Apr03 dm major reorganization of conditional compilation in Nyquist
|
||||
*/
|
||||
|
||||
|
||||
#define HAS_STDLIB_H 1
|
||||
#undef HAS_SYS_TYPES_H
|
||||
#undef HAS_SYS_STAT_H
|
||||
#define HAS_STAT_H 1
|
||||
#undef HAS_MALLOC_H
|
||||
|
||||
#define HAS_GETTIMEOFDAY 1
|
||||
|
||||
#undef READ_LINE
|
||||
|
||||
#define XL_BIG_ENDIAN 1
|
||||
#undef XL_LITTLE_ENDIAN
|
||||
|
||||
#define USE_RAND 1
|
||||
#undef USE_RANDOM
|
||||
|
||||
/* define this to be printf, or define your own fn of the form
|
||||
void nyquist_printf(char *format, ...);
|
||||
(for a GUI)
|
||||
*/
|
||||
void nyquist_printf(char *format, ...);
|
||||
|
||||
#define NEED_ULONG 1
|
||||
#define NEED_USHORT 1
|
||||
#define NEED_BYTE 1
|
||||
|
||||
#define NEED_ROUND 1
|
||||
|
||||
#undef NEED_DEFINE_MALLOC
|
||||
|
||||
/* explicitly choose a platform */
|
||||
#undef UNIX
|
||||
#undef WINDOWS
|
||||
#undef MICROSOFT
|
||||
#undef DOS
|
||||
#define MACINTOSH 1
|
||||
|
||||
#define BUFFERED_SYNCHRONOUS_INPUT 1
|
||||
#define SPACE_FOR_PLAY 10000
|
||||
#define MAX_CHANNELS 16
|
||||
|
||||
/* this will enable code to read midi files, etc. */
|
||||
#define CMTSTUFF 1
|
||||
|
||||
/* NYQUIST tells some CMT code that we're really in
|
||||
* XLISP and NYQUIST
|
||||
*/
|
||||
#define NYQUIST 1
|
||||
|
||||
#include "swlogic.h"
|
|
@ -0,0 +1,107 @@
|
|||
; system.lsp -- machine/system-dependent definitions
|
||||
; Macintosh
|
||||
|
||||
(setf ny:bigendianp t)
|
||||
|
||||
;; note that *default-sf-format* is used below by
|
||||
;; compute-default-sound-file
|
||||
(if (not (boundp '*default-sf-format*))
|
||||
(setf *default-sf-format* snd-head-AIFF))
|
||||
|
||||
;; note that compute-default-sound-file uses *default-sf-format*,
|
||||
;; so be sure to set *default-sf-format* first (this was just done)
|
||||
(if (not (boundp '*default-sound-file*))
|
||||
(compute-default-sound-file))
|
||||
|
||||
(if (not (boundp '*default-sf-dir*))
|
||||
(setf *default-sf-dir* ""))
|
||||
|
||||
(if (not (boundp '*default-sf-mode*))
|
||||
(setf *default-sf-mode* snd-mode-pcm))
|
||||
|
||||
(if (not (boundp '*default-sf-bits*))
|
||||
(setf *default-sf-bits* 16))
|
||||
|
||||
(if (not (boundp '*default-plot-file*))
|
||||
(setf *default-plot-file* "points.dat"))
|
||||
|
||||
; turn off switch to play sound as it is computed
|
||||
(setf *soundenable* T)
|
||||
|
||||
; local definition for play
|
||||
(defmacro play (expr)
|
||||
`(s-save-autonorm ,expr NY:ALL *default-sound-file* :play *soundenable*))
|
||||
|
||||
(defun r ()
|
||||
(s-save (s-read *default-sound-file*) NY:ALL "" :play t)
|
||||
)
|
||||
|
||||
; PLAY-FILE -- play a file
|
||||
(defun play-file (name)
|
||||
(s-save (s-read name) NY:ALL "" :play t))
|
||||
|
||||
; FULL-NAME-P -- test if file name is a full path or relative path
|
||||
;
|
||||
; (otherwise the *default-sf-dir* will be prepended
|
||||
;
|
||||
(defun full-name-p (filename)
|
||||
(eq (char filename 0) #\:))
|
||||
|
||||
(setf *file-separator* #\:)
|
||||
|
||||
; save the standard function to write points to a file
|
||||
;
|
||||
;(setfn s-plot-points s-plot)
|
||||
|
||||
(defun array-max-abs (points)
|
||||
(let ((m 0.0))
|
||||
(dotimes (i (length points))
|
||||
(setf m (max m (abs (aref points i)))))
|
||||
m))
|
||||
|
||||
(setf graph-width 800)
|
||||
(setf graph-height 220)
|
||||
|
||||
|
||||
(defun s-plot (snd &optional (n 800))
|
||||
(show-graphics)
|
||||
(clear-graphics)
|
||||
(cond ((soundp snd)
|
||||
(s-plot-2 snd n (/ graph-height 2) graph-height nil))
|
||||
(t
|
||||
(let ((gh (/ graph-height (length snd)))
|
||||
hs)
|
||||
(dotimes (i (length snd))
|
||||
(setf hs (s-plot-2 (aref snd i) n (+ (/ gh 2) (* i gh)) gh hs)))))))
|
||||
|
||||
|
||||
(defun s-plot-2 (snd n y-offset graph-height horizontal-scale)
|
||||
(prog ((points (snd-samples snd n))
|
||||
maxpoint horizontal-scale vertical-scale)
|
||||
(setf maxpoint (array-max-abs points))
|
||||
(moveto 0 y-offset)
|
||||
(lineto graph-width y-offset)
|
||||
(moveto 0 y-offset)
|
||||
(cond ((null horizontal-scale)
|
||||
(setf horizontal-scale (/ (float graph-width) (length points)))))
|
||||
(setf vertical-scale (- (/ (float graph-height) 2 maxpoint)))
|
||||
(dotimes (i (length points))
|
||||
(lineto (truncate (* horizontal-scale i))
|
||||
(+ y-offset (truncate (* vertical-scale (aref points i))))))
|
||||
(format t "X Axis: ~A to ~A (seconds)\n" (snd-t0 snd) (/ (length points) (snd-srate snd)))
|
||||
(format t "Y Axis: ~A to ~A\n" (- maxpoint) maxpoint)
|
||||
(format t "~A samples plotted.\n" (length points))
|
||||
(return horizontal-scale)
|
||||
))
|
||||
|
||||
|
||||
|
||||
|
||||
; S-EDIT - run the audio editor on a sound
|
||||
;
|
||||
;(defmacro s-edit (&optional expr)
|
||||
; `(prog ()
|
||||
; (if ,expr (s-save ,expr 1000000000 *default-sound-file*))
|
||||
; (system (format nil "audio_editor ~A &"
|
||||
; (soundfilename *default-sound-file*)))))
|
||||
|
|
@ -0,0 +1 @@
|
|||
/* nothing to do */
|
|
@ -0,0 +1,166 @@
|
|||
README.txt -- Nyquist information for Unix systems
|
||||
|
||||
UNIX INSTALLATION
|
||||
=================
|
||||
For Unix systems, Nyquist is distributed as a compressed file of
|
||||
sources named nyqsrc3<nn>.zip, where <nn> is the version number
|
||||
(e.g. v3.01 was in nyqsrc301.zip). To install Nyquist, copy
|
||||
nyqsrc3<nn>.zip) to the directory on your machine where you would
|
||||
like to install Nyquist.
|
||||
|
||||
Note 1: you will need the "normal tool chain" consisting of the Gnu
|
||||
C/C++ compiler, linker, C/C++ runtime libraries, autoconf, libtool,
|
||||
automake, etc. Most linux installations already have this, but some
|
||||
more recent trimmed-down installations for netbooks and
|
||||
consumer-oriented computers do not have compilers installed by
|
||||
default.
|
||||
|
||||
Note 2: There are two main unix versions of Nyquist: alsa and nonalsa.
|
||||
The alsa version is probably what you want. This version uses ALSA,
|
||||
the Linux audio system. This has also become standard, but your
|
||||
machine might not have the ALSA development package (probably named
|
||||
libasound2-dev), so you might have to install it. If you find you are
|
||||
missing "asound", you are missing and need to install the ALSA
|
||||
developmnent package. The nonalsa version is a special version for
|
||||
Debian linux. The ONLY difference is that it omits -lasound from the
|
||||
link step, so it does not try to link with ALSA. I assume this works
|
||||
because the PortAudio library which is included in the Nyquist sources
|
||||
configures itself differently on Debian and doesn't need ALSA.
|
||||
|
||||
After unzipping sources, type:
|
||||
|
||||
gunzip nyqsrc3<nn>.zip
|
||||
cd nyquist
|
||||
# In the following line, Debian linux users should
|
||||
# type "nonalsa" in place of "alsa":
|
||||
ln -s sys/unix/alsa/Makefile Makefile
|
||||
setenv XLISPPATH `pwd`/runtime:`pwd`/lib
|
||||
make
|
||||
|
||||
(For bash shell users, instead of the setenv command, use this:
|
||||
|
||||
export XLISPPATH=`pwd`/runtime:`pwd`/lib
|
||||
)
|
||||
|
||||
The first line creates a nyquist directory and some
|
||||
subdirectories. The second line (cd) changes directories to the new
|
||||
nyquist directory. The third line (ln) makes a link from the top-level
|
||||
directory to the Makefile for your system. In place of "alsa" in
|
||||
sys/unix/alsa/Makefile, you should substitute your system
|
||||
type. Current systems are alsa, nonalsa, next, pmax, rs6k, sgi, and
|
||||
sparc, but since only the alsa and nonalsa versions have been tested
|
||||
in recent years, do not expect anything else to work. The setenv (or
|
||||
export) command tells Nyquist where to search for lisp files to be
|
||||
loaded when a file is not found in the current directory. See
|
||||
SHELL STARTUP below for information about how to automate this.
|
||||
|
||||
64-BIT UBUNTU
|
||||
=============
|
||||
if xlisp/extern.c fails to compile because of a missing bits/predefs.h,
|
||||
try using synaptic to update libc6 and libc6-i386 and libc6-dev-i386, or
|
||||
try sudo apt-get install libc6-dev-i386
|
||||
|
||||
you may need to install nasm
|
||||
you may need to install build-essential and g++
|
||||
you may need to install lib32asound2-dev
|
||||
you may need to install lib32stdc++
|
||||
you may need to install g++multilib
|
||||
you may need to install libogg-dev
|
||||
you may need to install libvorbis-dev
|
||||
you may need to install Java (perhaps as follows):
|
||||
download jdk-7u2-linux-x64.tar.gz from
|
||||
http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u2-download-1377129.html
|
||||
tar xfvz jdk-7u2-linux-x64.tar.gz
|
||||
sudo mv ./jdk1.7.0_02 /usr/lib/jvm/jdk1.7.0
|
||||
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
|
||||
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
|
||||
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
|
||||
sudo update-alternatives --config java
|
||||
java -version [check that output is 1.7.0_02"]
|
||||
sudo update-alternatives --config javac
|
||||
sudo update-alternatives --config java
|
||||
|
||||
|
||||
|
||||
RUNNING NYQUIST FROM THE COMMAND LINE
|
||||
=====================================
|
||||
Assuming the make completes successfully, you can run Nyquist as follows:
|
||||
./ny
|
||||
When you get the prompt, you may begin typing expressions such as
|
||||
the ones in the following "Examples" section in the Nyquist
|
||||
manual. (See doc/nyquistman.pdf or doc/home.html).
|
||||
|
||||
RUNNING NYQUIST USING NyquistIDE
|
||||
=====================================
|
||||
One you establish that Nyquist (ny) is working from the command line,
|
||||
you should try using NyquistIDE, the Java-based Nyquist development
|
||||
environment. First, make jny executable (do this only once when you
|
||||
install Nyquist):
|
||||
chmod +x jny
|
||||
Then try running jNyqIDE by typing:
|
||||
./jny
|
||||
|
||||
If the NyquistIDE window does not appear, make sure you have Java
|
||||
installed (if not, you probably already encountered errors when you
|
||||
ran the make command.) You can also try recompiling the Java
|
||||
files. Note that jnyqide/SpecialMacHandler.java will NOT compile
|
||||
under non-OS X systems. The Makefile renames this file to "hide" it
|
||||
from the Java compiler, compiles all the remaining java files, and
|
||||
then restores jnyqide/SpecialMacHandler.java:
|
||||
make jnyqide/jNyqIDE.jar
|
||||
|
||||
NYQUIST SEARCH PATH UNDER NyquistIDE
|
||||
====================================
|
||||
Note: With Linux and Mac OS X, jNyqIDE defines the environment passed
|
||||
to Nyquist. If you set XLISPPATH as shown above, it will be passed
|
||||
along to Nyquist under jNyqIDE. If not, a default XLISPPATH will have
|
||||
the lib and runtime directories only. This does not apply to Windows
|
||||
because even though the environment is there, the Windows version of
|
||||
Nyquist reads the XLISPPATH from the Registry.
|
||||
|
||||
You can also specify the search path by creating the file
|
||||
nyquist/xlisppath, which should have colon-separated paths on a single
|
||||
(long) line of text. This file will override the environment variable
|
||||
XLISPPATH.
|
||||
|
||||
MORE DETAILS
|
||||
============
|
||||
It is good to have USER in the environment with your user ID. This
|
||||
string is used to construct some file names. NyquistIDE will look for it
|
||||
in the environment. You can also specify your user ID using the file
|
||||
nyquist/user, but if you have a shared installation of Nyquist,
|
||||
this will not be very useful.
|
||||
|
||||
Note: Nyquist looks for the file init.lsp in the current directory.
|
||||
If you look in the init.lsp in runtime, you will notice two things.
|
||||
First, init.lsp loads nyquist.lsp from the Nyquist directory, and
|
||||
second, init.lsp loads system.lsp which in turn defines the macro
|
||||
play. Normally, Nyquist plays audio through the PortAudio library,
|
||||
which should work on any system. An alternative is to save audio to a
|
||||
file and invoke a local non-Nyquist program to play the sound file.
|
||||
You can modify system.lsp to accomplish this.
|
||||
|
||||
SHELL STARTUP
|
||||
=============
|
||||
The (runtime
|
||||
directory should always be on your XLISPPATH when you run Nyquist, so
|
||||
you may want to set XLISPPATH in your shell startup file, e.g. .cshrc.
|
||||
|
||||
Which shell are you using? echo $SHELL will tell you. If you use
|
||||
/bin/bash, your startup file is probably ~/.profile. (Remember that
|
||||
"~/" means your home directory, so the file will be something like
|
||||
/home/rbd/.profile). In this file, you can add a line such as:
|
||||
|
||||
export XLISPPATH="/home/rbd/nyquist/runtime:/home/rbd/nyquist/lib"
|
||||
|
||||
Do not use the shorthand `pwd`/runtime, because `pwd` returns the
|
||||
current working directory, which is not going to be your Nyquist
|
||||
directory when .profile is loaded.
|
||||
|
||||
If you use /bin/csh (the C Shell), your startup file is probably
|
||||
~/.cshrc. (Remember that "~/" means your home directory, so the file
|
||||
will be something like /home/rbd/.profile). In this file, you can add
|
||||
a line such as:
|
||||
|
||||
setenv XLISPPATH "/home/rbd/nyquist/runtime:/home/rbd/nyquist/lib"
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,101 @@
|
|||
;; system.lsp -- system-dependent lisp code
|
||||
|
||||
; local definition for play
|
||||
; this one is for Linux:
|
||||
|
||||
(if (not (boundp '*default-sf-format*))
|
||||
(setf *default-sf-format* snd-head-wave))
|
||||
|
||||
(if (not (boundp '*default-sound-file*))
|
||||
(compute-default-sound-file))
|
||||
|
||||
(if (not (boundp '*default-sf-dir*))
|
||||
(setf *default-sf-dir* "./"))
|
||||
|
||||
(if (not (boundp '*default-sf-mode*))
|
||||
(setf *default-sf-mode* snd-mode-pcm))
|
||||
|
||||
(if (not (boundp '*default-sf-bits*))
|
||||
(setf *default-sf-bits* 16))
|
||||
|
||||
(if (not (boundp '*default-plot-file*))
|
||||
(setf *default-plot-file* (strcat (get-user) "-points.dat")))
|
||||
|
||||
|
||||
; FULL-NAME-P -- test if file name is a full path or relative path
|
||||
;
|
||||
; (otherwise the *default-sf-dir* will be prepended
|
||||
;
|
||||
(defun full-name-p (filename)
|
||||
(or (eq (char filename 0) #\/)
|
||||
(eq (char filename 0) #\.)))
|
||||
|
||||
; RELATIVE-PATH-P -- test if filename or path is a relative path
|
||||
;
|
||||
(defun relative-path-p (filename)
|
||||
(not (eq (char filename 0) #\/)))
|
||||
|
||||
(setf *file-separator* #\/)
|
||||
|
||||
|
||||
;; PLAY-FILE - play a sound file
|
||||
;;
|
||||
(defun play-file (name)
|
||||
;;
|
||||
;; WARNING: if you invoke an external program to play files,
|
||||
;; but Nyquist uses internal (portaudio) interface to
|
||||
;; play synthesized sound, Nyquist may fail to open the
|
||||
;; sound device while it is playing a sound file and then
|
||||
;; refuse to play anything. -RBD dec05
|
||||
;; (system (strcat "sndplay " (soundfilename name))))
|
||||
;; (system (strcat "play " (soundfilename name) )))
|
||||
;;
|
||||
(play (s-read (soundfilename name))))
|
||||
|
||||
;; R - replay last file written with PLAY
|
||||
(defun r () (play-file *default-sound-file*))
|
||||
|
||||
;;;; use this old version if you want to use sndplay to play
|
||||
;;;; the result file rather than play the samples as they
|
||||
;;;; are computed. This version does not autonormalize.
|
||||
;; PLAY - write value of an expression to file and play it
|
||||
;;
|
||||
;(defmacro play (expr)
|
||||
; `(prog (specs)
|
||||
; (setf specs (s-save (force-srate *sound-srate* ,expr)
|
||||
; 1000000000 *default-sound-file*))
|
||||
; (r)))
|
||||
;;;;
|
||||
|
||||
; local definition for play
|
||||
(defmacro play (expr)
|
||||
`(s-save-autonorm ,expr NY:ALL *default-sound-file* :play *soundenable*))
|
||||
|
||||
;; for Linux, modify s-plot (defined in nyquist.lsp) by saving s-plot
|
||||
;; in standard-s-plot, then call gnuplot to display the points.
|
||||
;;
|
||||
;; we also need to save the location of this file so we can find
|
||||
;; nyquist-plot.txt, the command file for gnuplot
|
||||
;;
|
||||
;; This code is broken in the following ways:
|
||||
;; it tries to run gnuplot even when plotting can be done by NyquistIDE
|
||||
;; it plots "points.dat", but "points.dat" may not be correct
|
||||
;; (see *default-plot-file*)
|
||||
;; it assumes the plot file is in the current directory, but it
|
||||
;; by default goes to the sound file directory
|
||||
;;
|
||||
;; Fix this code or complain if you want to plot with gnuplot while
|
||||
;; running ny (or even NyquistIDE (jny) if you want). Otherwise, use
|
||||
;; NyquistIDE to get s-plot to work.
|
||||
;;
|
||||
;(setf *runtime-path* (current-path))
|
||||
;(display "system.lsp" *runtime-path*)
|
||||
;
|
||||
;(setfn standard-s-plot s-plot)
|
||||
;
|
||||
;(defun s-plot (s &optional (dur 2.0) (n 1000))
|
||||
; (let (plot-file)
|
||||
; (standard-s-plot s dur n) ;; this calculates the data points
|
||||
; (setf plot-file (strcat *runtime-path* "nyquist-plot.txt"))
|
||||
; (system (strcat "gnuplot -persist " plot-file))))
|
||||
|
|
@ -0,0 +1 @@
|
|||
cp -Rp ../current/* /afs/cs/project/music/proj/nyquist/current
|
|
@ -0,0 +1,14 @@
|
|||
mkdir ../TMP
|
||||
mv ny ../TMP
|
||||
mv runtime/system.lsp ../TMP
|
||||
mv Makefile ../TMP
|
||||
mv test ../TMP
|
||||
set NYQDIR=`pwd`
|
||||
cd ..
|
||||
ln -fs $NYQDIR nyquist
|
||||
tar -cvhf - nyquist | compress > nyquist.tar.Z
|
||||
cd $NYQDIR
|
||||
mv ../TMP/test .
|
||||
mv ../TMP/Makefile .
|
||||
mv ../TMP/system.lsp runtime
|
||||
mv ../TMP/ny .
|
|
@ -0,0 +1,79 @@
|
|||
;; update.lsp -- script to push changes into source directories
|
||||
|
||||
(load "makefile.lsp") ; just to make sure we got the latest bindings
|
||||
|
||||
|
||||
;; UPDATE-SOURCES -- makes a script to push changes into source directories
|
||||
;;
|
||||
(defun update-sources ()
|
||||
(let (outf)
|
||||
(load "transfiles.lsp") ; just to make sure we're current
|
||||
(setf outf (open "script" :direction :output))
|
||||
(format outf "#
|
||||
# source this script file
|
||||
|
||||
# Source Paths: nyqsrc, cmtsrc, xlsrc, trnsrc
|
||||
")
|
||||
(format outf "
|
||||
#
|
||||
# XLISP SOURCES
|
||||
#
|
||||
")
|
||||
(file-update outf xlfiles ".c" "xlsrc")
|
||||
(file-update outf xlfiles-h ".h" "xlsrc")
|
||||
(file-update outf xlfiles-lsp ".lsp" "xlsrc")
|
||||
|
||||
(format outf "
|
||||
#
|
||||
# NYQUIST SOURCES
|
||||
#
|
||||
")
|
||||
(file-update outf nyqfiles ".c" "nyqsrc")
|
||||
(file-update outf (exceptions-filter nyqfiles) ".h" "nyqsrc")
|
||||
(file-update outf nyqfiles-h ".h" "nyqsrc")
|
||||
(file-update outf nyqfiles-lsp ".lsp" "nyqsrc")
|
||||
(file-update outf makefiles "" "nyqsrc")
|
||||
|
||||
(format outf "
|
||||
#
|
||||
# CMT SOURCES
|
||||
#
|
||||
")
|
||||
(file-update outf cmtfiles ".c" "cmtsrc")
|
||||
(file-update outf (exceptions-filter cmtfiles) ".h" "cmtsrc")
|
||||
(file-update outf cmtfiles-h ".h" "cmtsrc")
|
||||
|
||||
; don't write back machine generated trnsrc files
|
||||
; (file-update outf transfiles ".c" "trnsrc")
|
||||
; (file-update outf transfiles ".h" "trnsrc")
|
||||
|
||||
(close outf)
|
||||
|
||||
(format t "DONE writing script, 'source script' to copy files from~%")
|
||||
(format t "this directory to the source directories~%")
|
||||
|
||||
))
|
||||
|
||||
|
||||
;; EXCEPTIONS-FILTER - remove .h files from list
|
||||
; the depends-exceptions tells whether a .h file exists for a .c file
|
||||
;;
|
||||
(defun exceptions-filter (files)
|
||||
(let (result)
|
||||
(dolist (f files)
|
||||
(let ((ex (assoc f depends-exceptions :test #'equal)))
|
||||
(cond (ex
|
||||
(if (and (cdr ex)
|
||||
(string-search (strcat f ".h") (cadr ex)))
|
||||
(push f result)))
|
||||
(t (push f result)))))
|
||||
result))
|
||||
|
||||
|
||||
;; FILE-UPDATE -- write dependency for source files
|
||||
;;
|
||||
(defun file-update (outf files ext dir)
|
||||
(dolist (f files)
|
||||
(let ((fname (strcat f ext)))
|
||||
(format outf "cp -p ~A ~A/~A~%" fname dir fname))))
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* File io.c
|
||||
**********************************************************************
|
||||
*
|
||||
* Non blocking input routine
|
||||
* Works by puttng the terminal in CBREAK mode and using the FIONREAD
|
||||
* ioctl call to determine the number of characters in the input queue
|
||||
*/
|
||||
|
||||
#include "stdio.h"
|
||||
#include "io.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <signal.h>
|
||||
#include <sgtty.h>
|
||||
#include "cext.h"
|
||||
|
||||
int IOinputfd; /* input file descriptor (usually 0) */
|
||||
|
||||
int IOnochar; /* Value to be returned by IOgetchar()
|
||||
where there is no input to be had */
|
||||
|
||||
static struct sgttyb IOoldmodes, IOcurrentmodes;
|
||||
/* Initial and current tty modes */
|
||||
|
||||
/*
|
||||
* IOsetup(inputfd)
|
||||
* Args:
|
||||
* inputfd - input file descriptor (should be zero for standard input)
|
||||
* Returns:
|
||||
* 0 - if all goes well
|
||||
* -1 - if an ioctl fails (also calls perror)
|
||||
* Side Effects:
|
||||
* Puts the terminal in CBREAK mode - before process termination
|
||||
* IOcleanup() should be called to restore old terminal modes
|
||||
* Catch's interrupts (if they are not already being caught) and
|
||||
* calls IOcleanup before exiting
|
||||
*
|
||||
*/
|
||||
|
||||
#define ERROR(s) return (perror(s), -1)
|
||||
|
||||
IOsetup(inputfd)
|
||||
{
|
||||
static IOdiegracefully();
|
||||
int (*interrupt_handler)();
|
||||
|
||||
IOinputfd = inputfd;
|
||||
IOnochar = NOCHAR;
|
||||
|
||||
if(ioctl(IOinputfd, TIOCGETP, &IOoldmodes) < 0)
|
||||
ERROR("IOsetup");
|
||||
|
||||
IOcurrentmodes = IOoldmodes;
|
||||
IOcurrentmodes.sg_flags |= CBREAK;
|
||||
IOcurrentmodes.sg_flags &= ~ECHO;
|
||||
if(ioctl(IOinputfd, TIOCSETP, &IOcurrentmodes))
|
||||
ERROR("IOsetup-2");
|
||||
|
||||
if( (interrupt_handler = signal(SIGINT, IOdiegracefully)) != 0)
|
||||
signal(SIGINT, interrupt_handler);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
IOdiegracefully()
|
||||
{
|
||||
write(2, "\nBye\n", 5);
|
||||
IOcleanup();
|
||||
EXIT(2);
|
||||
}
|
||||
|
||||
/*
|
||||
* IOcleanup()
|
||||
* Returns:
|
||||
* 0 - if all goes well
|
||||
* -1 - if an ioctl fails (also calls perror)
|
||||
* Side Effects:
|
||||
* Restores initial terminal modes
|
||||
*/
|
||||
|
||||
IOcleanup()
|
||||
{
|
||||
if(ioctl(IOinputfd, TIOCSETP, &IOoldmodes) < 0)
|
||||
ERROR("IOclean");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* IOgetchar()
|
||||
* Returns:
|
||||
* A character off the input queue if there is one,
|
||||
* IOnochar if there is no character waiting to be read,
|
||||
* -1 if an ioctl fails (shouldn't happen if IOsetup went OK)
|
||||
*/
|
||||
|
||||
#ifndef UNIX_MACH
|
||||
|
||||
IOgetchar()
|
||||
{
|
||||
int n;
|
||||
char c;
|
||||
|
||||
if(ioctl(IOinputfd, FIONREAD, &n) < 0)
|
||||
ERROR("IOgetchar");
|
||||
if(n <= 0)
|
||||
return IOnochar;
|
||||
switch(read(IOinputfd, &c, 1)) {
|
||||
case 1:
|
||||
return c;
|
||||
case 0:
|
||||
return EOF;
|
||||
default:
|
||||
ERROR("IOgetchar-read");
|
||||
}
|
||||
}
|
||||
|
||||
IOgetchar2()
|
||||
{
|
||||
int nfds, readfds = 1 << IOinputfd;
|
||||
char c;
|
||||
static struct timeval zero;
|
||||
|
||||
if(IOinputfd < 0 || IOinputfd >= 32) {
|
||||
printf("IOgetchar2: bad IOinputfd (%d)%s\n", IOinputfd,
|
||||
IOinputfd == -1 ? "Did you call IOsetup(fd)?" : "");
|
||||
}
|
||||
nfds = select(32, &readfds, 0, 0, &zero);
|
||||
if(nfds > 0) {
|
||||
switch(read(IOinputfd, &c, 1)) {
|
||||
case 0:
|
||||
return EOF;
|
||||
case 1:
|
||||
return c;
|
||||
default:
|
||||
printf("IOgetchar2: read failed!\n");
|
||||
return NOCHAR;
|
||||
}
|
||||
}
|
||||
else if(nfds < 0)
|
||||
printf("IOgetchar2: select failed!\n");
|
||||
return NOCHAR;
|
||||
}
|
||||
|
||||
/*
|
||||
* IOwaitchar()
|
||||
* Returns:
|
||||
* A character off the input queue. Waits if necessary.
|
||||
*/
|
||||
|
||||
int IOwaitchar()
|
||||
{
|
||||
char c;
|
||||
if (read(IOinputfd, &c, 1) == 1) return c;
|
||||
else return EOF;
|
||||
}
|
||||
|
||||
#endif /* UNIX_MACH */
|
|
@ -0,0 +1,9 @@
|
|||
#define NOCHAR -2
|
||||
|
||||
int IOinputfd;
|
||||
int IOnochar;
|
||||
|
||||
int IOsetup(int inputfd);
|
||||
int IOcleanup(void);
|
||||
int IOgetchar(void);
|
||||
int IOwaitchar(void);
|
|
@ -0,0 +1,521 @@
|
|||
#
|
||||
# Makefile for Nyquist, SYSTEM-TYPE is NEXT
|
||||
# run make in the top-level Nyquist directory to compile Nyquist
|
||||
#
|
||||
# NOTE: this file is machine-generated. DO NOT EDIT!
|
||||
# Instead, modify makefile.lsp and regenerate the makefile.
|
||||
# Ports and bug fixes are welcome - please mail them to
|
||||
# dannenberg@cs.cmu.edu. Thanks.
|
||||
#
|
||||
|
||||
# This is the resulting executable (normally "ny"):
|
||||
NY = ny
|
||||
|
||||
# Standard list of includes (common to all unix versions)
|
||||
INCL = -Inyqsrc -Itran -Ixlisp -Isys/unix -Icmt -Isnd -Ifft
|
||||
|
||||
# system dependent stuff for next:
|
||||
|
||||
CC = cc
|
||||
CFLAGS = -DCMTSTUFF -O $(INCL)
|
||||
LN = cc
|
||||
LFLAGS = -lm
|
||||
|
||||
|
||||
INTGEN = misc/intgen
|
||||
|
||||
# Object files for Nyquist:
|
||||
OBJECTS = xlisp/extern.o xlisp/xldmem.o xlisp/xlbfun.o xlisp/xlcont.o \
|
||||
xlisp/xldbug.o xlisp/xleval.o xlisp/xlfio.o xlisp/xlftab.o \
|
||||
xlisp/xlglob.o xlisp/xlimage.o xlisp/xlinit.o xlisp/xlio.o \
|
||||
xlisp/xlisp.o xlisp/xljump.o xlisp/xllist.o xlisp/xlmath.o \
|
||||
xlisp/xlobj.o xlisp/xlpp.o xlisp/xlprin.o xlisp/xlread.o \
|
||||
xlisp/xlstr.o xlisp/xlsubr.o xlisp/xlsym.o xlisp/xlsys.o \
|
||||
tran/amosc.o tran/clip.o tran/const.o tran/fmosc.o \
|
||||
tran/integrate.o tran/log.o tran/maxv.o tran/osc.o \
|
||||
tran/prod.o tran/buzz.o tran/pwl.o tran/recip.o \
|
||||
tran/upsample.o tran/scale.o tran/sine.o tran/partial.o \
|
||||
tran/white.o tran/tone.o tran/tonev.o tran/atonev.o \
|
||||
tran/atone.o tran/reson.o tran/areson.o tran/resonvc.o \
|
||||
tran/resoncv.o tran/aresonvc.o tran/aresoncv.o tran/resonvv.o \
|
||||
tran/aresonvv.o tran/offset.o tran/slope.o tran/delay.o \
|
||||
tran/delaycv.o tran/shape.o tran/sampler.o tran/exp.o \
|
||||
tran/siosc.o tran/follow.o tran/gate.o tran/quantize.o \
|
||||
tran/ifft.o tran/congen.o tran/fromobject.o tran/fromarraystream.o \
|
||||
tran/coterm.o tran/convolve.o tran/alpass.o tran/oneshot.o \
|
||||
tran/chase.o tran/tapv.o tran/biquad.o tran/pluck.o \
|
||||
cmt/cext.o cmt/cleanup.o cmt/cmdline.o cmt/cmtcmd.o \
|
||||
cmt/moxc.o cmt/mem.o cmt/midifile.o cmt/midifns.o \
|
||||
cmt/record.o cmt/seq.o cmt/seqmread.o cmt/seqmwrite.o \
|
||||
cmt/seqread.o cmt/seqwrite.o cmt/tempomap.o cmt/timebase.o \
|
||||
cmt/userio.o nyqsrc/debug.o nyqsrc/falloc.o nyqsrc/add.o \
|
||||
nyqsrc/local.o nyqsrc/downsample.o nyqsrc/handlers.o nyqsrc/multiread.o \
|
||||
nyqsrc/multiseq.o nyqsrc/samples.o nyqsrc/seqext.o nyqsrc/seqinterf.o \
|
||||
nyqsrc/sndread.o nyqsrc/sndseq.o nyqsrc/sndwrite.o nyqsrc/sndmax.o \
|
||||
nyqsrc/sound.o nyqsrc/stats.o nyqsrc/compose.o nyqsrc/inverse.o \
|
||||
nyqsrc/resamp.o nyqsrc/resampv.o nyqsrc/ffilterkit.o nyqsrc/avg.o \
|
||||
nyqsrc/fft.o nyqsrc/sndfail.o fft/fftn.o nyqsrc/sndfnint.o \
|
||||
nyqsrc/seqfnint.o snd/audionext.o snd/sndnext.o snd/ieeecvt.o \
|
||||
snd/snd.o snd/sndcvt.o snd/sndio.o snd/sndheader.o \
|
||||
sys/unix/osstuff.o sys/unix/term.o
|
||||
|
||||
# Sound functions to add to xlisp
|
||||
NYQHDRS = snd/snd.h nyqsrc/sound.h nyqsrc/downsample.h nyqsrc/sndread.h \
|
||||
nyqsrc/sndseq.h nyqsrc/add.h nyqsrc/multiseq.h nyqsrc/samples.h \
|
||||
nyqsrc/sndwrite.h nyqsrc/sndmax.h nyqsrc/compose.h nyqsrc/inverse.h \
|
||||
nyqsrc/resamp.h nyqsrc/resampv.h nyqsrc/fft.h nyqsrc/avg.h \
|
||||
tran/amosc.h tran/clip.h tran/const.h tran/fmosc.h \
|
||||
tran/integrate.h tran/log.h tran/maxv.h tran/osc.h \
|
||||
tran/prod.h tran/buzz.h tran/pwl.h tran/recip.h \
|
||||
tran/upsample.h tran/scale.h tran/sine.h tran/partial.h \
|
||||
tran/white.h tran/tone.h tran/tonev.h tran/atonev.h \
|
||||
tran/atone.h tran/reson.h tran/areson.h tran/resonvc.h \
|
||||
tran/resoncv.h tran/aresonvc.h tran/aresoncv.h tran/resonvv.h \
|
||||
tran/aresonvv.h tran/offset.h tran/slope.h tran/delaycc.h \
|
||||
tran/delaycv.h tran/shape.h tran/sampler.h tran/exp.h \
|
||||
tran/siosc.h tran/follow.h tran/gate.h tran/quantize.h \
|
||||
tran/ifft.h tran/congen.h tran/fromobject.h tran/fromarraystream.h \
|
||||
tran/coterm.h tran/convolve.h tran/alpass.h tran/oneshot.h \
|
||||
tran/chase.h tran/tapv.h tran/biquad.h tran/pluck.h
|
||||
|
||||
CMTHDRS = cmt/seqdecls.h nyqsrc/seqext.h cmt/seq.h nyqsrc/seqinterf.h \
|
||||
cmt/seqread.h cmt/seqmread.h cmt/seqwrite.h cmt/seqmwrite.h
|
||||
|
||||
|
||||
EVERYTHING = $(NY) runtime/system.lsp
|
||||
|
||||
CURRENT = $(EVERYTHING)
|
||||
|
||||
current: $(CURRENT)
|
||||
|
||||
$(NY): $(OBJECTS)
|
||||
$(LN) $(OBJECTS) $(LFLAGS) -o $(NY)
|
||||
|
||||
# copy appropriate system.lsp and make it read-only;
|
||||
# changes should be made to sys/unix/<system>/system.lsp
|
||||
runtime/system.lsp: sys/unix/next/system.lsp
|
||||
chmod +w runtime/system.lsp
|
||||
cp -p sys/unix/next/system.lsp runtime/system.lsp
|
||||
chmod -w runtime/system.lsp
|
||||
|
||||
nyqsrc/debug.o: nyqsrc/debug.c nyqsrc/debug.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/debug.c -o nyqsrc/debug.o $(CFLAGS)
|
||||
|
||||
nyqsrc/falloc.o: nyqsrc/falloc.c nyqsrc/falloc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/falloc.c -o nyqsrc/falloc.o $(CFLAGS)
|
||||
|
||||
nyqsrc/add.o: nyqsrc/add.c nyqsrc/add.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/add.c -o nyqsrc/add.o $(CFLAGS)
|
||||
|
||||
nyqsrc/local.o: nyqsrc/local.c xlisp/xlisp.h nyqsrc/sound.h
|
||||
cc -c nyqsrc/local.c -o nyqsrc/local.o $(CFLAGS)
|
||||
|
||||
nyqsrc/downsample.o: nyqsrc/downsample.c nyqsrc/downsample.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/downsample.c -o nyqsrc/downsample.o $(CFLAGS)
|
||||
|
||||
nyqsrc/handlers.o: nyqsrc/handlers.c
|
||||
cc -c nyqsrc/handlers.c -o nyqsrc/handlers.o $(CFLAGS)
|
||||
|
||||
nyqsrc/multiread.o: nyqsrc/multiread.c nyqsrc/multiread.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/multiread.c -o nyqsrc/multiread.o $(CFLAGS)
|
||||
|
||||
nyqsrc/multiseq.o: nyqsrc/multiseq.c nyqsrc/multiseq.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/multiseq.c -o nyqsrc/multiseq.o $(CFLAGS)
|
||||
|
||||
nyqsrc/samples.o: nyqsrc/samples.c nyqsrc/samples.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/samples.c -o nyqsrc/samples.o $(CFLAGS)
|
||||
|
||||
nyqsrc/seqext.o: nyqsrc/seqext.c nyqsrc/seqext.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/seqext.c -o nyqsrc/seqext.o $(CFLAGS)
|
||||
|
||||
nyqsrc/seqinterf.o: nyqsrc/seqinterf.c nyqsrc/seqinterf.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/seqinterf.c -o nyqsrc/seqinterf.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sndread.o: nyqsrc/sndread.c nyqsrc/sndread.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/sndread.c -o nyqsrc/sndread.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sndseq.o: nyqsrc/sndseq.c nyqsrc/sndseq.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/sndseq.c -o nyqsrc/sndseq.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sndwrite.o: nyqsrc/sndwrite.c nyqsrc/sndwrite.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/sndwrite.c -o nyqsrc/sndwrite.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sndmax.o: nyqsrc/sndmax.c nyqsrc/sndmax.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/sndmax.c -o nyqsrc/sndmax.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sound.o: nyqsrc/sound.c nyqsrc/sound.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/sound.c -o nyqsrc/sound.o $(CFLAGS)
|
||||
|
||||
nyqsrc/stats.o: nyqsrc/stats.c nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/stats.c -o nyqsrc/stats.o $(CFLAGS)
|
||||
|
||||
nyqsrc/compose.o: nyqsrc/compose.c nyqsrc/compose.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/compose.c -o nyqsrc/compose.o $(CFLAGS)
|
||||
|
||||
nyqsrc/inverse.o: nyqsrc/inverse.c nyqsrc/inverse.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/inverse.c -o nyqsrc/inverse.o $(CFLAGS)
|
||||
|
||||
nyqsrc/resamp.o: nyqsrc/resamp.c nyqsrc/resamp.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/resamp.c -o nyqsrc/resamp.o $(CFLAGS)
|
||||
|
||||
nyqsrc/resampv.o: nyqsrc/resampv.c nyqsrc/resampv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/resampv.c -o nyqsrc/resampv.o $(CFLAGS)
|
||||
|
||||
nyqsrc/ffilterkit.o: nyqsrc/ffilterkit.c nyqsrc/ffilterkit.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/ffilterkit.c -o nyqsrc/ffilterkit.o $(CFLAGS)
|
||||
|
||||
nyqsrc/avg.o: nyqsrc/avg.c nyqsrc/avg.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/avg.c -o nyqsrc/avg.o $(CFLAGS)
|
||||
|
||||
nyqsrc/fft.o: nyqsrc/fft.c nyqsrc/fft.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/fft.c -o nyqsrc/fft.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sndfail.o: nyqsrc/sndfail.c
|
||||
cc -c nyqsrc/sndfail.c -o nyqsrc/sndfail.o $(CFLAGS)
|
||||
|
||||
snd/audionext.o: snd/audionext.c snd/snd.h
|
||||
cc -c snd/audionext.c -o snd/audionext.o $(CFLAGS)
|
||||
|
||||
snd/sndnext.o: snd/sndnext.c snd/sndnext.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c snd/sndnext.c -o snd/sndnext.o $(CFLAGS)
|
||||
|
||||
snd/ieeecvt.o: snd/ieeecvt.c snd/ieeecvt.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c snd/ieeecvt.c -o snd/ieeecvt.o $(CFLAGS)
|
||||
|
||||
snd/snd.o: snd/snd.c snd/snd.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c snd/snd.c -o snd/snd.o $(CFLAGS)
|
||||
|
||||
snd/sndcvt.o: snd/sndcvt.c snd/snd.h
|
||||
cc -c snd/sndcvt.c -o snd/sndcvt.o $(CFLAGS)
|
||||
|
||||
snd/sndio.o: snd/sndio.c snd/snd.h
|
||||
cc -c snd/sndio.c -o snd/sndio.o $(CFLAGS)
|
||||
|
||||
snd/sndheader.o: snd/sndheader.c snd/sndheader.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c snd/sndheader.c -o snd/sndheader.o $(CFLAGS)
|
||||
|
||||
fft/fftn.o: fft/fftn.c fft/fftn.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c fft/fftn.c -o fft/fftn.o $(CFLAGS)
|
||||
|
||||
tran/amosc.o: tran/amosc.c tran/amosc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/amosc.c -o tran/amosc.o $(CFLAGS)
|
||||
|
||||
tran/clip.o: tran/clip.c tran/clip.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/clip.c -o tran/clip.o $(CFLAGS)
|
||||
|
||||
tran/const.o: tran/const.c tran/const.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/const.c -o tran/const.o $(CFLAGS)
|
||||
|
||||
tran/fmosc.o: tran/fmosc.c tran/fmosc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/fmosc.c -o tran/fmosc.o $(CFLAGS)
|
||||
|
||||
tran/integrate.o: tran/integrate.c tran/integrate.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/integrate.c -o tran/integrate.o $(CFLAGS)
|
||||
|
||||
tran/log.o: tran/log.c tran/log.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/log.c -o tran/log.o $(CFLAGS)
|
||||
|
||||
tran/maxv.o: tran/maxv.c tran/maxv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/maxv.c -o tran/maxv.o $(CFLAGS)
|
||||
|
||||
tran/osc.o: tran/osc.c tran/osc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/osc.c -o tran/osc.o $(CFLAGS)
|
||||
|
||||
tran/prod.o: tran/prod.c tran/prod.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/prod.c -o tran/prod.o $(CFLAGS)
|
||||
|
||||
tran/buzz.o: tran/buzz.c tran/buzz.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/buzz.c -o tran/buzz.o $(CFLAGS)
|
||||
|
||||
tran/pwl.o: tran/pwl.c tran/pwl.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/pwl.c -o tran/pwl.o $(CFLAGS)
|
||||
|
||||
tran/recip.o: tran/recip.c tran/recip.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/recip.c -o tran/recip.o $(CFLAGS)
|
||||
|
||||
tran/upsample.o: tran/upsample.c tran/upsample.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/upsample.c -o tran/upsample.o $(CFLAGS)
|
||||
|
||||
tran/scale.o: tran/scale.c tran/scale.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/scale.c -o tran/scale.o $(CFLAGS)
|
||||
|
||||
tran/sine.o: tran/sine.c tran/sine.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/sine.c -o tran/sine.o $(CFLAGS)
|
||||
|
||||
tran/partial.o: tran/partial.c tran/partial.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/partial.c -o tran/partial.o $(CFLAGS)
|
||||
|
||||
tran/white.o: tran/white.c tran/white.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/white.c -o tran/white.o $(CFLAGS)
|
||||
|
||||
tran/tone.o: tran/tone.c tran/tone.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/tone.c -o tran/tone.o $(CFLAGS)
|
||||
|
||||
tran/tonev.o: tran/tonev.c tran/tonev.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/tonev.c -o tran/tonev.o $(CFLAGS)
|
||||
|
||||
tran/atonev.o: tran/atonev.c tran/atonev.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/atonev.c -o tran/atonev.o $(CFLAGS)
|
||||
|
||||
tran/atone.o: tran/atone.c tran/atone.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/atone.c -o tran/atone.o $(CFLAGS)
|
||||
|
||||
tran/reson.o: tran/reson.c tran/reson.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/reson.c -o tran/reson.o $(CFLAGS)
|
||||
|
||||
tran/areson.o: tran/areson.c tran/areson.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/areson.c -o tran/areson.o $(CFLAGS)
|
||||
|
||||
tran/resonvc.o: tran/resonvc.c tran/resonvc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/resonvc.c -o tran/resonvc.o $(CFLAGS)
|
||||
|
||||
tran/resoncv.o: tran/resoncv.c tran/resoncv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/resoncv.c -o tran/resoncv.o $(CFLAGS)
|
||||
|
||||
tran/aresonvc.o: tran/aresonvc.c tran/aresonvc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/aresonvc.c -o tran/aresonvc.o $(CFLAGS)
|
||||
|
||||
tran/aresoncv.o: tran/aresoncv.c tran/aresoncv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/aresoncv.c -o tran/aresoncv.o $(CFLAGS)
|
||||
|
||||
tran/resonvv.o: tran/resonvv.c tran/resonvv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/resonvv.c -o tran/resonvv.o $(CFLAGS)
|
||||
|
||||
tran/aresonvv.o: tran/aresonvv.c tran/aresonvv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/aresonvv.c -o tran/aresonvv.o $(CFLAGS)
|
||||
|
||||
tran/offset.o: tran/offset.c tran/offset.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/offset.c -o tran/offset.o $(CFLAGS)
|
||||
|
||||
tran/slope.o: tran/slope.c tran/slope.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/slope.c -o tran/slope.o $(CFLAGS)
|
||||
|
||||
tran/delaycc.o: tran/delaycc.c tran/delaycc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/delaycc.c -o tran/delaycc.o $(CFLAGS)
|
||||
|
||||
tran/delaycv.o: tran/delaycv.c tran/delaycv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/delaycv.c -o tran/delaycv.o $(CFLAGS)
|
||||
|
||||
tran/shape.o: tran/shape.c tran/shape.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/shape.c -o tran/shape.o $(CFLAGS)
|
||||
|
||||
tran/sampler.o: tran/sampler.c tran/sampler.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/sampler.c -o tran/sampler.o $(CFLAGS)
|
||||
|
||||
tran/exp.o: tran/exp.c tran/exp.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/exp.c -o tran/exp.o $(CFLAGS)
|
||||
|
||||
tran/siosc.o: tran/siosc.c tran/siosc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/siosc.c -o tran/siosc.o $(CFLAGS)
|
||||
|
||||
tran/follow.o: tran/follow.c tran/follow.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/follow.c -o tran/follow.o $(CFLAGS)
|
||||
|
||||
tran/gate.o: tran/gate.c tran/gate.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/gate.c -o tran/gate.o $(CFLAGS)
|
||||
|
||||
tran/quantize.o: tran/quantize.c tran/quantize.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/quantize.c -o tran/quantize.o $(CFLAGS)
|
||||
|
||||
tran/ifft.o: tran/ifft.c tran/ifft.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/ifft.c -o tran/ifft.o $(CFLAGS)
|
||||
|
||||
tran/congen.o: tran/congen.c tran/congen.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/congen.c -o tran/congen.o $(CFLAGS)
|
||||
|
||||
tran/fromobject.o: tran/fromobject.c tran/fromobject.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/fromobject.c -o tran/fromobject.o $(CFLAGS)
|
||||
|
||||
tran/fromarraystream.o: tran/fromarraystream.c tran/fromarraystream.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/fromarraystream.c -o tran/fromarraystream.o $(CFLAGS)
|
||||
|
||||
tran/coterm.o: tran/coterm.c tran/coterm.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/coterm.c -o tran/coterm.o $(CFLAGS)
|
||||
|
||||
tran/convolve.o: tran/convolve.c tran/convolve.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/convolve.c -o tran/convolve.o $(CFLAGS)
|
||||
|
||||
tran/alpass.o: tran/alpass.c tran/alpass.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/alpass.c -o tran/alpass.o $(CFLAGS)
|
||||
|
||||
tran/oneshot.o: tran/oneshot.c tran/oneshot.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/oneshot.c -o tran/oneshot.o $(CFLAGS)
|
||||
|
||||
tran/chase.o: tran/chase.c tran/chase.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/chase.c -o tran/chase.o $(CFLAGS)
|
||||
|
||||
tran/tapv.o: tran/tapv.c tran/tapv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/tapv.c -o tran/tapv.o $(CFLAGS)
|
||||
|
||||
tran/biquad.o: tran/biquad.c tran/biquad.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/biquad.c -o tran/biquad.o $(CFLAGS)
|
||||
|
||||
tran/pluck.o: tran/pluck.c tran/pluck.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/pluck.c -o tran/pluck.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sndfnint.o: nyqsrc/sndfnint.c
|
||||
cc -c nyqsrc/sndfnint.c -o nyqsrc/sndfnint.o $(CFLAGS)
|
||||
|
||||
nyqsrc/seqfnint.o: nyqsrc/seqfnint.c
|
||||
cc -c nyqsrc/seqfnint.c -o nyqsrc/seqfnint.o $(CFLAGS)
|
||||
|
||||
xlisp/xlftab.o: nyqsrc/sndfnintptrs.h nyqsrc/sndfnintdefs.h nyqsrc/seqfnintptrs.h nyqsrc/seqfnintdefs.h
|
||||
cc -c xlisp/xlftab.c -o xlisp/xlftab.o $(CFLAGS)
|
||||
|
||||
xlisp/extern.o: xlisp/extern.c
|
||||
cc -c xlisp/extern.c -o xlisp/extern.o $(CFLAGS)
|
||||
|
||||
xlisp/xldmem.o: xlisp/xldmem.c
|
||||
cc -c xlisp/xldmem.c -o xlisp/xldmem.o $(CFLAGS)
|
||||
|
||||
xlisp/xlbfun.o: xlisp/xlbfun.c
|
||||
cc -c xlisp/xlbfun.c -o xlisp/xlbfun.o $(CFLAGS)
|
||||
|
||||
xlisp/xlcont.o: xlisp/xlcont.c
|
||||
cc -c xlisp/xlcont.c -o xlisp/xlcont.o $(CFLAGS)
|
||||
|
||||
xlisp/xldbug.o: xlisp/xldbug.c
|
||||
cc -c xlisp/xldbug.c -o xlisp/xldbug.o $(CFLAGS)
|
||||
|
||||
xlisp/xleval.o: xlisp/xleval.c
|
||||
cc -c xlisp/xleval.c -o xlisp/xleval.o $(CFLAGS)
|
||||
|
||||
xlisp/xlfio.o: xlisp/xlfio.c
|
||||
cc -c xlisp/xlfio.c -o xlisp/xlfio.o $(CFLAGS)
|
||||
|
||||
xlisp/xlglob.o: xlisp/xlglob.c
|
||||
cc -c xlisp/xlglob.c -o xlisp/xlglob.o $(CFLAGS)
|
||||
|
||||
xlisp/xlimage.o: xlisp/xlimage.c
|
||||
cc -c xlisp/xlimage.c -o xlisp/xlimage.o $(CFLAGS)
|
||||
|
||||
xlisp/xlinit.o: xlisp/xlinit.c
|
||||
cc -c xlisp/xlinit.c -o xlisp/xlinit.o $(CFLAGS)
|
||||
|
||||
xlisp/xlio.o: xlisp/xlio.c
|
||||
cc -c xlisp/xlio.c -o xlisp/xlio.o $(CFLAGS)
|
||||
|
||||
xlisp/xlisp.o: xlisp/xlisp.c
|
||||
cc -c xlisp/xlisp.c -o xlisp/xlisp.o $(CFLAGS)
|
||||
|
||||
xlisp/xllist.o: xlisp/xllist.c
|
||||
cc -c xlisp/xllist.c -o xlisp/xllist.o $(CFLAGS)
|
||||
|
||||
xlisp/xlmath.o: xlisp/xlmath.c
|
||||
cc -c xlisp/xlmath.c -o xlisp/xlmath.o $(CFLAGS)
|
||||
|
||||
xlisp/xlobj.o: xlisp/xlobj.c
|
||||
cc -c xlisp/xlobj.c -o xlisp/xlobj.o $(CFLAGS)
|
||||
|
||||
xlisp/xlpp.o: xlisp/xlpp.c
|
||||
cc -c xlisp/xlpp.c -o xlisp/xlpp.o $(CFLAGS)
|
||||
|
||||
xlisp/xlprin.o: xlisp/xlprin.c
|
||||
cc -c xlisp/xlprin.c -o xlisp/xlprin.o $(CFLAGS)
|
||||
|
||||
xlisp/xlread.o: xlisp/xlread.c
|
||||
cc -c xlisp/xlread.c -o xlisp/xlread.o $(CFLAGS)
|
||||
|
||||
xlisp/xlstr.o: xlisp/xlstr.c
|
||||
cc -c xlisp/xlstr.c -o xlisp/xlstr.o $(CFLAGS)
|
||||
|
||||
xlisp/xlsubr.o: xlisp/xlsubr.c
|
||||
cc -c xlisp/xlsubr.c -o xlisp/xlsubr.o $(CFLAGS)
|
||||
|
||||
xlisp/xlsym.o: xlisp/xlsym.c
|
||||
cc -c xlisp/xlsym.c -o xlisp/xlsym.o $(CFLAGS)
|
||||
|
||||
xlisp/xlsys.o: xlisp/xlsys.c
|
||||
cc -c xlisp/xlsys.c -o xlisp/xlsys.o $(CFLAGS)
|
||||
|
||||
cmt/cext.o: cmt/cext.c
|
||||
cc -c cmt/cext.c -o cmt/cext.o $(CFLAGS)
|
||||
|
||||
cmt/cleanup.o: cmt/cleanup.c
|
||||
cc -c cmt/cleanup.c -o cmt/cleanup.o $(CFLAGS)
|
||||
|
||||
cmt/cmdline.o: cmt/cmdline.c
|
||||
cc -c cmt/cmdline.c -o cmt/cmdline.o $(CFLAGS)
|
||||
|
||||
cmt/cmtcmd.o: cmt/cmtcmd.c
|
||||
cc -c cmt/cmtcmd.c -o cmt/cmtcmd.o $(CFLAGS)
|
||||
|
||||
cmt/moxc.o: cmt/moxc.c
|
||||
cc -c cmt/moxc.c -o cmt/moxc.o $(CFLAGS)
|
||||
|
||||
cmt/mem.o: cmt/mem.c
|
||||
cc -c cmt/mem.c -o cmt/mem.o $(CFLAGS)
|
||||
|
||||
cmt/midifile.o: cmt/midifile.c
|
||||
cc -c cmt/midifile.c -o cmt/midifile.o $(CFLAGS)
|
||||
|
||||
cmt/midifns.o: cmt/midifns.c
|
||||
cc -c cmt/midifns.c -o cmt/midifns.o $(CFLAGS)
|
||||
|
||||
cmt/record.o: cmt/record.c
|
||||
cc -c cmt/record.c -o cmt/record.o $(CFLAGS)
|
||||
|
||||
cmt/seq.o: cmt/seq.c
|
||||
cc -c cmt/seq.c -o cmt/seq.o $(CFLAGS)
|
||||
|
||||
cmt/seqmread.o: cmt/seqmread.c
|
||||
cc -c cmt/seqmread.c -o cmt/seqmread.o $(CFLAGS)
|
||||
|
||||
cmt/seqmwrite.o: cmt/seqmwrite.c
|
||||
cc -c cmt/seqmwrite.c -o cmt/seqmwrite.o $(CFLAGS)
|
||||
|
||||
cmt/seqread.o: cmt/seqread.c
|
||||
cc -c cmt/seqread.c -o cmt/seqread.o $(CFLAGS)
|
||||
|
||||
cmt/seqwrite.o: cmt/seqwrite.c
|
||||
cc -c cmt/seqwrite.c -o cmt/seqwrite.o $(CFLAGS)
|
||||
|
||||
cmt/tempomap.o: cmt/tempomap.c
|
||||
cc -c cmt/tempomap.c -o cmt/tempomap.o $(CFLAGS)
|
||||
|
||||
cmt/timebase.o: cmt/timebase.c
|
||||
cc -c cmt/timebase.c -o cmt/timebase.o $(CFLAGS)
|
||||
|
||||
cmt/userio.o: cmt/userio.c
|
||||
cc -c cmt/userio.c -o cmt/userio.o $(CFLAGS)
|
||||
|
||||
sys/unix/osstuff.o: sys/unix/osstuff.c
|
||||
cc -c sys/unix/osstuff.c -o sys/unix/osstuff.o $(CFLAGS)
|
||||
|
||||
|
||||
# this doesn't compile with the -O switch (a NeXT compiler bug?)
|
||||
xlisp/xljump.o : xlisp/xljump.c xlisp/xlisp.h
|
||||
$(CC) -DCMTSTUFF -c xlisp/xljump.c -o xlisp/xljump.o
|
||||
misc/intgen: misc/intgen.c
|
||||
cd misc; make intgen
|
||||
|
||||
misc/unpacker: misc/unpacker.c misc/convert.c
|
||||
cd misc; make unpacker
|
||||
|
||||
misc/packer: misc/packer.c misc/convert.c
|
||||
cd misc; make packer
|
||||
|
||||
nyqsrc/sndfnintptrs.h: $(NYQHDRS) snd/snd.h misc/intgen
|
||||
$(INTGEN) nyqsrc/sndfnint $(NYQHDRS)
|
||||
|
||||
nyqsrc/seqfnintptrs.h: $(CMTHDRS) misc/intgen
|
||||
$(INTGEN) nyqsrc/seqfnint $(CMTHDRS)
|
||||
|
||||
clean:
|
||||
cd misc; make clean
|
||||
rm -f $(OBJECTS)
|
||||
# Note that these files are machine-generated:
|
||||
rm -f nyqsrc/sndfnintptrs.h nyqsrc/sndfnint.c nyqsrc/sndfnintdefs.h
|
||||
rm -f nyqsrc/seqfnintptrs.h nyqsrc/seqfnint.c nyqsrc/seqfnintdefs.h
|
||||
|
||||
cleaner: clean
|
||||
cd misc; make cleaner
|
||||
rm -f *.backup */*.backup
|
||||
rm -f *~ */*.*~
|
||||
rm -f *.save */*.save
|
||||
rm -f *.CKP */*.CKP
|
||||
rm -f *.BAK */*.BAK
|
||||
rm -f *.old */*.old
|
||||
rm -f *.gold */*.gold
|
||||
rm -f playparms
|
||||
rm -f points.dat
|
|
@ -0,0 +1,37 @@
|
|||
; local definition for play
|
||||
; this one is for NeXT:
|
||||
|
||||
(if (not (boundp '*default-sf-format*))
|
||||
(setf *default-sf-format* snd-head-NeXT))
|
||||
|
||||
(if (not (boundp '*default-sound-file*))
|
||||
(compute-default-sound-file))
|
||||
|
||||
(if (not (boundp '*default-sf-dir*))
|
||||
(setf *default-sf-dir* "./"))
|
||||
|
||||
(if (not (boundp '*default-sf-mode*))
|
||||
(setf *default-sf-mode* snd-head-mode-pcm))
|
||||
|
||||
(if (not (boundp '*default-sf-bits*))
|
||||
(setf *default-sf-bits* 16))
|
||||
|
||||
(if (not (boundp '*default-plot-file*))
|
||||
(setf *default-plot-file* "points.dat"))
|
||||
|
||||
;; PLAY-FILE - play a sound file
|
||||
;;
|
||||
(defun play-file (name)
|
||||
(system (strcat "sndplay " (soundfilename name))))
|
||||
|
||||
;; R - replay last file written with PLAY
|
||||
(defun r () (play-file *default-sound-file*))
|
||||
|
||||
;; PLAY - write value of an expression to file and play it
|
||||
;;
|
||||
(defmacro play (expr)
|
||||
`(prog (specs)
|
||||
(setf specs (s-save (force-srate *sound-srate* ,expr)
|
||||
1000000000 *default-sound-file*))
|
||||
(r)))
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,101 @@
|
|||
;; system.lsp -- system-dependent lisp code
|
||||
|
||||
; local definition for play
|
||||
; this one is for Linux:
|
||||
|
||||
(if (not (boundp '*default-sf-format*))
|
||||
(setf *default-sf-format* snd-head-wave))
|
||||
|
||||
(if (not (boundp '*default-sound-file*))
|
||||
(compute-default-sound-file))
|
||||
|
||||
(if (not (boundp '*default-sf-dir*))
|
||||
(setf *default-sf-dir* "./"))
|
||||
|
||||
(if (not (boundp '*default-sf-mode*))
|
||||
(setf *default-sf-mode* snd-mode-pcm))
|
||||
|
||||
(if (not (boundp '*default-sf-bits*))
|
||||
(setf *default-sf-bits* 16))
|
||||
|
||||
(if (not (boundp '*default-plot-file*))
|
||||
(setf *default-plot-file* (strcat (get-user) "-points.dat")))
|
||||
|
||||
|
||||
; FULL-NAME-P -- test if file name is a full path or relative path
|
||||
;
|
||||
; (otherwise the *default-sf-dir* will be prepended
|
||||
;
|
||||
(defun full-name-p (filename)
|
||||
(or (eq (char filename 0) #\/)
|
||||
(eq (char filename 0) #\.)))
|
||||
|
||||
; RELATIVE-PATH-P -- test if filename or path is a relative path
|
||||
;
|
||||
(defun relative-path-p (filename)
|
||||
(not (eq (char filename 0) #\/)))
|
||||
|
||||
(setf *file-separator* #\/)
|
||||
|
||||
|
||||
;; PLAY-FILE - play a sound file
|
||||
;;
|
||||
(defun play-file (name)
|
||||
;;
|
||||
;; WARNING: if you invoke an external program to play files,
|
||||
;; but Nyquist uses internal (portaudio) interface to
|
||||
;; play synthesized sound, Nyquist may fail to open the
|
||||
;; sound device while it is playing a sound file and then
|
||||
;; refuse to play anything. -RBD dec05
|
||||
;; (system (strcat "sndplay " (soundfilename name))))
|
||||
;; (system (strcat "play " (soundfilename name) )))
|
||||
;;
|
||||
(play (s-read (soundfilename name))))
|
||||
|
||||
;; R - replay last file written with PLAY
|
||||
(defun r () (play-file *default-sound-file*))
|
||||
|
||||
;;;; use this old version if you want to use sndplay to play
|
||||
;;;; the result file rather than play the samples as they
|
||||
;;;; are computed. This version does not autonormalize.
|
||||
;; PLAY - write value of an expression to file and play it
|
||||
;;
|
||||
;(defmacro play (expr)
|
||||
; `(prog (specs)
|
||||
; (setf specs (s-save (force-srate *sound-srate* ,expr)
|
||||
; 1000000000 *default-sound-file*))
|
||||
; (r)))
|
||||
;;;;
|
||||
|
||||
; local definition for play
|
||||
(defmacro play (expr)
|
||||
`(s-save-autonorm ,expr NY:ALL *default-sound-file* :play *soundenable*))
|
||||
|
||||
;; for Linux, modify s-plot (defined in nyquist.lsp) by saving s-plot
|
||||
;; in standard-s-plot, then call gnuplot to display the points.
|
||||
;;
|
||||
;; we also need to save the location of this file so we can find
|
||||
;; nyquist-plot.txt, the command file for gnuplot
|
||||
;;
|
||||
;; This code is broken in the following ways:
|
||||
;; it tries to run gnuplot even when plotting can be done by NyquistIDE
|
||||
;; it plots "points.dat", but "points.dat" may not be correct
|
||||
;; (see *default-plot-file*)
|
||||
;; it assumes the plot file is in the current directory, but it
|
||||
;; by default goes to the sound file directory
|
||||
;;
|
||||
;; Fix this code or complain if you want to plot with gnuplot while
|
||||
;; running ny (or even NyquistIDE (jny) if you want). Otherwise, use
|
||||
;; NyquistIDE to get s-plot to work.
|
||||
;;
|
||||
;(setf *runtime-path* (current-path))
|
||||
;(display "system.lsp" *runtime-path*)
|
||||
;
|
||||
;(setfn standard-s-plot s-plot)
|
||||
;
|
||||
;(defun s-plot (s &optional (dur 2.0) (n 1000))
|
||||
; (let (plot-file)
|
||||
; (standard-s-plot s dur n) ;; this calculates the data points
|
||||
; (setf plot-file (strcat *runtime-path* "nyquist-plot.txt"))
|
||||
; (system (strcat "gnuplot -persist " plot-file))))
|
||||
|
|
@ -0,0 +1,817 @@
|
|||
/* unixtuff.c - unix interface routines for xlisp
|
||||
|
||||
* HISTORY
|
||||
* 5-Mar-07 Dannenberg
|
||||
* worked on hidden_msg() and hidden message handling
|
||||
*
|
||||
* 23-Dec-05 Dannenberg
|
||||
* still more hacks: Mac and Linux don't disable character echo like
|
||||
* windows does using a pipe to an IDE. To make UNIX versions match
|
||||
* the Windows behavior (which is preferable), added
|
||||
* echo_enabled flag and a function to set/clear it from XLisp.
|
||||
* This will give unix-specific behavior to compensate for the
|
||||
* unix-specific character echo. This worked, but printed
|
||||
* (echoenabled nil) on the console, which was pretty ugly, so I
|
||||
* added ctrl-e and ctrl-f handlers to turn echo on and off. Now
|
||||
* Java can just send ctrl-f before anything else. Windows must
|
||||
* ignore ctrl-f.
|
||||
*
|
||||
* 28-Apr-03 Mazzoni
|
||||
* many changes for new conditional compilation organization
|
||||
*
|
||||
* 28-Jun-95 Dannenberg
|
||||
* removed buffering (which could overflow) from ostgetc.
|
||||
*
|
||||
* 2-Aprl-88 Dale Amon at CMU-CSD
|
||||
* Upgraded to xlisp 2.0. Used msstuff.c as a template.
|
||||
*
|
||||
* 20-Apr-87 Dale Amon at CMU-CSD
|
||||
* Added control-c interrupt handler. Puts user in breakloop and allows
|
||||
* continue. Prints line at which the interrupt occured. Interrupt
|
||||
* occurs at first eval after ^C has been typed.
|
||||
*
|
||||
* 19-APR-87 Dale Amon at CMU-CSD
|
||||
* switched from rand to random package. Corrected bug in osrand(). It
|
||||
* did not use the argument n to calculate a rand in range 0 to n-1 as
|
||||
* advertised.
|
||||
* 28-OCT-05 Roger Dannenberg at CMU-SCS
|
||||
* added directory listing functions
|
||||
*/
|
||||
|
||||
#include "switches.h"
|
||||
#include <errno.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "xlisp.h"
|
||||
#include "term.h"
|
||||
#include "cext.h"
|
||||
#include "userio.h"
|
||||
#include "exitpa.h"
|
||||
#include "nyq-osc-server.h"
|
||||
#include "sliderdata.h" /* define sliders -- not just for OSC */
|
||||
#include "sound.h" /* define nosc_enabled and mark_sound_time */
|
||||
#include "falloc.h" /* define table_memory */
|
||||
#define LBSIZE 200
|
||||
|
||||
/* external variables */
|
||||
extern LVAL s_unbound,s_true;
|
||||
extern FILE *tfp;
|
||||
|
||||
/* local variables */
|
||||
static int lindex;
|
||||
static int lcount = 0;
|
||||
static int lposition;
|
||||
static int line_edit = TRUE;
|
||||
|
||||
#ifndef READ_LINE
|
||||
#define typeahead_max 128
|
||||
static char typeahead[typeahead_max];
|
||||
static int typeahead_tail = 0;
|
||||
static int typeahead_head = 0;
|
||||
static char lbuf[LBSIZE];
|
||||
static int lpos[LBSIZE];
|
||||
#endif
|
||||
|
||||
static int echo_enabled = 1;
|
||||
|
||||
/* forward declarations */
|
||||
FORWARD LOCAL void xflush();
|
||||
FORWARD LOCAL int xcheck();
|
||||
FORWARD LOCAL void hidden_msg();
|
||||
|
||||
/*==========================================================================*/
|
||||
/* control-c interrupt handling routines and variables. Uses B4.2 signal
|
||||
handling. Previous SIGINT handler is saved just in case someday we want
|
||||
to play with turning control c on and off.
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
static int ctc = FALSE;
|
||||
static void control_c(int x) {ctc = TRUE;}
|
||||
void ctcinit() {signal ( SIGINT, control_c );}
|
||||
static void ctcreset() {signal ( SIGINT, control_c );}
|
||||
|
||||
|
||||
/*==========================================================================*/
|
||||
|
||||
|
||||
const char os_pathchar = '/';
|
||||
const char os_sepchar = ':';
|
||||
|
||||
|
||||
/* osinit - initialize */
|
||||
void osinit(const char *banner)
|
||||
{
|
||||
printf("%s\n",banner);
|
||||
/* start the random number generator. Older version was srand(1)
|
||||
seed of 1 makes the sequence repeatable. Random gives better
|
||||
pseudo randomness than does rand().
|
||||
*/
|
||||
#if USE_RAND
|
||||
srand(1);
|
||||
#endif
|
||||
|
||||
#if USE_RANDOM
|
||||
srandom(1);
|
||||
#endif
|
||||
|
||||
#ifndef UNIX
|
||||
/* set control c trap to local routine */
|
||||
ctcinit();
|
||||
#else
|
||||
/* sets terminal for raw input and calls ctcinit too */
|
||||
term_init();
|
||||
term_character();
|
||||
#endif
|
||||
|
||||
lposition = 0;
|
||||
lindex = 0;
|
||||
lcount = 0;
|
||||
}
|
||||
|
||||
/* osfinish - clean up before returning to the operating system */
|
||||
void osfinish(void)
|
||||
{
|
||||
term_exit();
|
||||
portaudio_exit();
|
||||
}
|
||||
|
||||
/* oserror - print an error message */
|
||||
void oserror(const char *msg) {printf("error: %s\n",msg);}
|
||||
|
||||
|
||||
/* osaopen - open an ascii file */
|
||||
FILE *osaopen(name,mode) const char *name,*mode; {
|
||||
FILE *fp = NULL;
|
||||
if (ok_to_open(name, mode))
|
||||
fp = fopen(name,mode);
|
||||
#ifdef DEBUG_INPUT
|
||||
printf("osaopen on %s yields %x\n", name, fp);
|
||||
if (strcmp(name, "/home/rbd/nyquist/lib/xm-test.lsp") == 0) {
|
||||
// when DEBUG_INPUT is set, this generates a compiler error
|
||||
// on linux -RBD
|
||||
debug_input_fp = fp;
|
||||
printf("osaopen: debug_input_fp gets %x\n", debug_input_fp);
|
||||
}
|
||||
#endif
|
||||
return fp;
|
||||
}
|
||||
|
||||
/* osbopen - open a binary file */
|
||||
FILE *osbopen(name,mode) const char *name,*mode;
|
||||
{ char bmode[10];
|
||||
FILE *fp = NULL;
|
||||
strcpy(bmode,mode); strcat(bmode,"b");
|
||||
if (ok_to_open(name, bmode))
|
||||
fp = fopen(name,bmode);
|
||||
return fp;
|
||||
}
|
||||
|
||||
/* osclose - close a file */
|
||||
int osclose(fp) FILE *fp;
|
||||
{
|
||||
#ifdef DEBUG_INPUT
|
||||
if (debug_input_fp == fp) {
|
||||
debug_input_fp = NULL;
|
||||
printf("osclose: debug_input_fp gets %x\n", debug_input_fp);
|
||||
}
|
||||
#endif
|
||||
/* when XLISP is loading files and an error is encountered, the files
|
||||
* are automatically closed so that the OS will not lock them, confusing
|
||||
* the user. So we could get here and the file could already be closed
|
||||
*/
|
||||
return (fp ? fclose(fp) : 0);
|
||||
}
|
||||
|
||||
/* osagetc - get a character from an ascii file */
|
||||
int osagetc(fp) FILE *fp; {
|
||||
#ifdef DEBUG_INPUT
|
||||
int c = getc(fp);
|
||||
ungetc(c, fp);
|
||||
#endif
|
||||
return (getc(fp));
|
||||
}
|
||||
|
||||
/* osaputc - put a character to an ascii file */
|
||||
int osaputc(int ch, FILE *fp) { return (putc(ch,fp)); }
|
||||
|
||||
/* osoutflush - flush output to a file */
|
||||
void osoutflush(FILE *fp) { fflush(fp); }
|
||||
|
||||
extern int dbgflg;
|
||||
|
||||
/* osbgetc - get a character from a binary file */
|
||||
/* int osbgetc(fp) FILE *fp; {return (getc(fp));} */
|
||||
int osbgetc(FILE *fp) {
|
||||
int c = (getc(fp));
|
||||
/* if (dbgflg) printf("osbgetc: got %d from FILE %x\n", c, fp);
|
||||
*/
|
||||
return c;
|
||||
}
|
||||
|
||||
/* osbputc - put a character to a binary file */
|
||||
int osbputc(ch,fp) int ch; FILE *fp; {return (putc(ch,fp));}
|
||||
|
||||
#ifdef OLDEST_OSTGETC
|
||||
/* ostgetc - get a character from the terminal */
|
||||
int ostgetc()
|
||||
{
|
||||
int ch;
|
||||
switch (ch = term_getchar()) {
|
||||
case '\n':
|
||||
lbuf[lcount++] = '\n';
|
||||
lposition = 0;
|
||||
if (tfp)
|
||||
for (lindex = 0; lindex < lcount; ++lindex)
|
||||
osaputc(lbuf[lindex],tfp);
|
||||
lindex = 0; lcount = 0;
|
||||
return (ch);
|
||||
case '\010':
|
||||
case '\177':
|
||||
if (lcount) {
|
||||
lcount--;
|
||||
while (lposition > lpos[lcount]) {
|
||||
lposition--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '\032':
|
||||
xflush();
|
||||
return (EOF);
|
||||
default:
|
||||
if (ch == '\t' || (ch >= 0x20 && ch < 0x7F)) {
|
||||
lbuf[lcount] = ch;
|
||||
lpos[lcount] = lposition;
|
||||
if (ch == '\t')
|
||||
do {} while (++lposition & 7);
|
||||
else {lposition++;}
|
||||
lcount++;
|
||||
return (ch);
|
||||
}
|
||||
else {
|
||||
xflush();
|
||||
switch (ch) {
|
||||
case '\003': xltoplevel(); /* control-c */
|
||||
case '\007': xlcleanup(); /* control-g */
|
||||
case '\020': xlcontinue(); /* control-p */
|
||||
case '\032': return (EOF); /* control-z */
|
||||
|
||||
/* moved from oscheck until I figure out how to
|
||||
set up interrupt to handle these two */
|
||||
case '\002': xflush(); xlbreak("BREAK",s_unbound);
|
||||
break; /* control-b */
|
||||
case '\024': xinfo(); break; /* control-t */
|
||||
|
||||
default: return (ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#if OLD_OSTGETC
|
||||
/* ostgetc - get a character from the terminal */
|
||||
int ostgetc()
|
||||
{ int ch;
|
||||
|
||||
for (;;) {
|
||||
ch = term_getchar();
|
||||
oscheck();
|
||||
switch (ch) {
|
||||
case '\003': xltoplevel(); /* control-c */
|
||||
case '\007': xlcleanup(); /* control-g */
|
||||
case '\020': xlcontinue(); /* control-p */
|
||||
case '\032': return EOF; /* control-z */
|
||||
case '\002': xflush(); xlbreak("BREAK",s_unbound);
|
||||
break; /* control-b */
|
||||
case '\024': xinfo(); break; /* control-t */
|
||||
case '\t':
|
||||
case '\n':
|
||||
default:
|
||||
if (tfp) osaputc(ch, tfp);
|
||||
return ch;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef READLINE
|
||||
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
|
||||
char *readline_line = NULL;
|
||||
int readline_pos = 0;
|
||||
int readline_len = 0;
|
||||
int readline_first = 1;
|
||||
|
||||
extern int xldebug;
|
||||
|
||||
int ostgetc()
|
||||
{
|
||||
int rval;
|
||||
|
||||
if (readline_first)
|
||||
using_history();
|
||||
|
||||
if (!readline_line) {
|
||||
char prompt[10];
|
||||
if (xldebug==0)
|
||||
sprintf(prompt, "> ");
|
||||
else
|
||||
sprintf(prompt, "%d> ", xldebug);
|
||||
readline_line = readline(prompt);
|
||||
if (readline_line == NULL)
|
||||
return EOF;
|
||||
add_history(readline_line);
|
||||
readline_len = strlen(readline_line);
|
||||
readline_pos = 0;
|
||||
}
|
||||
|
||||
rval = readline_line[readline_pos];
|
||||
if (readline_pos == readline_len) {
|
||||
free(readline_line);
|
||||
readline_line = NULL;
|
||||
return '\n';
|
||||
}
|
||||
readline_pos++;
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
||||
#else /* no readline */
|
||||
|
||||
|
||||
void end_of_line_edit()
|
||||
{
|
||||
line_edit = FALSE;
|
||||
if (tfp) {
|
||||
for (lindex = 0; lindex < lcount; ++lindex)
|
||||
osaputc(lbuf[lindex], tfp);
|
||||
}
|
||||
lindex = 0;
|
||||
}
|
||||
|
||||
/* THIS IS THE "REAL" ostgetc(): */
|
||||
LOCAL int rawtchar()
|
||||
{
|
||||
int ch;
|
||||
if (typeahead_tail != typeahead_head) {
|
||||
ch = typeahead[typeahead_head++];
|
||||
typeahead_head &= (typeahead_max - 1);
|
||||
/* printf("[%c]", ch); */
|
||||
if (ch == 0xFF) ch = -1; /* char to int conversion of EOF */
|
||||
} else {
|
||||
fflush(stdout); /* necessary on OS X with Java IDE - I don't know why. */
|
||||
/* don't use getchar() or buffering will cause out-of-order input */
|
||||
ch = term_getchar();
|
||||
/* printf("{%c}", ch); */
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
int ostgetc()
|
||||
{
|
||||
/*
|
||||
* NOTE: lbuf[] accumulates characters as they are typed
|
||||
* lpos[] is the column position of the characters
|
||||
* lcount is the number of characters in lbuf
|
||||
* lposition is current position
|
||||
* lindex is index of next char to output
|
||||
* line_edit is true iff we're inputing characters
|
||||
*
|
||||
*/
|
||||
int ch;
|
||||
|
||||
while (line_edit) {
|
||||
ch = rawtchar();
|
||||
if (ch == EOF) xlisp_wrapup();
|
||||
oscheck(); /* in case user typed ^C */
|
||||
/* assume for now we should add the character */
|
||||
lbuf[lcount] = ch;
|
||||
lpos[lcount] = lposition;
|
||||
lcount++;
|
||||
lposition++;
|
||||
|
||||
/* now do all the special character processing */
|
||||
switch (ch) {
|
||||
case '\001': /* take out non-printing character */
|
||||
lcount--;
|
||||
lposition--;
|
||||
mark_audio_time();
|
||||
break;
|
||||
case '\n':
|
||||
lposition = 0;
|
||||
end_of_line_edit();
|
||||
if (echo_enabled) {
|
||||
osaputc('\r', stdout);
|
||||
osaputc(ch, stdout);
|
||||
}
|
||||
break;
|
||||
/* delete key generates: 1b, 5b, 33, 7E
|
||||
which is: ESC, [, 3, ~ */
|
||||
case '\010': /* backspace */
|
||||
case '\177': /* delete */
|
||||
lcount--; /* take out backspace or delete char */
|
||||
lposition--;
|
||||
if (lcount) {
|
||||
lcount--;
|
||||
while (lposition > lpos[lcount]) {
|
||||
if (echo_enabled) {
|
||||
putchar('\010');
|
||||
putchar(' ');
|
||||
putchar('\010');
|
||||
}
|
||||
lposition--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '\025': /* control-u */
|
||||
lcount--;
|
||||
lposition--;
|
||||
if (lcount) {
|
||||
while (lposition > lpos[0]) {
|
||||
if (echo_enabled) {
|
||||
putchar('\010');
|
||||
putchar(' ');
|
||||
putchar('\010');
|
||||
}
|
||||
lposition--;
|
||||
}
|
||||
lcount = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
/* note that control-z never reaches here */
|
||||
case '\003': /* control-c */
|
||||
xltoplevel();
|
||||
lcount = 0;
|
||||
break;
|
||||
case '\007': /* control-g */
|
||||
lcount--; /* take out non-printing char */
|
||||
lposition--;
|
||||
xlcleanup();
|
||||
lcount = 0;
|
||||
break;
|
||||
case '\016':
|
||||
lcount--; /* take out non-printing char */
|
||||
lposition--;
|
||||
hidden_msg(); /* process hidden msg chars */
|
||||
break;
|
||||
case '\020': /* control-p */
|
||||
lcount--; /* take out non-printing char */
|
||||
lposition--;
|
||||
xlcontinue();
|
||||
lcount = 0;
|
||||
break;
|
||||
case '\002':
|
||||
lcount--; /* take out non-printing char */
|
||||
lposition--;
|
||||
xflush(); /* control-b */
|
||||
xlbreak("BREAK",s_unbound);
|
||||
break;
|
||||
case '\005': /* control-e */
|
||||
lcount--; /* take out non-printing char */
|
||||
lposition--;
|
||||
echo_enabled = TRUE;
|
||||
break;
|
||||
case '\006': /* control-f */
|
||||
lcount--; /* take out non-printing char */
|
||||
lposition--;
|
||||
echo_enabled = FALSE;
|
||||
break;
|
||||
case '\024': /* control-t */
|
||||
lcount--; /* take out non-printing char */
|
||||
lposition--;
|
||||
xinfo();
|
||||
lcount = 0;
|
||||
break;
|
||||
|
||||
case '\t': /* TAB */
|
||||
lposition--; /* undo the increment above */
|
||||
do {
|
||||
lposition++;
|
||||
if (echo_enabled) osaputc(' ', stdout);
|
||||
} while (lposition & 7);
|
||||
break;
|
||||
default:
|
||||
if (echo_enabled) osaputc(ch, stdout);
|
||||
break;
|
||||
}
|
||||
// avoid line buffer overflow here:
|
||||
if (lposition > LBSIZE - 10) {
|
||||
// buffer is about to overflow, so write newline and
|
||||
// feed chars to XLISP
|
||||
if (echo_enabled) {
|
||||
osaputc('\r', stdout);
|
||||
osaputc('\n', stdout);
|
||||
}
|
||||
lposition = 0;
|
||||
end_of_line_edit();
|
||||
}
|
||||
}
|
||||
if (lindex + 1 >= lcount) {
|
||||
lcount = 0;
|
||||
line_edit = TRUE;
|
||||
}
|
||||
ch = lbuf[lindex++];
|
||||
/* printf("-%c-", ch); */
|
||||
if (echo_enabled) fflush(stdout);
|
||||
return ch;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* ostputc - put a character to the terminal */
|
||||
void ostputc(int ch)
|
||||
{
|
||||
oscheck(); /* check for control characters */
|
||||
|
||||
/* output the character */
|
||||
if (ch == '\n') {lposition = 0;}
|
||||
else {lposition++;}
|
||||
|
||||
/* output the character to the transcript file */
|
||||
if (tfp) osaputc(ch,tfp);
|
||||
putchar(((char) ch));
|
||||
}
|
||||
|
||||
/* ostoutflush - flush output buffer */
|
||||
void ostoutflush()
|
||||
{
|
||||
if (tfp) fflush(tfp);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/* osflush - flush the terminal input buffer */
|
||||
void osflush(void)
|
||||
{
|
||||
lindex = lcount = lposition = 0;
|
||||
line_edit = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* hidden_msg - process a "hidden message"
|
||||
*
|
||||
* NOTE: a "hidden message" is a sequence of characters starting
|
||||
* with '\016' and ending with '\021'. These are designed to allow
|
||||
* a graphical interface, namely jNyqIDE, to control sliders in
|
||||
* real-time (during synthesis). The character sequences are hidden
|
||||
* meaning they are not echoed and they are not interpreted as LISP.
|
||||
*
|
||||
* This function assumes that '\016' has been received already.
|
||||
*/
|
||||
LOCAL void hidden_msg()
|
||||
{
|
||||
#define MSGBUF_MAX 64
|
||||
char msgbuf[MSGBUF_MAX];
|
||||
int msgbufx = 0;
|
||||
char type_char = rawtchar();
|
||||
char ch;
|
||||
// message is terminated by '\021'
|
||||
while ((ch = term_getchar()) != '\021' && ch != EOF &&
|
||||
msgbufx < MSGBUF_MAX - 1) {
|
||||
msgbuf[msgbufx++] = ch;
|
||||
}
|
||||
msgbuf[msgbufx++] = 0;
|
||||
// printf("hidden message: %s, len %ld\n", msgbuf, (long) strlen(msgbuf));
|
||||
if (msgbufx < MSGBUF_MAX) {
|
||||
if (type_char == 'S') { // slider change message
|
||||
int index;
|
||||
float value;
|
||||
if (sscanf(msgbuf, "%d %g", &index, &value) == 2) {
|
||||
set_slider(index, value);
|
||||
}
|
||||
}
|
||||
} /* other hidden messages could be parsed here */
|
||||
}
|
||||
|
||||
|
||||
/* oscheck - check for control characters during execution */
|
||||
/*
|
||||
* NOTE: to support type-ahead, unused characters are put
|
||||
* into a queue to be removed by ostgetc
|
||||
*/
|
||||
void oscheck(void)
|
||||
{
|
||||
int ch;
|
||||
|
||||
#if OSC
|
||||
if (nosc_enabled) nosc_poll();
|
||||
#endif
|
||||
|
||||
if (ctc) { /* control-c */
|
||||
/* printf("[oscheck: control-c detected]"); */
|
||||
ctc=FALSE; ctcreset();
|
||||
xflush(); xltoplevel(); return;
|
||||
}
|
||||
|
||||
if ((ch = xcheck())) {
|
||||
switch (ch) {
|
||||
case BREAK_CHAR: /* control-b */
|
||||
/* printf("BREAK_CHAR\n"); */
|
||||
xflush(); xlbreak("BREAK",s_unbound); break;
|
||||
case '\024': /* control-t */
|
||||
/* printf("control-t\n"); */
|
||||
xinfo(); break;
|
||||
case '\025': /* control-u */
|
||||
/* printf("control-u\n"); */
|
||||
xcleanup();
|
||||
case '\016': { /* begin hidden message */
|
||||
/* printf("hidden msg\n"); */
|
||||
hidden_msg();
|
||||
break;
|
||||
}
|
||||
case '\001': /* control-a -- mark audio time */
|
||||
mark_audio_time(); break;
|
||||
case -1: /* EOF - lost connection, so die */
|
||||
xlisp_wrapup();
|
||||
break;
|
||||
case -2: /* no character was ready */
|
||||
break;
|
||||
default:
|
||||
/* printf("Got %d\n", ch); */
|
||||
#ifndef READ_LINE
|
||||
/* printf("+%c+", ch); */
|
||||
typeahead[typeahead_tail++] = ch;
|
||||
typeahead_tail &= (typeahead_max - 1);
|
||||
if (typeahead_tail == typeahead_head) {
|
||||
oserror("Input buffer overflow\n");
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
run_time++;
|
||||
// when compute-bound, run_time is incremented by 10000 in about 15s, so
|
||||
// that's about 700 Hz. We want to flush any output at about 2Hz, so
|
||||
// we'll pick 400 as a round number.
|
||||
// It's 2014, and now I'm seeing 3000 Hz. That's very high, so I
|
||||
// changed SAMPLE to get this down to about 66Hz. Using % 30 to get
|
||||
// 2Hz flush rate.
|
||||
if (run_time % 30 == 0) {
|
||||
fflush(stdout);
|
||||
if (run_time_limit > 0 && run_time > run_time_limit) {
|
||||
xlfatal("Run time limit exceeded");
|
||||
}
|
||||
if (memory_limit > 0 &&
|
||||
npools * MAXPOOLSIZE + table_memory + total >
|
||||
memory_limit * 1000000) {
|
||||
xlfatal("Memory limit exceeded");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* xflush - flush the input line buffer and start a new line */
|
||||
LOCAL void xflush()
|
||||
{
|
||||
osflush();
|
||||
ostputc('\n');
|
||||
}
|
||||
|
||||
/* xsystem - execute a system command */
|
||||
LVAL xsystem()
|
||||
{ /*LVAL strval;*/
|
||||
unsigned char *cmd = NULL;
|
||||
if (SAFE_NYQUIST) return NULL;
|
||||
if (moreargs())
|
||||
cmd = (unsigned char *)getstring(xlgastring());
|
||||
xllastarg();
|
||||
return (system((char *) cmd) == -1 ? cvfixnum((FIXTYPE)errno) : s_true);
|
||||
}
|
||||
|
||||
|
||||
/* xsetdir -- set current directory of the process */
|
||||
LVAL xsetdir()
|
||||
{
|
||||
char *dir = (char *)getstring(xlgastring());
|
||||
int result = -1;
|
||||
LVAL cwd = NULL;
|
||||
int verbose = TRUE;
|
||||
if (moreargs()) {
|
||||
verbose = (xlgetarg() != NIL);
|
||||
}
|
||||
xllastarg();
|
||||
if (ok_to_open(dir, "r"))
|
||||
result = chdir(dir);
|
||||
if (result) {
|
||||
/* perror("SETDIR"); -- Nyquist uses SETDIR to search for directories
|
||||
* at startup, so failures are normal, and seeing error messages
|
||||
* could be confusing, so don't print them. The NULL return indicates
|
||||
* an error, but doesn't tell which one it is.
|
||||
* But now, SETDIR has a second verbose parameter that is nil when
|
||||
* searching for directories. -RBD
|
||||
*/
|
||||
if (verbose) perror("Directory Setting Error");
|
||||
return NULL;
|
||||
}
|
||||
dir = getcwd(NULL, 1000);
|
||||
if (dir) {
|
||||
cwd = cvstring(dir);
|
||||
free(dir);
|
||||
}
|
||||
return cwd;
|
||||
}
|
||||
|
||||
/* xget_temp_path -- get a path to create temp files */
|
||||
LVAL xget_temp_path()
|
||||
{
|
||||
return cvstring("/tmp/");
|
||||
}
|
||||
|
||||
/* xget_user -- get a string identifying the user, for use in file names */
|
||||
LVAL xget_user()
|
||||
{
|
||||
const char *user = getenv("USER");
|
||||
if (!user || !*user) {
|
||||
errputstr("Warning: could not get user ID, using 'nyquist'\n");
|
||||
user = "nyquist";
|
||||
}
|
||||
return cvstring(user);
|
||||
}
|
||||
|
||||
|
||||
/* xechoenabled -- set/clear echo_enabled flag (unix only) */
|
||||
LVAL xechoenabled()
|
||||
{
|
||||
int flag = (xlgetarg() != NULL);
|
||||
xllastarg();
|
||||
echo_enabled = flag;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#define OSDIR_LIST_READY 0
|
||||
#define OSDIR_LIST_STARTED 1
|
||||
#define OSDIR_LIST_DONE 2
|
||||
static int osdir_list_status = OSDIR_LIST_READY;
|
||||
static DIR *osdir_dir;
|
||||
|
||||
/* osdir_list_start -- open a directory listing */
|
||||
int osdir_list_start(const char *path)
|
||||
{
|
||||
if (osdir_list_status != OSDIR_LIST_READY) {
|
||||
osdir_list_finish(); /* close current listing */
|
||||
}
|
||||
osdir_dir = NULL;
|
||||
if (ok_to_open(path, "r"))
|
||||
osdir_dir = opendir(path);
|
||||
if (!osdir_dir) {
|
||||
return FALSE;
|
||||
}
|
||||
osdir_list_status = OSDIR_LIST_STARTED;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* osdir_list_next -- read the next entry from a directory */
|
||||
const char *osdir_list_next()
|
||||
{
|
||||
if (osdir_list_status != OSDIR_LIST_STARTED) {
|
||||
return NULL;
|
||||
}
|
||||
struct dirent *entry = readdir(osdir_dir);
|
||||
if (!entry) {
|
||||
osdir_list_status = OSDIR_LIST_DONE;
|
||||
return NULL;
|
||||
} else {
|
||||
return entry->d_name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* osdir_list_finish -- close an open directory */
|
||||
void osdir_list_finish()
|
||||
{
|
||||
if (osdir_list_status != OSDIR_LIST_READY) {
|
||||
closedir(osdir_dir);
|
||||
}
|
||||
osdir_list_status = OSDIR_LIST_READY;
|
||||
}
|
||||
|
||||
|
||||
/* xcheck -- return a character if one is present */
|
||||
LOCAL int xcheck()
|
||||
{
|
||||
int ch = term_testchar();
|
||||
return ch;
|
||||
}
|
||||
|
||||
/* xgetkey - get a key from the keyboard */
|
||||
LVAL xgetkey() {xllastarg(); return (cvfixnum((FIXTYPE)term_getchar()));}
|
||||
|
||||
/* ossymbols - enter os specific symbols */
|
||||
void ossymbols(void) {}
|
||||
|
||||
/* xsetupconsole -- used to configure window in Win32 version */
|
||||
LVAL xsetupconsole() { return NIL; }
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
sys/unix/osx/README.txt -- notes on OS X (Apple) version of Nyquist
|
||||
|
||||
Roger B. Dannenberg
|
||||
23 April 2011
|
||||
|
||||
HOW TO REBUILD STUBS TO CALL NYQUIST PRIMITIVES FROM XLISP
|
||||
|
||||
The file nyqsrc/sndfnint.c implements XLISP functions that correspond
|
||||
to Nyquist primitives such as SND-OSC. This file and a number of
|
||||
associated files (such as sndfnintdefs.h) are built automatically by
|
||||
the intgen program. This process is automated in the Linux Makefile,
|
||||
but here's how to do it under OS X.
|
||||
|
||||
0. COMPILE NYQUIST WITH XCODE
|
||||
Before changing the sources, make sure you can compile your existing
|
||||
installation of Nyquist using XCODE.
|
||||
|
||||
1. COMPILE INTGEN WITH XCODE
|
||||
From XCODE, choose Active Configuration: Deployment, Active Target:
|
||||
intgen, Active Executable: intgen.
|
||||
|
||||
Build (Command-B).
|
||||
|
||||
Result is in nyquist/macosxproject/build/Deployment/intgen. You might
|
||||
want to make an alias to this or move it to your ~/bin directory or
|
||||
change your PATH so you can execute this from the command line without
|
||||
typing the full path. In the following, I assume simply typing
|
||||
"intgen" will run the application.
|
||||
|
||||
After setting up intgen to run, the command "which intgen" should
|
||||
indicate the path to intgen that the shell will use.
|
||||
|
||||
2. WORK IN A TERMINAL WINDOW AND CD TO THE MAIN NYQUIST DIRECTORY
|
||||
Open a Terminal application.
|
||||
cd nyquist [or navigate using cd to wherever your nyquist sources are]
|
||||
|
||||
3. GENERATE THE INTERFACE CODE
|
||||
Note: if you are adding a new primitive, you will want to modify
|
||||
sys/unix/osx/sndfnint.cmdline by inserting the name of the header (.h)
|
||||
file for the new primitive. (For a nyquist release, the name should
|
||||
also go into a list in nyquist/misc/transfiles.lsp and the Makefiles
|
||||
should be rebuilt, but we'll stick to the Apple-specific tasks here.)
|
||||
|
||||
intgen @sys/unix/osx/sndfnint.cmdline
|
||||
|
||||
The files sndfnint.c, sndfnint.lsp, sndfnintdefs.h, and sndfnintptrs.h
|
||||
will be generated and placed in the current (nyquist) directory.
|
||||
|
||||
4. INSTALL THE FILES
|
||||
You might want to make a safe backup copy of the original
|
||||
nyqsrc/sndfnint.c, nyqsrc/sndfnint.lsp, nyqsrc/sndfnintdefs.h, and
|
||||
nyqsrc/sndfnintptrs.h for reference.
|
||||
|
||||
Move the new files to nyqsrc:
|
||||
|
||||
mv sndfnint.c sndfnint.lsp sndfnintdefs.h sndfnintptrs.h nyqsrc
|
||||
|
||||
5. RECOMPILE NYQUIST WITH XCODE
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#csh
|
||||
# INSTRUCTIONS: for developers, in the top nyquist directory:
|
||||
# ln -l sys/unix/osx/run
|
||||
# ln -s macosxproject/build/ny
|
||||
java -cp jnyqide/NyquistIDE.jar jnyqide.Main
|
|
@ -0,0 +1,105 @@
|
|||
sndfnint
|
||||
nyqsrc/sndfmt.h
|
||||
nylsf/sndfile.h
|
||||
nyqsrc/sound.h
|
||||
nyqsrc/add.h
|
||||
nyqsrc/avg.h
|
||||
nyqsrc/compose.h
|
||||
nyqsrc/convolve.h
|
||||
nyqsrc/downsample.h
|
||||
nyqsrc/fft.h
|
||||
nyqsrc/inverse.h
|
||||
nyqsrc/multiseq.h
|
||||
nyqsrc/resamp.h
|
||||
nyqsrc/resampv.h
|
||||
nyqsrc/samples.h
|
||||
nyqsrc/sndmax.h
|
||||
nyqsrc/sndread.h
|
||||
nyqsrc/sndseq.h
|
||||
nyqsrc/sndsliders.h
|
||||
nyqsrc/sndwrite.h
|
||||
nyqsrc/yin.h
|
||||
nyqsrc/nyq-osc-server.h
|
||||
nyqsrc/trigger.h
|
||||
nyqsrc/lpanal.h
|
||||
nyqsrc/phasevocoder.h
|
||||
nyqsrc/pvshell.h
|
||||
tran/abs.h
|
||||
tran/allpoles.h
|
||||
tran/alpass.h
|
||||
tran/alpasscv.h
|
||||
tran/alpassvv.h
|
||||
tran/amosc.h
|
||||
tran/areson.h
|
||||
tran/aresonvc.h
|
||||
tran/aresoncv.h
|
||||
tran/aresonvv.h
|
||||
tran/atone.h
|
||||
tran/atonev.h
|
||||
tran/biquadfilt.h
|
||||
tran/buzz.h
|
||||
tran/chase.h
|
||||
tran/clip.h
|
||||
tran/congen.h
|
||||
tran/const.h
|
||||
tran/coterm.h
|
||||
tran/delaycc.h
|
||||
tran/delaycv.h
|
||||
tran/eqbandvvv.h
|
||||
tran/exp.h
|
||||
tran/follow.h
|
||||
tran/fmosc.h
|
||||
tran/fromobject.h
|
||||
tran/fromarraystream.h
|
||||
tran/gate.h
|
||||
tran/ifft.h
|
||||
tran/instrclar.h
|
||||
tran/instrclarall.h
|
||||
tran/instrclarfreq.h
|
||||
tran/instrsax.h
|
||||
tran/instrsaxall.h
|
||||
tran/instrsaxfreq.h
|
||||
tran/integrate.h
|
||||
tran/log.h
|
||||
tran/lpreson.h
|
||||
tran/maxv.h
|
||||
tran/offset.h
|
||||
tran/oneshot.h
|
||||
tran/osc.h
|
||||
tran/partial.h
|
||||
tran/pluck.h
|
||||
tran/prod.h
|
||||
tran/pwl.h
|
||||
tran/quantize.h
|
||||
tran/recip.h
|
||||
tran/reson.h
|
||||
tran/resonvc.h
|
||||
tran/resoncv.h
|
||||
tran/resonvv.h
|
||||
tran/sampler.h
|
||||
tran/scale.h
|
||||
tran/shape.h
|
||||
tran/sine.h
|
||||
tran/siosc.h
|
||||
tran/slope.h
|
||||
tran/sqrt.h
|
||||
tran/tapf.h
|
||||
tran/tapv.h
|
||||
tran/tone.h
|
||||
tran/tonev.h
|
||||
tran/upsample.h
|
||||
tran/white.h
|
||||
tran/stkrev.h
|
||||
tran/stkpitshift.h
|
||||
tran/stkchorus.h
|
||||
tran/instrbow.h
|
||||
tran/instrbowedfreq.h
|
||||
tran/instrbanded.h
|
||||
tran/instrmandolin.h
|
||||
tran/instrsitar.h
|
||||
tran/instrmodalbar.h
|
||||
tran/instrflute.h
|
||||
tran/instrflutefreq.h
|
||||
tran/instrfluteall.h
|
||||
tran/fmfb.h
|
||||
tran/fmfbv.h
|
|
@ -0,0 +1,69 @@
|
|||
;; system.lsp -- system-dependent lisp code
|
||||
|
||||
; local definition for play
|
||||
; this one is for Mac OS-X:
|
||||
|
||||
(if (not (boundp '*default-sf-format*))
|
||||
(setf *default-sf-format* snd-head-wave))
|
||||
|
||||
(if (not (boundp '*default-sound-file*))
|
||||
(compute-default-sound-file))
|
||||
|
||||
(if (not (boundp '*default-sf-dir*))
|
||||
(setf *default-sf-dir* "/tmp"))
|
||||
|
||||
(format t "*default-sf-dir* (default sound file directory) is ~A~%"
|
||||
*default-sf-dir*)
|
||||
|
||||
(if (not (boundp '*default-sf-mode*))
|
||||
(setf *default-sf-mode* snd-mode-pcm))
|
||||
|
||||
(if (not (boundp '*default-sf-bits*))
|
||||
(setf *default-sf-bits* 16))
|
||||
|
||||
(if (not (boundp '*default-plot-file*))
|
||||
(setf *default-plot-file* (strcat (get-user) "-points.dat")))
|
||||
|
||||
|
||||
; FULL-NAME-P -- test if file name is a full path or relative path
|
||||
;
|
||||
; (otherwise the *default-sf-dir* will be prepended
|
||||
;
|
||||
(defun full-name-p (filename)
|
||||
(or (eq (char filename 0) #\/)
|
||||
(eq (char filename 0) #\.)))
|
||||
|
||||
; RELATIVE-PATH-P -- test if filename or path is a relative path
|
||||
;
|
||||
(defun relative-path-p (filename)
|
||||
(not (eq (char filename 0) #\/)))
|
||||
|
||||
(setf *file-separator* #\/)
|
||||
|
||||
|
||||
;; PLAY-FILE - play a sound file
|
||||
;;
|
||||
(defun play-file (name)
|
||||
(s-save (s-read name) NY:ALL "" :play t))
|
||||
|
||||
|
||||
;; R - replay last file written with PLAY
|
||||
(defun r () (play-file *default-sound-file*))
|
||||
|
||||
;;;; use this old version if you want to use sndplay to play
|
||||
;;;; the result file rather than play the samples as they
|
||||
;;;; are computed. This version does not autonormalize.
|
||||
;; PLAY - write value of an expression to file and play it
|
||||
;;
|
||||
;(defmacro play (expr)
|
||||
; `(prog (specs)
|
||||
; (setf specs (s-save (force-srate *sound-srate* ,expr)
|
||||
; 1000000000 *default-sound-file*))
|
||||
; (r)))
|
||||
;;;;
|
||||
|
||||
; local definition for play
|
||||
(defmacro play (expr)
|
||||
`(s-save-autonorm ,expr NY:ALL *default-sound-file* :play *soundenable*))
|
||||
|
||||
;; use standard s-plot
|
|
@ -0,0 +1,2 @@
|
|||
graph < points.dat | plot -Ttek
|
||||
|
|
@ -0,0 +1,520 @@
|
|||
#
|
||||
# Makefile for Nyquist, SYSTEM-TYPE is PMAX
|
||||
# run make in the top-level Nyquist directory to compile Nyquist
|
||||
#
|
||||
# NOTE: this file is machine-generated. DO NOT EDIT!
|
||||
# Instead, modify makefile.lsp and regenerate the makefile.
|
||||
# Ports and bug fixes are welcome - please mail them to
|
||||
# dannenberg@cs.cmu.edu. Thanks.
|
||||
#
|
||||
|
||||
# This is the resulting executable (normally "ny"):
|
||||
NY = ny
|
||||
|
||||
# Standard list of includes (common to all unix versions)
|
||||
INCL = -Inyqsrc -Itran -Ixlisp -Isys/unix -Icmt -Isnd -Ifft
|
||||
|
||||
# system dependent stuff for pmax:
|
||||
|
||||
CC = cc
|
||||
CFLAGS = -DCMTSTUFF -g $(INCL)
|
||||
LN = cc
|
||||
LFLAGS = -lm
|
||||
|
||||
|
||||
INTGEN = misc/intgen
|
||||
|
||||
# Object files for Nyquist:
|
||||
OBJECTS = xlisp/extern.o xlisp/xldmem.o xlisp/xlbfun.o xlisp/xlcont.o \
|
||||
xlisp/xldbug.o xlisp/xleval.o xlisp/xlfio.o xlisp/xlftab.o \
|
||||
xlisp/xlglob.o xlisp/xlimage.o xlisp/xlinit.o xlisp/xlio.o \
|
||||
xlisp/xlisp.o xlisp/xljump.o xlisp/xllist.o xlisp/xlmath.o \
|
||||
xlisp/xlobj.o xlisp/xlpp.o xlisp/xlprin.o xlisp/xlread.o \
|
||||
xlisp/xlstr.o xlisp/xlsubr.o xlisp/xlsym.o xlisp/xlsys.o \
|
||||
tran/amosc.o tran/clip.o tran/const.o tran/fmosc.o \
|
||||
tran/integrate.o tran/log.o tran/maxv.o tran/osc.o \
|
||||
tran/prod.o tran/buzz.o tran/pwl.o tran/recip.o \
|
||||
tran/upsample.o tran/scale.o tran/sine.o tran/partial.o \
|
||||
tran/white.o tran/tone.o tran/tonev.o tran/atonev.o \
|
||||
tran/atone.o tran/reson.o tran/areson.o tran/resonvc.o \
|
||||
tran/resoncv.o tran/aresonvc.o tran/aresoncv.o tran/resonvv.o \
|
||||
tran/aresonvv.o tran/offset.o tran/slope.o tran/delay.o \
|
||||
tran/delaycv.o tran/shape.o tran/sampler.o tran/exp.o \
|
||||
tran/siosc.o tran/follow.o tran/gate.o tran/quantize.o \
|
||||
tran/ifft.o tran/congen.o tran/fromobject.o tran/fromarraystream.o \
|
||||
tran/coterm.o tran/convolve.o tran/alpass.o tran/oneshot.o \
|
||||
tran/chase.o tran/tapv.o tran/biquad.o tran/pluck.o \
|
||||
cmt/cext.o cmt/cleanup.o cmt/cmdline.o cmt/cmtcmd.o \
|
||||
cmt/moxc.o cmt/mem.o cmt/midifile.o cmt/midifns.o \
|
||||
cmt/record.o cmt/seq.o cmt/seqmread.o cmt/seqmwrite.o \
|
||||
cmt/seqread.o cmt/seqwrite.o cmt/tempomap.o cmt/timebase.o \
|
||||
cmt/userio.o nyqsrc/debug.o nyqsrc/falloc.o nyqsrc/add.o \
|
||||
nyqsrc/local.o nyqsrc/downsample.o nyqsrc/handlers.o nyqsrc/multiread.o \
|
||||
nyqsrc/multiseq.o nyqsrc/samples.o nyqsrc/seqext.o nyqsrc/seqinterf.o \
|
||||
nyqsrc/sndread.o nyqsrc/sndseq.o nyqsrc/sndwrite.o nyqsrc/sndmax.o \
|
||||
nyqsrc/sound.o nyqsrc/stats.o nyqsrc/compose.o nyqsrc/inverse.o \
|
||||
nyqsrc/resamp.o nyqsrc/resampv.o nyqsrc/ffilterkit.o nyqsrc/avg.o \
|
||||
nyqsrc/fft.o nyqsrc/sndfail.o fft/fftn.o nyqsrc/sndfnint.o \
|
||||
nyqsrc/seqfnint.o snd/audiopmax.o snd/sndpmax.o snd/ieeecvt.o \
|
||||
snd/snd.o snd/sndcvt.o snd/sndio.o snd/sndheader.o \
|
||||
sys/unix/osstuff.o sys/unix/term.o
|
||||
|
||||
# Sound functions to add to xlisp
|
||||
NYQHDRS = snd/snd.h nyqsrc/sound.h nyqsrc/downsample.h nyqsrc/sndread.h \
|
||||
nyqsrc/sndseq.h nyqsrc/add.h nyqsrc/multiseq.h nyqsrc/samples.h \
|
||||
nyqsrc/sndwrite.h nyqsrc/sndmax.h nyqsrc/compose.h nyqsrc/inverse.h \
|
||||
nyqsrc/resamp.h nyqsrc/resampv.h nyqsrc/fft.h nyqsrc/avg.h \
|
||||
tran/amosc.h tran/clip.h tran/const.h tran/fmosc.h \
|
||||
tran/integrate.h tran/log.h tran/maxv.h tran/osc.h \
|
||||
tran/prod.h tran/buzz.h tran/pwl.h tran/recip.h \
|
||||
tran/upsample.h tran/scale.h tran/sine.h tran/partial.h \
|
||||
tran/white.h tran/tone.h tran/tonev.h tran/atonev.h \
|
||||
tran/atone.h tran/reson.h tran/areson.h tran/resonvc.h \
|
||||
tran/resoncv.h tran/aresonvc.h tran/aresoncv.h tran/resonvv.h \
|
||||
tran/aresonvv.h tran/offset.h tran/slope.h tran/delaycc.h \
|
||||
tran/delaycv.h tran/shape.h tran/sampler.h tran/exp.h \
|
||||
tran/siosc.h tran/follow.h tran/gate.h tran/quantize.h \
|
||||
tran/ifft.h tran/congen.h tran/fromobject.h tran/fromarraystream.h \
|
||||
tran/coterm.h tran/convolve.h tran/alpass.h tran/oneshot.h \
|
||||
tran/chase.h tran/tapv.h tran/biquad.h tran/pluck.h
|
||||
|
||||
CMTHDRS = cmt/seqdecls.h nyqsrc/seqext.h cmt/seq.h nyqsrc/seqinterf.h \
|
||||
cmt/seqread.h cmt/seqmread.h cmt/seqwrite.h cmt/seqmwrite.h
|
||||
|
||||
|
||||
EVERYTHING = $(NY) runtime/system.lsp
|
||||
|
||||
CURRENT = $(EVERYTHING)
|
||||
|
||||
current: $(CURRENT)
|
||||
|
||||
$(NY): $(OBJECTS)
|
||||
$(LN) $(OBJECTS) $(LFLAGS) -o $(NY)
|
||||
|
||||
# copy appropriate system.lsp and make it read-only;
|
||||
# changes should be made to sys/unix/<system>/system.lsp
|
||||
runtime/system.lsp: sys/unix/pmax/system.lsp
|
||||
chmod +w runtime/system.lsp
|
||||
cp -p sys/unix/pmax/system.lsp runtime/system.lsp
|
||||
chmod -w runtime/system.lsp
|
||||
|
||||
nyqsrc/debug.o: nyqsrc/debug.c nyqsrc/debug.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/debug.c -o nyqsrc/debug.o $(CFLAGS)
|
||||
|
||||
nyqsrc/falloc.o: nyqsrc/falloc.c nyqsrc/falloc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/falloc.c -o nyqsrc/falloc.o $(CFLAGS)
|
||||
|
||||
nyqsrc/add.o: nyqsrc/add.c nyqsrc/add.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/add.c -o nyqsrc/add.o $(CFLAGS)
|
||||
|
||||
nyqsrc/local.o: nyqsrc/local.c xlisp/xlisp.h nyqsrc/sound.h
|
||||
cc -c nyqsrc/local.c -o nyqsrc/local.o $(CFLAGS)
|
||||
|
||||
nyqsrc/downsample.o: nyqsrc/downsample.c nyqsrc/downsample.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/downsample.c -o nyqsrc/downsample.o $(CFLAGS)
|
||||
|
||||
nyqsrc/handlers.o: nyqsrc/handlers.c
|
||||
cc -c nyqsrc/handlers.c -o nyqsrc/handlers.o $(CFLAGS)
|
||||
|
||||
nyqsrc/multiread.o: nyqsrc/multiread.c nyqsrc/multiread.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/multiread.c -o nyqsrc/multiread.o $(CFLAGS)
|
||||
|
||||
nyqsrc/multiseq.o: nyqsrc/multiseq.c nyqsrc/multiseq.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/multiseq.c -o nyqsrc/multiseq.o $(CFLAGS)
|
||||
|
||||
nyqsrc/samples.o: nyqsrc/samples.c nyqsrc/samples.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/samples.c -o nyqsrc/samples.o $(CFLAGS)
|
||||
|
||||
nyqsrc/seqext.o: nyqsrc/seqext.c nyqsrc/seqext.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/seqext.c -o nyqsrc/seqext.o $(CFLAGS)
|
||||
|
||||
nyqsrc/seqinterf.o: nyqsrc/seqinterf.c nyqsrc/seqinterf.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/seqinterf.c -o nyqsrc/seqinterf.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sndread.o: nyqsrc/sndread.c nyqsrc/sndread.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/sndread.c -o nyqsrc/sndread.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sndseq.o: nyqsrc/sndseq.c nyqsrc/sndseq.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/sndseq.c -o nyqsrc/sndseq.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sndwrite.o: nyqsrc/sndwrite.c nyqsrc/sndwrite.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/sndwrite.c -o nyqsrc/sndwrite.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sndmax.o: nyqsrc/sndmax.c nyqsrc/sndmax.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/sndmax.c -o nyqsrc/sndmax.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sound.o: nyqsrc/sound.c nyqsrc/sound.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/sound.c -o nyqsrc/sound.o $(CFLAGS)
|
||||
|
||||
nyqsrc/stats.o: nyqsrc/stats.c nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/stats.c -o nyqsrc/stats.o $(CFLAGS)
|
||||
|
||||
nyqsrc/compose.o: nyqsrc/compose.c nyqsrc/compose.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/compose.c -o nyqsrc/compose.o $(CFLAGS)
|
||||
|
||||
nyqsrc/inverse.o: nyqsrc/inverse.c nyqsrc/inverse.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/inverse.c -o nyqsrc/inverse.o $(CFLAGS)
|
||||
|
||||
nyqsrc/resamp.o: nyqsrc/resamp.c nyqsrc/resamp.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/resamp.c -o nyqsrc/resamp.o $(CFLAGS)
|
||||
|
||||
nyqsrc/resampv.o: nyqsrc/resampv.c nyqsrc/resampv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/resampv.c -o nyqsrc/resampv.o $(CFLAGS)
|
||||
|
||||
nyqsrc/ffilterkit.o: nyqsrc/ffilterkit.c nyqsrc/ffilterkit.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/ffilterkit.c -o nyqsrc/ffilterkit.o $(CFLAGS)
|
||||
|
||||
nyqsrc/avg.o: nyqsrc/avg.c nyqsrc/avg.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/avg.c -o nyqsrc/avg.o $(CFLAGS)
|
||||
|
||||
nyqsrc/fft.o: nyqsrc/fft.c nyqsrc/fft.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c nyqsrc/fft.c -o nyqsrc/fft.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sndfail.o: nyqsrc/sndfail.c
|
||||
cc -c nyqsrc/sndfail.c -o nyqsrc/sndfail.o $(CFLAGS)
|
||||
|
||||
snd/audiopmax.o: snd/audiopmax.c snd/snd.h
|
||||
cc -c snd/audiopmax.c -o snd/audiopmax.o $(CFLAGS)
|
||||
|
||||
snd/sndpmax.o: snd/sndpmax.c snd/sndpmax.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c snd/sndpmax.c -o snd/sndpmax.o $(CFLAGS)
|
||||
|
||||
snd/ieeecvt.o: snd/ieeecvt.c snd/ieeecvt.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c snd/ieeecvt.c -o snd/ieeecvt.o $(CFLAGS)
|
||||
|
||||
snd/snd.o: snd/snd.c snd/snd.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c snd/snd.c -o snd/snd.o $(CFLAGS)
|
||||
|
||||
snd/sndcvt.o: snd/sndcvt.c snd/snd.h
|
||||
cc -c snd/sndcvt.c -o snd/sndcvt.o $(CFLAGS)
|
||||
|
||||
snd/sndio.o: snd/sndio.c snd/snd.h
|
||||
cc -c snd/sndio.c -o snd/sndio.o $(CFLAGS)
|
||||
|
||||
snd/sndheader.o: snd/sndheader.c snd/sndheader.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c snd/sndheader.c -o snd/sndheader.o $(CFLAGS)
|
||||
|
||||
fft/fftn.o: fft/fftn.c fft/fftn.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c fft/fftn.c -o fft/fftn.o $(CFLAGS)
|
||||
|
||||
tran/amosc.o: tran/amosc.c tran/amosc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/amosc.c -o tran/amosc.o $(CFLAGS)
|
||||
|
||||
tran/clip.o: tran/clip.c tran/clip.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/clip.c -o tran/clip.o $(CFLAGS)
|
||||
|
||||
tran/const.o: tran/const.c tran/const.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/const.c -o tran/const.o $(CFLAGS)
|
||||
|
||||
tran/fmosc.o: tran/fmosc.c tran/fmosc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/fmosc.c -o tran/fmosc.o $(CFLAGS)
|
||||
|
||||
tran/integrate.o: tran/integrate.c tran/integrate.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/integrate.c -o tran/integrate.o $(CFLAGS)
|
||||
|
||||
tran/log.o: tran/log.c tran/log.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/log.c -o tran/log.o $(CFLAGS)
|
||||
|
||||
tran/maxv.o: tran/maxv.c tran/maxv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/maxv.c -o tran/maxv.o $(CFLAGS)
|
||||
|
||||
tran/osc.o: tran/osc.c tran/osc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/osc.c -o tran/osc.o $(CFLAGS)
|
||||
|
||||
tran/prod.o: tran/prod.c tran/prod.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/prod.c -o tran/prod.o $(CFLAGS)
|
||||
|
||||
tran/buzz.o: tran/buzz.c tran/buzz.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/buzz.c -o tran/buzz.o $(CFLAGS)
|
||||
|
||||
tran/pwl.o: tran/pwl.c tran/pwl.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/pwl.c -o tran/pwl.o $(CFLAGS)
|
||||
|
||||
tran/recip.o: tran/recip.c tran/recip.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/recip.c -o tran/recip.o $(CFLAGS)
|
||||
|
||||
tran/upsample.o: tran/upsample.c tran/upsample.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/upsample.c -o tran/upsample.o $(CFLAGS)
|
||||
|
||||
tran/scale.o: tran/scale.c tran/scale.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/scale.c -o tran/scale.o $(CFLAGS)
|
||||
|
||||
tran/sine.o: tran/sine.c tran/sine.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/sine.c -o tran/sine.o $(CFLAGS)
|
||||
|
||||
tran/partial.o: tran/partial.c tran/partial.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/partial.c -o tran/partial.o $(CFLAGS)
|
||||
|
||||
tran/white.o: tran/white.c tran/white.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/white.c -o tran/white.o $(CFLAGS)
|
||||
|
||||
tran/tone.o: tran/tone.c tran/tone.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/tone.c -o tran/tone.o $(CFLAGS)
|
||||
|
||||
tran/tonev.o: tran/tonev.c tran/tonev.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/tonev.c -o tran/tonev.o $(CFLAGS)
|
||||
|
||||
tran/atonev.o: tran/atonev.c tran/atonev.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/atonev.c -o tran/atonev.o $(CFLAGS)
|
||||
|
||||
tran/atone.o: tran/atone.c tran/atone.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/atone.c -o tran/atone.o $(CFLAGS)
|
||||
|
||||
tran/reson.o: tran/reson.c tran/reson.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/reson.c -o tran/reson.o $(CFLAGS)
|
||||
|
||||
tran/areson.o: tran/areson.c tran/areson.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/areson.c -o tran/areson.o $(CFLAGS)
|
||||
|
||||
tran/resonvc.o: tran/resonvc.c tran/resonvc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/resonvc.c -o tran/resonvc.o $(CFLAGS)
|
||||
|
||||
tran/resoncv.o: tran/resoncv.c tran/resoncv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/resoncv.c -o tran/resoncv.o $(CFLAGS)
|
||||
|
||||
tran/aresonvc.o: tran/aresonvc.c tran/aresonvc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/aresonvc.c -o tran/aresonvc.o $(CFLAGS)
|
||||
|
||||
tran/aresoncv.o: tran/aresoncv.c tran/aresoncv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/aresoncv.c -o tran/aresoncv.o $(CFLAGS)
|
||||
|
||||
tran/resonvv.o: tran/resonvv.c tran/resonvv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/resonvv.c -o tran/resonvv.o $(CFLAGS)
|
||||
|
||||
tran/aresonvv.o: tran/aresonvv.c tran/aresonvv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/aresonvv.c -o tran/aresonvv.o $(CFLAGS)
|
||||
|
||||
tran/offset.o: tran/offset.c tran/offset.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/offset.c -o tran/offset.o $(CFLAGS)
|
||||
|
||||
tran/slope.o: tran/slope.c tran/slope.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/slope.c -o tran/slope.o $(CFLAGS)
|
||||
|
||||
tran/delaycc.o: tran/delaycc.c tran/delaycc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/delaycc.c -o tran/delaycc.o $(CFLAGS)
|
||||
|
||||
tran/delaycv.o: tran/delaycv.c tran/delaycv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/delaycv.c -o tran/delaycv.o $(CFLAGS)
|
||||
|
||||
tran/shape.o: tran/shape.c tran/shape.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/shape.c -o tran/shape.o $(CFLAGS)
|
||||
|
||||
tran/sampler.o: tran/sampler.c tran/sampler.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/sampler.c -o tran/sampler.o $(CFLAGS)
|
||||
|
||||
tran/exp.o: tran/exp.c tran/exp.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/exp.c -o tran/exp.o $(CFLAGS)
|
||||
|
||||
tran/siosc.o: tran/siosc.c tran/siosc.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/siosc.c -o tran/siosc.o $(CFLAGS)
|
||||
|
||||
tran/follow.o: tran/follow.c tran/follow.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/follow.c -o tran/follow.o $(CFLAGS)
|
||||
|
||||
tran/gate.o: tran/gate.c tran/gate.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/gate.c -o tran/gate.o $(CFLAGS)
|
||||
|
||||
tran/quantize.o: tran/quantize.c tran/quantize.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/quantize.c -o tran/quantize.o $(CFLAGS)
|
||||
|
||||
tran/ifft.o: tran/ifft.c tran/ifft.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/ifft.c -o tran/ifft.o $(CFLAGS)
|
||||
|
||||
tran/congen.o: tran/congen.c tran/congen.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/congen.c -o tran/congen.o $(CFLAGS)
|
||||
|
||||
tran/fromobject.o: tran/fromobject.c tran/fromobject.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/fromobject.c -o tran/fromobject.o $(CFLAGS)
|
||||
|
||||
tran/fromarraystream.o: tran/fromarraystream.c tran/fromarraystream.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/fromarraystream.c -o tran/fromarraystream.o $(CFLAGS)
|
||||
|
||||
tran/coterm.o: tran/coterm.c tran/coterm.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/coterm.c -o tran/coterm.o $(CFLAGS)
|
||||
|
||||
tran/convolve.o: tran/convolve.c tran/convolve.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/convolve.c -o tran/convolve.o $(CFLAGS)
|
||||
|
||||
tran/alpass.o: tran/alpass.c tran/alpass.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/alpass.c -o tran/alpass.o $(CFLAGS)
|
||||
|
||||
tran/oneshot.o: tran/oneshot.c tran/oneshot.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/oneshot.c -o tran/oneshot.o $(CFLAGS)
|
||||
|
||||
tran/chase.o: tran/chase.c tran/chase.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/chase.c -o tran/chase.o $(CFLAGS)
|
||||
|
||||
tran/tapv.o: tran/tapv.c tran/tapv.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/tapv.c -o tran/tapv.o $(CFLAGS)
|
||||
|
||||
tran/biquad.o: tran/biquad.c tran/biquad.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/biquad.c -o tran/biquad.o $(CFLAGS)
|
||||
|
||||
tran/pluck.o: tran/pluck.c tran/pluck.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h
|
||||
cc -c tran/pluck.c -o tran/pluck.o $(CFLAGS)
|
||||
|
||||
nyqsrc/sndfnint.o: nyqsrc/sndfnint.c
|
||||
cc -c nyqsrc/sndfnint.c -o nyqsrc/sndfnint.o $(CFLAGS)
|
||||
|
||||
nyqsrc/seqfnint.o: nyqsrc/seqfnint.c
|
||||
cc -c nyqsrc/seqfnint.c -o nyqsrc/seqfnint.o $(CFLAGS)
|
||||
|
||||
xlisp/xlftab.o: nyqsrc/sndfnintptrs.h nyqsrc/sndfnintdefs.h nyqsrc/seqfnintptrs.h nyqsrc/seqfnintdefs.h
|
||||
cc -c xlisp/xlftab.c -o xlisp/xlftab.o $(CFLAGS)
|
||||
|
||||
xlisp/extern.o: xlisp/extern.c
|
||||
cc -c xlisp/extern.c -o xlisp/extern.o $(CFLAGS)
|
||||
|
||||
xlisp/xldmem.o: xlisp/xldmem.c
|
||||
cc -c xlisp/xldmem.c -o xlisp/xldmem.o $(CFLAGS)
|
||||
|
||||
xlisp/xlbfun.o: xlisp/xlbfun.c
|
||||
cc -c xlisp/xlbfun.c -o xlisp/xlbfun.o $(CFLAGS)
|
||||
|
||||
xlisp/xlcont.o: xlisp/xlcont.c
|
||||
cc -c xlisp/xlcont.c -o xlisp/xlcont.o $(CFLAGS)
|
||||
|
||||
xlisp/xldbug.o: xlisp/xldbug.c
|
||||
cc -c xlisp/xldbug.c -o xlisp/xldbug.o $(CFLAGS)
|
||||
|
||||
xlisp/xleval.o: xlisp/xleval.c
|
||||
cc -c xlisp/xleval.c -o xlisp/xleval.o $(CFLAGS)
|
||||
|
||||
xlisp/xlfio.o: xlisp/xlfio.c
|
||||
cc -c xlisp/xlfio.c -o xlisp/xlfio.o $(CFLAGS)
|
||||
|
||||
xlisp/xlglob.o: xlisp/xlglob.c
|
||||
cc -c xlisp/xlglob.c -o xlisp/xlglob.o $(CFLAGS)
|
||||
|
||||
xlisp/xlimage.o: xlisp/xlimage.c
|
||||
cc -c xlisp/xlimage.c -o xlisp/xlimage.o $(CFLAGS)
|
||||
|
||||
xlisp/xlinit.o: xlisp/xlinit.c
|
||||
cc -c xlisp/xlinit.c -o xlisp/xlinit.o $(CFLAGS)
|
||||
|
||||
xlisp/xlio.o: xlisp/xlio.c
|
||||
cc -c xlisp/xlio.c -o xlisp/xlio.o $(CFLAGS)
|
||||
|
||||
xlisp/xlisp.o: xlisp/xlisp.c
|
||||
cc -c xlisp/xlisp.c -o xlisp/xlisp.o $(CFLAGS)
|
||||
|
||||
xlisp/xljump.o: xlisp/xljump.c
|
||||
cc -c xlisp/xljump.c -o xlisp/xljump.o $(CFLAGS)
|
||||
|
||||
xlisp/xllist.o: xlisp/xllist.c
|
||||
cc -c xlisp/xllist.c -o xlisp/xllist.o $(CFLAGS)
|
||||
|
||||
xlisp/xlmath.o: xlisp/xlmath.c
|
||||
cc -c xlisp/xlmath.c -o xlisp/xlmath.o $(CFLAGS)
|
||||
|
||||
xlisp/xlobj.o: xlisp/xlobj.c
|
||||
cc -c xlisp/xlobj.c -o xlisp/xlobj.o $(CFLAGS)
|
||||
|
||||
xlisp/xlpp.o: xlisp/xlpp.c
|
||||
cc -c xlisp/xlpp.c -o xlisp/xlpp.o $(CFLAGS)
|
||||
|
||||
xlisp/xlprin.o: xlisp/xlprin.c
|
||||
cc -c xlisp/xlprin.c -o xlisp/xlprin.o $(CFLAGS)
|
||||
|
||||
xlisp/xlread.o: xlisp/xlread.c
|
||||
cc -c xlisp/xlread.c -o xlisp/xlread.o $(CFLAGS)
|
||||
|
||||
xlisp/xlstr.o: xlisp/xlstr.c
|
||||
cc -c xlisp/xlstr.c -o xlisp/xlstr.o $(CFLAGS)
|
||||
|
||||
xlisp/xlsubr.o: xlisp/xlsubr.c
|
||||
cc -c xlisp/xlsubr.c -o xlisp/xlsubr.o $(CFLAGS)
|
||||
|
||||
xlisp/xlsym.o: xlisp/xlsym.c
|
||||
cc -c xlisp/xlsym.c -o xlisp/xlsym.o $(CFLAGS)
|
||||
|
||||
xlisp/xlsys.o: xlisp/xlsys.c
|
||||
cc -c xlisp/xlsys.c -o xlisp/xlsys.o $(CFLAGS)
|
||||
|
||||
cmt/cext.o: cmt/cext.c
|
||||
cc -c cmt/cext.c -o cmt/cext.o $(CFLAGS)
|
||||
|
||||
cmt/cleanup.o: cmt/cleanup.c
|
||||
cc -c cmt/cleanup.c -o cmt/cleanup.o $(CFLAGS)
|
||||
|
||||
cmt/cmdline.o: cmt/cmdline.c
|
||||
cc -c cmt/cmdline.c -o cmt/cmdline.o $(CFLAGS)
|
||||
|
||||
cmt/cmtcmd.o: cmt/cmtcmd.c
|
||||
cc -c cmt/cmtcmd.c -o cmt/cmtcmd.o $(CFLAGS)
|
||||
|
||||
cmt/moxc.o: cmt/moxc.c
|
||||
cc -c cmt/moxc.c -o cmt/moxc.o $(CFLAGS)
|
||||
|
||||
cmt/mem.o: cmt/mem.c
|
||||
cc -c cmt/mem.c -o cmt/mem.o $(CFLAGS)
|
||||
|
||||
cmt/midifile.o: cmt/midifile.c
|
||||
cc -c cmt/midifile.c -o cmt/midifile.o $(CFLAGS)
|
||||
|
||||
cmt/midifns.o: cmt/midifns.c
|
||||
cc -c cmt/midifns.c -o cmt/midifns.o $(CFLAGS)
|
||||
|
||||
cmt/record.o: cmt/record.c
|
||||
cc -c cmt/record.c -o cmt/record.o $(CFLAGS)
|
||||
|
||||
cmt/seq.o: cmt/seq.c
|
||||
cc -c cmt/seq.c -o cmt/seq.o $(CFLAGS)
|
||||
|
||||
cmt/seqmread.o: cmt/seqmread.c
|
||||
cc -c cmt/seqmread.c -o cmt/seqmread.o $(CFLAGS)
|
||||
|
||||
cmt/seqmwrite.o: cmt/seqmwrite.c
|
||||
cc -c cmt/seqmwrite.c -o cmt/seqmwrite.o $(CFLAGS)
|
||||
|
||||
cmt/seqread.o: cmt/seqread.c
|
||||
cc -c cmt/seqread.c -o cmt/seqread.o $(CFLAGS)
|
||||
|
||||
cmt/seqwrite.o: cmt/seqwrite.c
|
||||
cc -c cmt/seqwrite.c -o cmt/seqwrite.o $(CFLAGS)
|
||||
|
||||
cmt/tempomap.o: cmt/tempomap.c
|
||||
cc -c cmt/tempomap.c -o cmt/tempomap.o $(CFLAGS)
|
||||
|
||||
cmt/timebase.o: cmt/timebase.c
|
||||
cc -c cmt/timebase.c -o cmt/timebase.o $(CFLAGS)
|
||||
|
||||
cmt/userio.o: cmt/userio.c
|
||||
cc -c cmt/userio.c -o cmt/userio.o $(CFLAGS)
|
||||
|
||||
sys/unix/osstuff.o: sys/unix/osstuff.c
|
||||
cc -c sys/unix/osstuff.c -o sys/unix/osstuff.o $(CFLAGS)
|
||||
|
||||
misc/intgen: misc/intgen.c
|
||||
cd misc; make intgen
|
||||
|
||||
misc/unpacker: misc/unpacker.c misc/convert.c
|
||||
cd misc; make unpacker
|
||||
|
||||
misc/packer: misc/packer.c misc/convert.c
|
||||
cd misc; make packer
|
||||
|
||||
nyqsrc/sndfnintptrs.h: $(NYQHDRS) snd/snd.h misc/intgen
|
||||
$(INTGEN) nyqsrc/sndfnint $(NYQHDRS)
|
||||
|
||||
nyqsrc/seqfnintptrs.h: $(CMTHDRS) misc/intgen
|
||||
$(INTGEN) nyqsrc/seqfnint $(CMTHDRS)
|
||||
|
||||
clean:
|
||||
cd misc; make clean
|
||||
rm -f $(OBJECTS)
|
||||
# Note that these files are machine-generated:
|
||||
rm -f nyqsrc/sndfnintptrs.h nyqsrc/sndfnint.c nyqsrc/sndfnintdefs.h
|
||||
rm -f nyqsrc/seqfnintptrs.h nyqsrc/seqfnint.c nyqsrc/seqfnintdefs.h
|
||||
|
||||
cleaner: clean
|
||||
cd misc; make cleaner
|
||||
rm -f *.backup */*.backup
|
||||
rm -f *~ */*.*~
|
||||
rm -f *.save */*.save
|
||||
rm -f *.CKP */*.CKP
|
||||
rm -f *.BAK */*.BAK
|
||||
rm -f *.old */*.old
|
||||
rm -f *.gold */*.gold
|
||||
rm -f playparms
|
||||
rm -f points.dat
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue