mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-21 14:50:06 +02:00
------------------------------------------------------------------------ r288 | rbd | 2018-09-25 13:47:35 -0500 (Tue, 25 Sep 2018) | 2 lines removed some redundant files that moved to nyquist extensions ------------------------------------------------------------------------ r287 | rbd | 2018-09-25 13:02:34 -0500 (Tue, 25 Sep 2018) | 2 lines Cleaning up: many things in demos have moved to Nyquist extensions ------------------------------------------------------------------------ r286 | rbd | 2018-09-11 08:21:16 -0500 (Tue, 11 Sep 2018) | 2 lines Releasing 3.15 on Mac, finished extension manager update to allow a custom extension list file set in Preferences. Allow text copy of checksum when checksums do not match (so IDE can calculate the checksum for new extensions), describe this in manual. ------------------------------------------------------------------------ r285 | rbd | 2018-09-05 08:00:03 -0500 (Wed, 05 Sep 2018) | 2 lines Changes for 3.15 on Mac and hopefully good for Windows too. ------------------------------------------------------------------------ r284 | rbd | 2018-09-01 21:21:47 -0500 (Sat, 01 Sep 2018) | 2 lines Final change? for v3.14 on Mac ------------------------------------------------------------------------ r283 | rbd | 2018-09-01 21:14:11 -0500 (Sat, 01 Sep 2018) | 2 lines Took out unicode char from fm-voices-chowning, added README to extensions directory ------------------------------------------------------------------------ r282 | rbd | 2018-09-01 21:12:47 -0500 (Sat, 01 Sep 2018) | 1 line fixed some instrument defns for sound browser ------------------------------------------------------------------------ r281 | rbd | 2018-09-01 19:56:55 -0500 (Sat, 01 Sep 2018) | 1 line Small changes for release on Windows: v3.14 ------------------------------------------------------------------------ r280 | rbd | 2018-09-01 19:56:07 -0500 (Sat, 01 Sep 2018) | 2 lines path problems in some extensions and minor changes for mac release ------------------------------------------------------------------------ r279 | rbd | 2018-09-01 15:03:26 -0500 (Sat, 01 Sep 2018) | 2 lines change doc/README.txt to doc/readme-mac.txt in install dmg ------------------------------------------------------------------------ r278 | rbd | 2018-09-01 14:58:10 -0500 (Sat, 01 Sep 2018) | 2 lines minor fix for mac release ------------------------------------------------------------------------ r277 | rbd | 2018-09-01 14:40:10 -0500 (Sat, 01 Sep 2018) | 2 lines Retry release on Mac, minor changes. ------------------------------------------------------------------------ r276 | rbd | 2018-08-31 23:44:45 -0500 (Fri, 31 Aug 2018) | 3 lines Updated documentation; building 3.14 for mac release ------------------------------------------------------------------------ r275 | rbd | 2018-08-31 21:20:41 -0500 (Fri, 31 Aug 2018) | 1 line Fixed extension manager to update installed flags correctly (in Swing thread). Tested browser on Windows. ------------------------------------------------------------------------ r274 | rbd | 2018-08-31 14:35:22 -0500 (Fri, 31 Aug 2018) | 1 line Forgot to add new file. ------------------------------------------------------------------------ r273 | rbd | 2018-08-31 14:33:02 -0500 (Fri, 31 Aug 2018) | 1 line Changes for Windows including making paths look prettier using backslash or slash more consistently, adding some tests for empty lists, setting up nyquist directory using Registry's XLISPPATH. ------------------------------------------------------------------------ r272 | rbd | 2018-08-31 14:12:12 -0500 (Fri, 31 Aug 2018) | 2 lines Everything seems to be working on OS X. Latest fix was to Sound Browser. ------------------------------------------------------------------------ r271 | rbd | 2018-08-31 13:00:54 -0500 (Fri, 31 Aug 2018) | 2 lines Adapting to Java 10, fixing sound browser in the face of unloaded extensions. ------------------------------------------------------------------------ r270 | rbd | 2018-08-30 13:18:11 -0500 (Thu, 30 Aug 2018) | 2 lines Installer code sets registry to user-selected nyquist directory. ------------------------------------------------------------------------ r269 | rbd | 2018-08-30 12:53:21 -0500 (Thu, 30 Aug 2018) | 1 line Getting ready to releasea 3.14. These changes are from Windows. ------------------------------------------------------------------------ r268 | rbd | 2018-08-29 20:06:41 -0500 (Wed, 29 Aug 2018) | 2 lines Changes for simpler installation with nyquist (lib, doc, runtime, demos) in user read/write file space. ------------------------------------------------------------------------ r267 | rbd | 2018-08-26 20:45:14 -0500 (Sun, 26 Aug 2018) | 2 lines Added some documentation, worked on browser #anchor urls. ------------------------------------------------------------------------ r266 | rbd | 2018-08-22 18:27:01 -0500 (Wed, 22 Aug 2018) | 2 lines Fixed some extensions to deal with piano, which now autoloads. ------------------------------------------------------------------------ r265 | rbd | 2018-08-22 12:18:40 -0500 (Wed, 22 Aug 2018) | 2 lines added one more missing file for v3.13 ------------------------------------------------------------------------ r264 | rbd | 2018-08-22 10:54:15 -0500 (Wed, 22 Aug 2018) | 2 lines left out piano/autoload.lsp, needed for v3.13 ------------------------------------------------------------------------ r263 | rbd | 2018-08-22 10:09:16 -0500 (Wed, 22 Aug 2018) | 2 lines More cleanup for 3.13 release ------------------------------------------------------------------------ r262 | rbd | 2018-08-22 09:54:45 -0500 (Wed, 22 Aug 2018) | 2 lines More changes for 3.13 including status dialog while downloading extensions. ------------------------------------------------------------------------ r261 | rbd | 2018-08-19 21:34:23 -0500 (Sun, 19 Aug 2018) | 2 lines Updated documentation for v3.13 ------------------------------------------------------------------------ r260 | rbd | 2018-08-19 11:14:07 -0500 (Sun, 19 Aug 2018) | 2 lines Converted to using Extension Manager ------------------------------------------------------------------------ r259 | rbd | 2018-05-20 19:08:34 -0500 (Sun, 20 May 2018) | 2 lines Forgot to commit this new file ------------------------------------------------------------------------ r258 | rbd | 2018-03-10 12:11:22 -0600 (Sat, 10 Mar 2018) | 2 lines Substantial changes to pattern classes in xm.lsp to fix bug. The problems were obscure and unnoticed for a long time, but this new implementation is a major rewrite. I still need to test online course examples to make sure nothing is broken there. Otherwise, my assumption is there are few users and incompatibilities will not matter, so this is regarded as a minor bug fix. Also in this commit is some work on turning libraries and demos into Nyquist extensions supported by an extension manager within NyquistIDE. ------------------------------------------------------------------------ r257 | rbd | 2018-01-21 14:40:58 -0600 (Sun, 21 Jan 2018) | 2 lines Built nyquist and NyquistIDE on Ubuntu 14.04 LTS and using Oracle Java 9. Minor changes (former build specified Java version 1.7). ------------------------------------------------------------------------ r256 | rbd | 2017-09-24 14:05:06 -0500 (Sun, 24 Sep 2017) | 2 lines Fix type-checking bug in score-voice ------------------------------------------------------------------------ r255 | rbd | 2017-09-24 10:35:08 -0500 (Sun, 24 Sep 2017) | 2 lines Updated nyqrelide.iss for Roger's newer windows laptop ------------------------------------------------------------------------ r254 | rbd | 2017-09-24 10:27:05 -0500 (Sun, 24 Sep 2017) | 2 lines After testing on Windows 7, removed Test button from IDE, made fft_demo not depend so much on XLISPPATH to find pmorales/*.lsp ------------------------------------------------------------------------ r253 | rbd | 2017-09-23 18:44:41 -0500 (Sat, 23 Sep 2017) | 1 line Changes to compile on MSVS Community 2015 ------------------------------------------------------------------------ r252 | rbd | 2017-09-23 17:01:44 -0500 (Sat, 23 Sep 2017) | 2 lines A few adjustments made to allow examples.sal to run even if "demos" is not on the XLISPPATH ------------------------------------------------------------------------ r251 | rbd | 2017-09-23 16:14:27 -0500 (Sat, 23 Sep 2017) | 2 lines Minor changes to make this work on Ubuntu linux (or maybe any other linux) ------------------------------------------------------------------------ r250 | rbd | 2017-09-23 14:32:52 -0500 (Sat, 23 Sep 2017) | 2 lines Fixed version number in IDE About box ------------------------------------------------------------------------ r249 | rbd | 2017-09-23 14:17:16 -0500 (Sat, 23 Sep 2017) | 2 lines More fixes for 3.12. OS X version setting up symbolic links had bugs. ------------------------------------------------------------------------ r248 | rbd | 2017-09-23 00:31:29 -0500 (Sat, 23 Sep 2017) | 2 lines Processed documentation for v3.12 ------------------------------------------------------------------------ r247 | rbd | 2017-09-22 21:59:18 -0500 (Fri, 22 Sep 2017) | 2 lines Preparing v3.12. ------------------------------------------------------------------------ r246 | rbd | 2017-09-05 09:27:29 -0500 (Tue, 05 Sep 2017) | 1 line Fixes for Win10 and many changes to rounding throughout to avoid truncating to 32-bit ints when 64-bits might be available on some architectures. In particular, round() which returns double has been replaced by ROUND32, returning int, and ROUNDBIG returning intptr_t. ------------------------------------------------------------------------ r245 | rbd | 2017-08-24 11:15:22 -0500 (Thu, 24 Aug 2017) | 2 lines Fixed bug affecting Linux: seq-write-smf was trying to close file twice causing nyquist crash. Fixed by adding intermediate helper function in seqinterf.c so SEQ-WRITE-SMF does not directly call seq_write_smf. ------------------------------------------------------------------------ r244 | rbd | 2016-11-02 13:33:49 -0500 (Wed, 02 Nov 2016) | 2 lines Forgot to include this in the repo ------------------------------------------------------------------------ r243 | rbd | 2016-10-11 12:23:21 -0500 (Tue, 11 Oct 2016) | 1 line Prepare for v3.11b ------------------------------------------------------------------------ r242 | rbd | 2016-10-11 12:19:31 -0500 (Tue, 11 Oct 2016) | 2 lines Improved documentation and formatting. This is for version 3.11b (64-bit Windows only) ------------------------------------------------------------------------ r241 | rbd | 2016-10-11 10:59:51 -0500 (Tue, 11 Oct 2016) | 2 lines Fixed bug in fftlib.c which took the negative of an unsigned long. ------------------------------------------------------------------------ r240 | rbd | 2016-10-06 15:49:51 -0500 (Thu, 06 Oct 2016) | 2 lines Fixed spec-plot parameter checking, which was totally broken before. ------------------------------------------------------------------------ r239 | rbd | 2016-10-06 15:23:22 -0500 (Thu, 06 Oct 2016) | 2 lines Better conversion into Latex and pdf manual. Other minor fixes. ------------------------------------------------------------------------ r238 | rbd | 2016-08-25 13:01:45 -0500 (Thu, 25 Aug 2016) | 1 line Adding readme for top level download folder on SourceForge. ------------------------------------------------------------------------ r237 | rbd | 2016-08-25 09:07:08 -0500 (Thu, 25 Aug 2016) | 1 line Install is now for x64 architecture. Fixed cell_aut demo to run in IDE sound browser. Modified NyquistThread to create default XLISPPATH from Nyquist dir instead of cwd. ------------------------------------------------------------------------ r236 | rbd | 2016-08-24 21:25:56 -0500 (Wed, 24 Aug 2016) | 2 lines minor change during release from OS X ------------------------------------------------------------------------ r235 | rbd | 2016-08-24 21:16:55 -0500 (Wed, 24 Aug 2016) | 2 lines Making new release ------------------------------------------------------------------------ r234 | rbd | 2016-08-24 21:05:22 -0500 (Wed, 24 Aug 2016) | 2 lines Adding missing file to repo. ------------------------------------------------------------------------ r233 | rbd | 2016-08-24 09:23:39 -0500 (Wed, 24 Aug 2016) | 1 line Fixed undefined freeimage problem by moving freeimage out of the conditional compilation. freeimage is defined so that when Nyquist shuts down it can free most of the memory it allocated, minimizing (false positive) reports of memory leaks, which are harmless (except that they obscure true positive messages and seem surprising to non-xlisp experts). Undefined SAVERESTORE flag the way it used to be because save and restore functions (other than freeimage) do not work with the Nyquist SOUND type extension to XLISP. ------------------------------------------------------------------------ r232 | rbd | 2016-07-19 09:39:45 -0500 (Tue, 19 Jul 2016) | 2 lines I was going to keep "debug" versions separate because of the runtime overhead, but the code started to diverge and it's hard to maintain two versions, so we're going to make all the type checking standard. If you want an optimized version, you could strip out the calls to ny:typecheck using list processing and it would probably work. You could even write NY:OPTIMIZE that would poke into all the function definitions and destructively edit the code. ------------------------------------------------------------------------ r231 | rbd | 2016-07-19 09:34:16 -0500 (Tue, 19 Jul 2016) | 2 lines moved to test/ ------------------------------------------------------------------------ r230 | rbd | 2016-07-19 09:32:11 -0500 (Tue, 19 Jul 2016) | 2 lines Added extensive type checking to nyquist built-in (but not primitive) functions, and added unit tests for type checking, and incorporated unit tests into regression-test.lsp, a new "grand" test sequence. ------------------------------------------------------------------------ r229 | rbd | 2016-06-23 14:28:03 -0500 (Thu, 23 Jun 2016) | 2 lines New code to build NyquistIDE.app -- the old appbundler stuff is no longer needed ------------------------------------------------------------------------ r228 | rbd | 2016-06-23 06:44:49 -0500 (Thu, 23 Jun 2016) | 2 lines Appbundler is Oracle software used to build NyquistIDE - originally from java.net, but it seems to be not an active project (maybe that is good) so let's keep a copy just in case. ------------------------------------------------------------------------ r227 | rbd | 2016-06-22 16:02:26 -0500 (Wed, 22 Jun 2016) | 2 lines previous change to snd_list_unref was VERY wrong; here is the fix. ------------------------------------------------------------------------ r226 | rbd | 2016-06-22 13:46:44 -0500 (Wed, 22 Jun 2016) | 2 lines inserted some memory-freeing code from upstream (Audacity); made snd_list_unref non-recursive; CMakeLists.txt was not working on Mac 10.11.5 -- still can't build NyquistIDE, so more changes are on the way ------------------------------------------------------------------------ r225 | rbd | 2016-05-11 10:54:16 -0500 (Wed, 11 May 2016) | 2 lines Overhaul of new typechecking and parameter validation and error reporting code. Mostly untested, but tests to be done are in typechecks.sal ------------------------------------------------------------------------ r224 | rbd | 2016-05-06 07:56:11 -0500 (Fri, 06 May 2016) | 2 lines Improved plot in nyqide, progress on validating parameters for SAL, spec-plot defined, autoload spec-plot and piano synthesis functions ------------------------------------------------------------------------ r223 | rbd | 2016-05-03 13:07:14 -0500 (Tue, 03 May 2016) | 2 lines This contains work in progress on validating parameters in many nyquist functions, fixing liblo for win64, and some security (integer overflow) problems - probably does not compile ------------------------------------------------------------------------ r222 | rbd | 2016-03-16 10:34:15 -0500 (Wed, 16 Mar 2016) | 2 lines Updated documentation with minor additions and corrections. ------------------------------------------------------------------------ r221 | rbd | 2016-01-15 18:59:45 -0600 (Fri, 15 Jan 2016) | 2 lines Fixed file name for Browser ------------------------------------------------------------------------ r220 | rbd | 2016-01-15 18:49:15 -0600 (Fri, 15 Jan 2016) | 2 lines Changes to fix compilation on OS X ------------------------------------------------------------------------ r219 | rbd | 2016-01-15 18:31:23 -0600 (Fri, 15 Jan 2016) | 2 lines fixed build code for linux, made some c code more compatible ------------------------------------------------------------------------ r218 | rbd | 2016-01-14 17:08:39 -0600 (Thu, 14 Jan 2016) | 1 line modifications from Windows 7 port (static libraries) and browser files pointed to demos/src new location. ------------------------------------------------------------------------ r217 | rbd | 2016-01-14 13:04:24 -0600 (Thu, 14 Jan 2016) | 2 lines Now that cmake is in use, we do not need old Makefiles ------------------------------------------------------------------------ r216 | rbd | 2016-01-11 02:00:08 -0600 (Mon, 11 Jan 2016) | 1 line fixed to compile on XCode ------------------------------------------------------------------------ r215 | rbd | 2016-01-11 01:32:58 -0600 (Mon, 11 Jan 2016) | 1 line examples tried to play drums, but they may not be installed ------------------------------------------------------------------------ r214 | rbd | 2016-01-11 01:05:00 -0600 (Mon, 11 Jan 2016) | 1 line more win7 fixes ------------------------------------------------------------------------ r213 | rbd | 2016-01-11 00:42:57 -0600 (Mon, 11 Jan 2016) | 2 lines more file and path problems fixed ------------------------------------------------------------------------ r212 | rbd | 2016-01-11 00:19:55 -0600 (Mon, 11 Jan 2016) | 2 lines fixed lpc demo ------------------------------------------------------------------------ r211 | rbd | 2016-01-10 23:45:50 -0600 (Sun, 10 Jan 2016) | 1 line fix read-float, restore pianosyn.lsp ------------------------------------------------------------------------ r210 | rbd | 2016-01-10 23:36:35 -0600 (Sun, 10 Jan 2016) | 1 line fix references to demo-snd.aiff which is in demos/audio now ------------------------------------------------------------------------ r209 | rbd | 2016-01-10 22:32:08 -0600 (Sun, 10 Jan 2016) | 1 line getting 3.10 to run on windows, has temp debug info in pianosyn.lsp ------------------------------------------------------------------------ r208 | rbd | 2016-01-10 20:49:37 -0600 (Sun, 10 Jan 2016) | 2 lines Forgot to add new demo files ------------------------------------------------------------------------ r207 | rbd | 2016-01-10 20:31:40 -0600 (Sun, 10 Jan 2016) | 2 lines fixed downsample.c, other minor release problems ------------------------------------------------------------------------ r206 | rbd | 2016-01-10 14:01:58 -0600 (Sun, 10 Jan 2016) | 2 lines missing files (maybe only cmupvdbg.h is really needed) ------------------------------------------------------------------------ r205 | rbd | 2016-01-10 12:10:01 -0600 (Sun, 10 Jan 2016) | 2 lines No more scribe, so no more auto generation of text-only documentation. Hopefully HTML will suffice. PDF is now done by latex (but I forgot to move it into the doc directory before). ------------------------------------------------------------------------ r204 | rbd | 2016-01-10 12:01:55 -0600 (Sun, 10 Jan 2016) | 2 lines Nearing release of 3.10 -- major changes are phasevocoder, convolution, demo documentation ------------------------------------------------------------------------ r203 | rbd | 2016-01-10 11:38:35 -0600 (Sun, 10 Jan 2016) | 2 lines Made revisions for 3.10. Not quite done yet. ------------------------------------------------------------------------ r202 | rbd | 2015-12-28 22:33:51 -0600 (Mon, 28 Dec 2015) | 2 lines Updating demos to SAL syntax and better "front page". ------------------------------------------------------------------------ r201 | rbd | 2015-05-20 19:46:16 -0500 (Wed, 20 May 2015) | 2 lines Fixed more warnings about types. Still working on convolve though. ------------------------------------------------------------------------ r200 | rbd | 2015-05-20 06:16:32 -0500 (Wed, 20 May 2015) | 2 lines Forgot to move the final pdf of the manual to doc. ------------------------------------------------------------------------ r199 | rbd | 2015-05-20 06:14:25 -0500 (Wed, 20 May 2015) | 2 lines Fixed some documentation -- it might be complete now. Removed extra play command from organ.lsp. ------------------------------------------------------------------------ r198 | rbd | 2015-05-19 21:32:24 -0500 (Tue, 19 May 2015) | 2 lines Fixed some problems and warnings when compiling on Ubuntu Linux ------------------------------------------------------------------------ r197 | rbd | 2015-05-19 20:55:04 -0500 (Tue, 19 May 2015) | 2 lines Merged Win32 changes with OS X, removed some .sln and .vcproj files that are not needed now that we are using CMake ------------------------------------------------------------------------ r196 | rbd | 2015-05-19 20:27:30 -0500 (Tue, 19 May 2015) | 1 line Got nyquist and jnyqide to build on Windows under Visual Studio Express 2013. Many changes to remove some compiler warnings. ------------------------------------------------------------------------ r195 | rbd | 2015-05-14 21:52:33 -0500 (Thu, 14 May 2015) | 2 lines better device selection for ALSA and added cross-platform help to find and select devices; added icon to jny on Linux (should work on Windows) ------------------------------------------------------------------------ r194 | rbd | 2015-05-12 21:08:59 -0500 (Tue, 12 May 2015) | 2 lines still more missing files ------------------------------------------------------------------------ r193 | rbd | 2015-05-12 21:07:41 -0500 (Tue, 12 May 2015) | 2 lines more missing files ------------------------------------------------------------------------ r192 | rbd | 2015-05-12 21:04:50 -0500 (Tue, 12 May 2015) | 2 lines another missing file ------------------------------------------------------------------------ r191 | rbd | 2015-05-12 20:56:39 -0500 (Tue, 12 May 2015) | 2 lines repo missing a file ------------------------------------------------------------------------ r190 | rbd | 2015-05-12 20:28:25 -0500 (Tue, 12 May 2015) | 2 lines repo is missing a file ------------------------------------------------------------------------ r189 | rbd | 2015-05-12 20:16:10 -0500 (Tue, 12 May 2015) | 2 lines cleaned out files we don't use ------------------------------------------------------------------------ r188 | rbd | 2015-05-12 12:42:57 -0500 (Tue, 12 May 2015) | 2 lines Updated liblo to v0.28 and tested that it compiles with nyquist on XCode ------------------------------------------------------------------------ r187 | rbd | 2015-05-12 07:00:06 -0500 (Tue, 12 May 2015) | 2 lines FLAC changes were incomplete. This revision compiles. ------------------------------------------------------------------------ r186 | rbd | 2015-05-12 06:39:06 -0500 (Tue, 12 May 2015) | 2 lines Updated FLAC to 1.3.1, removed unnecessary files from local copy of sources. ------------------------------------------------------------------------ r185 | rbd | 2015-05-11 22:51:11 -0500 (Mon, 11 May 2015) | 2 lines I updated libvorbis from 1.3.5 and deleted unneeded files ------------------------------------------------------------------------ r184 | rbd | 2015-05-11 22:29:41 -0500 (Mon, 11 May 2015) | 2 lines I decided to just keep sources in libraries that are needed to build Nyquist, so I'm removing lots of build and configuration files. So far, portaudio is updated to V19 and libogg is updated to 1.3.2 ------------------------------------------------------------------------ r183 | rbd | 2015-05-11 15:00:14 -0500 (Mon, 11 May 2015) | 2 lines macosxproject/CMakeLists.txt is now in place to generate nyquist.xcodeproj. Since it is generated by CMake, I removed it from the repo. ------------------------------------------------------------------------ r182 | rbd | 2015-05-11 14:03:53 -0500 (Mon, 11 May 2015) | 2 lines Added sliders, documentation is now in latex, new Java build, CMake is used to create project in OS X, many other changes. This is NOT a release! Next step will be to get the CMake-built project into the right name and directory. ------------------------------------------------------------------------ r181 | rbd | 2015-03-19 19:40:00 -0500 (Thu, 19 Mar 2015) | 2 lines This is a failed attempt to use PanDoc to make a Nyquist manual, now that Scribe seems to have died. This is the point where I am changing the code to write directly to Latex. ------------------------------------------------------------------------ r180 | rbd | 2015-03-18 10:17:44 -0500 (Wed, 18 Mar 2015) | 2 lines Update version numbers to 3.10 ------------------------------------------------------------------------ r179 | rbd | 2015-03-17 20:17:35 -0500 (Tue, 17 Mar 2015) | 2 lines minor bug fixes ------------------------------------------------------------------------ r178 | rbd | 2015-03-17 20:05:13 -0500 (Tue, 17 Mar 2015) | 1 line Various changes from Windows version.res
1055 lines
40 KiB
Common Lisp
1055 lines
40 KiB
Common Lisp
;;************
|
||
;; writemake.lsp -- generate the sound create routine
|
||
;;************
|
||
;;************
|
||
;; Change Log
|
||
;; Date | Change
|
||
;;-----------+--------------------
|
||
;; 17-Dec-91 | [1.1] <jmn> Created
|
||
;; 17-Dec-91 | [1.1] <jmn> return sound_create(...) cast type to correct
|
||
;; | type
|
||
;; 21-Dec-91 | [1.2] <jmn> added start-time, default 0.0
|
||
;; 21-Dec-91 | [1.2] <jmn> prefix creation local variables with C_
|
||
;; 13-Jan-92 | [1.2] <jmn> reformatted and recommented
|
||
;; 3-May-99 | <rbd> modified toss_fetch code to retain proper t0
|
||
;;************
|
||
|
||
|
||
|
||
;; check-for-no-interpolation - if you see an "s", make sure there
|
||
;; is a corresponding "n", if not use "s" to cover the "n" case. And vice versa.
|
||
;;
|
||
(defun check-for-no-interpolation (encoding interpolation-rationale stream)
|
||
; *cfni-output* used to keep track of newline output
|
||
(setf *cfni-output* nil)
|
||
(check-for-no-interpolation-1 encoding 0 interpolation-rationale stream))
|
||
|
||
;; Hint: this algorithm constructs the 2^n variations by substituting
|
||
;; (or not) 'n' for 's' whereever s'es occur. The search is cut off
|
||
;; however, when an altered string is found in the encoding-list, which
|
||
;; tells what cases are handled directly.
|
||
;;
|
||
;; Wow, returning to the description above after several months, I couldn't make
|
||
;; heads or tails of it, and I wrote it! Here's another perhaps better, description:
|
||
;;
|
||
;; We generated various _fetch routines that differ in their assumptions about how to
|
||
;; access signal arguments. There are (now) 4 variations: NONE, SCALE, INTERP, and
|
||
;; RAMP. All 4^N combinations of these are generated initially, but many combinations
|
||
;; are deleted before any code is generated. Reasons for removing a combination include
|
||
;; the use of symetry, linearity, and simply the promise that input arguments will be
|
||
;; interpolated externally. In most of these cases, combinations are removed because
|
||
;; they cannot occur in practice. But in others, combinations are removed because they
|
||
;; should be handled by different code. For example, an input signal matching the output
|
||
;; sample rate and with a scale factor of 1 is normally handled by NONE style
|
||
;; "interpolation". Note: "interpolation" is used throughout this code, but a better term
|
||
;; would be "access method," because no interpolation is involved in the NONE and
|
||
;; SCALE variants. The inner loop access code for NONE style is something like "*s++".
|
||
;; However, an input signal suitable for NONE style interpolation can also be handled
|
||
;; by SCALE style interpolation (which looks something like "(*s++ * s_scale)", i.e.
|
||
;; an extra multiplication is required. If the attribute INTERNAL-SCALING is used,
|
||
;; then the scale factor does not actually appear at the access point because it has been
|
||
;; factored into a filter coefficient or some other factor, saving the multiply.
|
||
;; Alternatively, the ALWAYS-SCALE attribute can specify that there is little to be
|
||
;; gained by saving a multiply. In these cases, we want to handle NONE style signals
|
||
;; with SCALE style interpolation. Let's run through these possibilities again and
|
||
;; describe how they are handled:
|
||
;;
|
||
;; ALWAYS-SCALE: here we delete the NONE variant(s) and only generate fetch
|
||
;; routines that have scaling code in them. When we get an actual parameter with
|
||
;; a scale factor of 1 (implying NONE interpolation), we handle it with the SCALE
|
||
;; fetch routine.
|
||
;; INTERNAL-SCALING: here we generate NONE fetch routines because the
|
||
;; scale factor is taken care of elsewhere in the code, e.g. in a filter coefficient.
|
||
;; LINEAR: here, the scale factor of the actual argument becomes a scale factor
|
||
;; on the output (part of the data structure), deferring multiplies until later. We
|
||
;; then modify the argument scale factor to 1, and NONE style interpolation applies.
|
||
;; There is no need to generate SCALE style routines, because there will never be
|
||
;; any need for them.
|
||
;;
|
||
;; For a given signal parameter, these 3 cases are mutually exclusive.
|
||
;;
|
||
;; Looking at these three cases, we see that sometimes there will be SCALE style
|
||
;; routines handling NONE arguments, sometimes NONE style routines handling
|
||
;; SCALE arguments, and sometimes NONE style routines because there will
|
||
;; never be a need for SCALE.
|
||
;; This code is going to generate labels so that other fetch routines
|
||
;; handle the "missing" ones.
|
||
;; To do this, we generate extra labels in the case
|
||
;; statement that selects the fetch routine (interpolation is in the inner loop in the
|
||
;; fetch routine. For example, we might generate this code:
|
||
;; ...
|
||
;; case INTERP_nn:
|
||
;; case INTERP_sn:
|
||
;; case INTERP_ns:
|
||
;; case INTERP_ss: susp->susp.fetch = tonev_ss_fetch; break;
|
||
;; ...
|
||
;; Here, a single fetch routine (tonev_ss_fetch) handles all variations of NONE and
|
||
;; SCALE (n and s) types of the two signal arguments. The basic rule is: if you did not
|
||
;; generate a fetch routine for the NONE case, then handle it with the SCALE case, and
|
||
;; if you did not generate a fetch routine for the SCALE case, handle it with the NONE
|
||
;; case.
|
||
;;
|
||
;; The algorithm uses the list interpolation-rationale, which lists for each sound
|
||
;; parameter one of {NIL, LINEAR, ALWAYS-SCALE, INTERNAL-SCALING}.
|
||
;; Using this list, the code enumerates all the possible cases that might be handled
|
||
;; by the current fetch routine (represented by the "encoding" parameter).
|
||
;; This is a recursive algorithm because, if there are n SCALE type parameters, then
|
||
;; there are 2^N possible variations to enumerate. (E.g. look at the 4 variations in
|
||
;; the code example above.)
|
||
;;
|
||
;;
|
||
(defun check-for-no-interpolation-1 (encoding index
|
||
interpolation-rationale stream)
|
||
(cond ((= index (length encoding))
|
||
; (display "check-for-no-interpolation output" encoding)
|
||
; see if we need a newline (*cfni-output* is initially nil)
|
||
(if *cfni-output* (format stream "/* handled below */~%"))
|
||
(setf *cfni-output* t)
|
||
(format stream " case INTERP_~A: " encoding))
|
||
(t
|
||
(let ((ch (char encoding index)))
|
||
; (display "cfni" index ch)
|
||
(cond ((eql ch #\s)
|
||
(let ((new-encoding (strcat (subseq encoding 0 index)
|
||
"n"
|
||
(subseq encoding (1+ index)))))
|
||
(cond ((eq (nth index interpolation-rationale) 'ALWAYS-SCALE)
|
||
(check-for-no-interpolation-1 new-encoding (1+ index)
|
||
interpolation-rationale stream)))))
|
||
((eql ch #\n)
|
||
(let ((new-encoding (strcat (subseq encoding 0 index)
|
||
"s"
|
||
(subseq encoding (1+ index)))))
|
||
(cond ((eq (nth index interpolation-rationale) 'INTERNAL-SCALING)
|
||
(check-for-no-interpolation-1 new-encoding (1+ index)
|
||
interpolation-rationale stream))))))
|
||
(check-for-no-interpolation-1 encoding (1+ index)
|
||
interpolation-rationale stream)))))
|
||
|
||
;;************
|
||
;; is-argument -- see if string is in argument list
|
||
;;
|
||
;;************
|
||
|
||
(defun is-argument (arg arguments)
|
||
(dolist (a arguments)
|
||
(cond ((equal arg (cadr a)) (return t)))))
|
||
|
||
|
||
|
||
;; needs-mark-routine -- is there anything for GC to mark here?
|
||
;;
|
||
(defun needs-mark-routine (alg)
|
||
(or (get-slot alg 'sound-names)
|
||
(get-slot alg 'xlisp-pointers)))
|
||
|
||
|
||
;; lsc-needed-p -- see if we need the lsc variable declared
|
||
(defun lsc-needed-p (alg)
|
||
(let ((spec (get-slot alg 'logical-stop)))
|
||
(and spec (listp (car spec))
|
||
(eq (caar spec) 'MIN)
|
||
(cdar spec)
|
||
(cddar spec))))
|
||
|
||
|
||
;; write-initial-logical-stop-cnt -- writes part of snd_make_<name>
|
||
;;
|
||
(defun write-initial-logical-stop-cnt (alg stream)
|
||
(let ((spec (get-slot alg 'logical-stop))
|
||
min-list)
|
||
(cond ((and spec (listp (car spec))
|
||
(eq (caar spec) 'MIN)
|
||
(cdar spec))
|
||
(setf min-list (cdar spec))
|
||
; take stop_cnt from first argument in MIN list
|
||
(format stream
|
||
" susp->susp.log_stop_cnt = logical_stop_cnt_cvt(~A);\n"
|
||
(symbol-to-name (cadar spec)))
|
||
; modify stop_cnt to be minimum over all remaining arguments
|
||
(dolist (sym (cddar spec))
|
||
(let ((name (symbol-to-name sym)))
|
||
(format stream
|
||
" lsc = logical_stop_cnt_cvt(~A);\n" name)
|
||
(format stream
|
||
" if (susp->susp.log_stop_cnt > lsc)\n"
|
||
name)
|
||
(format stream
|
||
" susp->susp.log_stop_cnt = lsc;\n"
|
||
name))))
|
||
(t
|
||
(format stream
|
||
" susp->susp.log_stop_cnt = UNKNOWN;\n")))
|
||
))
|
||
|
||
|
||
;;************
|
||
;; write-mark
|
||
;;
|
||
;; Inputs:
|
||
;; alg - algorithm description
|
||
;; stream - stream on which to write .c file
|
||
;; Effect:
|
||
;; writes NAME_mark(...)
|
||
;;************
|
||
|
||
(defun write-mark (alg stream)
|
||
(let ((name (get-slot alg 'name))
|
||
(sound-names (get-slot alg 'sound-names))
|
||
(xlisp-pointers (get-slot alg 'xlisp-pointers)))
|
||
;----------------
|
||
; void NAME_mark(snd_susp_type a_susp)
|
||
; {
|
||
; NAME_susp_type susp = (NAME_susp_type) a_susp;
|
||
; *WATCH*: printf("NAME_mark(%x)\n", susp);
|
||
;----------------
|
||
(format stream "~%~%void ~A_mark(snd_susp_type a_susp)~%{~%" name)
|
||
(format stream " ~A_susp_type susp = (~A_susp_type) a_susp;~%"
|
||
name name)
|
||
(if *WATCH*
|
||
(format stream
|
||
" printf(\"~A_mark(%x)\\n\", susp);~%" name))
|
||
|
||
;----------------
|
||
; for each LVAL argument:
|
||
;
|
||
; if (susp->NAME) mark(susp->NAME);
|
||
;----------------
|
||
(dolist (name xlisp-pointers)
|
||
(format stream " if (susp->~A) mark(susp->~A);~%" name name))
|
||
|
||
;----------------
|
||
; for each sound argument:
|
||
;
|
||
; *WATCH*: printf("marking SND@%x in NAME@%x\n", susp->snd, susp);
|
||
; sound_xlmark(susp->NAME);
|
||
;----------------
|
||
(dolist (snd sound-names)
|
||
(if *watch*
|
||
(format stream
|
||
" printf(\"marking ~A@%x in ~A@%x\\n\", susp->~A, susp);~%"
|
||
snd name snd))
|
||
(format stream " sound_xlmark(susp->~A);~%" snd))
|
||
|
||
;----------------
|
||
; }
|
||
;----------------
|
||
(format stream "}~%")))
|
||
|
||
(print 'write-mark)
|
||
|
||
;; in-set-of-srate-determiners
|
||
;;
|
||
;; We want to make sure no input has a sample rate higher than the output
|
||
;; sample rate. A test is generated, but sometimes the test is not
|
||
;; necessary. In particular, if the output sample rate is the max of
|
||
;; some input sample rates, we don't have to test those input sample rates.
|
||
;; This function tells whether the output sample rate is known to be as
|
||
;; high as that of name. This is true when name is an element of a MAX
|
||
;; expression in the SAMPLE-RATE property.
|
||
;;
|
||
;; name is one of sound-names
|
||
(defun in-set-of-srate-determiners (name sr)
|
||
(display "in-set-of-srate-determiners" name sr)
|
||
(or (null sr) ; no SAMPLE-RATE spec, so take max of all sounds
|
||
(and (listp sr) (eq (car sr) 'MAX) ; explicit max expression
|
||
(member name (cdr sr) :test
|
||
#'(lambda (x y) (string-equal x (symbol-to-name y)))))))
|
||
|
||
|
||
;;************
|
||
;; out-of-line-interpolation -- determine if input sound should be
|
||
;; interpolated using snd_up() unit generator
|
||
;;
|
||
;; Interpolate out-of-line if inline-interpolation is false either
|
||
;; by default or by specification
|
||
;; If out-of-line-interpolation is true, then the signal should be
|
||
;; either scaled internally or always scaled. Otherwise, we'll generate
|
||
;; an extra implementation for scaling (S) vs non-scaling (N) which is
|
||
;; a real waste given that we're willing to run a separate unit generator
|
||
;; to do up-sampling. Therefore, this will raise an error.
|
||
;;************
|
||
|
||
(defun out-of-line-interpolation (alg name)
|
||
(let ((ili *INLINE-INTERPOLATION*)
|
||
(ili-spec (get alg 'inline-interpolation)))
|
||
(if ili-spec (setf ili t))
|
||
(if (eq ili-spec 'no) (setf ili nil))
|
||
;(display "out-of-line-interpolation" alg ili name
|
||
; (get alg 'ALWAYS-SCALE) (get alg 'INTERNAL-SCALING))
|
||
; (cond ((and (not ili) ;; make sure always scaled in some way
|
||
; (not (member name (get alg 'LINEAR) :test
|
||
; #'(lambda (x y) (string-equal x (symbol-to-name y)))))
|
||
; (not (member name (get alg 'ALWAYS-SCALE) :test
|
||
; #'(lambda (x y) (string-equal x (symbol-to-name y)))))
|
||
; (not (member name (get alg 'INTERNAL-SCALING) :test
|
||
; #'(lambda (x y) (string-equal x (symbol-to-name y))))))
|
||
; (error (format nil "~A is not always scaled" name))))
|
||
(not ili)))
|
||
|
||
;; a signal needs out-of-line scaling if out-of-line interpolation is
|
||
;; in effect and there is no built-in scaling (ALWAYS-SCALE or
|
||
;; INTERNAL-SCALING)
|
||
;;
|
||
(defun needs-out-of-line-scaling (alg name)
|
||
(let ((ili *INLINE-INTERPOLATION*)
|
||
(ili-spec (get alg 'inline-interpolation)))
|
||
(if ili-spec (setf ili t))
|
||
(if (eq ili-spec 'no) (setf ili nil))
|
||
(and (not ili)
|
||
(not (member name (get alg 'LINEAR) :test
|
||
#'(lambda (x y) (string-equal x (symbol-to-name y)))))
|
||
(not (member name (get alg 'ALWAYS-SCALE) :test
|
||
#'(lambda (x y) (string-equal x (symbol-to-name y)))))
|
||
(not (member name (get alg 'INTERNAL-SCALING) :test
|
||
#'(lambda (x y) (string-equal x (symbol-to-name y))))))))
|
||
|
||
|
||
;;************
|
||
;; write-make
|
||
;;
|
||
;; Inputs:
|
||
;; alg - algorithm description
|
||
;; stream - stream on which to write .c file
|
||
;; Effect:
|
||
;; writes NAME_free(...), NAME_print_tree, and snd_make_NAME(...)
|
||
;;************
|
||
|
||
(defun write-make (alg stream)
|
||
(let ((name (get-slot alg 'name))
|
||
(sr (get-slot alg 'sample-rate))
|
||
(else-prefix "")
|
||
first-time
|
||
(sound-names (get-slot alg 'sound-names))
|
||
(logical-stop (car (get-slot alg 'logical-stop)))
|
||
(sound-to-name (get-slot alg 'sound-to-name))
|
||
(state-list (get-slot alg 'state))
|
||
(linear (get-slot alg 'linear))
|
||
(arguments (get-slot alg 'arguments))
|
||
(finalization (get-slot alg 'finalization))
|
||
(interpolation-list (get-slot alg 'interpolation-list))
|
||
(interpolation-rationale (get-slot alg 'interpolation-rationale))
|
||
encoding-list
|
||
(terminate (car (get-slot alg 'terminate)))
|
||
(type-check (car (get-slot alg 'type-check)))
|
||
(delay (get-slot alg 'delay))
|
||
(start (get-slot alg 'start)))
|
||
|
||
;--------------------
|
||
; void NAME_free(snd_susp_type a_susp)
|
||
; {
|
||
; NAME_susp_type susp = (NAME_susp_type) a_susp;
|
||
;----------------
|
||
(format stream "~%~%void ~A_free(snd_susp_type a_susp)~%{~%"
|
||
name)
|
||
(format stream " ~A_susp_type susp = (~A_susp_type) a_susp;~%"
|
||
name name)
|
||
|
||
;----------------
|
||
; if there's a finalization, do it
|
||
;----------------
|
||
(if finalization (print-strings finalization stream))
|
||
|
||
;----------------
|
||
; for each sound argument:
|
||
;
|
||
; sound_unref(susp->NAME);
|
||
;----------------
|
||
(dolist (name sound-names)
|
||
(format stream " sound_unref(susp->~A);~%" name))
|
||
|
||
;----------------
|
||
; ffree_generic(susp, sizeof(NAME_susp_node), "fn-name");
|
||
; }
|
||
;--------------------
|
||
(format stream
|
||
" ffree_generic(susp, sizeof(~A_susp_node), \"~A_free\");~%}~%"
|
||
name name)
|
||
|
||
;--------------------
|
||
; void NAME_print_tree(snd_susp_type a_susp, int n)
|
||
; {
|
||
; NAME_susp_type susp = (NAME_susp_type) a_susp;
|
||
;----------------
|
||
(format stream "~%~%void ~A_print_tree(snd_susp_type a_susp, int n)~%{~%"
|
||
name name)
|
||
(cond (sound-names
|
||
(format stream " ~A_susp_type susp = (~A_susp_type) a_susp;~%"
|
||
name name)))
|
||
;----------------
|
||
; for each sound argument:
|
||
;
|
||
; indent(n);
|
||
; printf("NAME:");
|
||
; sound_print_tree_1(susp->NAME, n);
|
||
;----------------
|
||
(setf first-time t)
|
||
(dolist (name sound-names)
|
||
(cond (first-time
|
||
(setf first-time nil))
|
||
(t ; space between each iteration
|
||
(format stream "~%")))
|
||
(format stream " indent(n);~% stdputstr(\"~A:\");~%" name)
|
||
(format stream " sound_print_tree_1(susp->~A, n);~%" name))
|
||
|
||
;----------------
|
||
; }
|
||
;--------------------
|
||
(format stream "}~%")
|
||
|
||
;--------------------
|
||
; sound_type snd_make_NAME
|
||
;--------------------
|
||
|
||
(format stream "~%~%sound_type snd_make_~A" name)
|
||
|
||
;--------------------
|
||
; ( type name, ...)
|
||
;--------------------
|
||
|
||
(write-ansi-parameter-list stream "" arguments)
|
||
(format stream "~%")
|
||
(if (not *ANSI*)
|
||
(dolist (arg arguments)
|
||
(format stream " ~A ~A;~%" (car arg) (cadr arg))))
|
||
|
||
;--------------------
|
||
; NAME_susp_type susp;
|
||
;--------------------
|
||
(format stream
|
||
"{~% register ~A_susp_type susp;~%" name);
|
||
|
||
;; declare "state" variables with TEMP flag
|
||
;--------------------
|
||
; <type[i]> <name[i]>;
|
||
;--------------------
|
||
(dolist (state state-list)
|
||
(cond ((and (cdddr state)
|
||
(cadddr state)
|
||
(eq (cadddr state) 'TEMP))
|
||
(format stream " ~A ~A;~%"
|
||
(car state) (cadr state)))))
|
||
|
||
(write-sample-rate stream sr sound-names arguments)
|
||
|
||
; compute the t0 for new signal (default: use zero):
|
||
;
|
||
(write-start-time stream start arguments)
|
||
|
||
;--------------------
|
||
; int interp_desc = 0;
|
||
;--------------------
|
||
(cond ((< 1 (length interpolation-list))
|
||
(format stream " int interp_desc = 0;~%")))
|
||
|
||
;--------------------
|
||
; sample_type scale_factor = 1.0F;
|
||
; time_type t0_min; -- but only if there are sound args, implied by non-null sound-names
|
||
; long lsc;
|
||
;--------------------
|
||
(format stream " sample_type scale_factor = 1.0F;~%")
|
||
(if sound-names (format stream " time_type t0_min = t0;~%"))
|
||
(if (lsc-needed-p alg)
|
||
(format stream " long lsc;~%"))
|
||
|
||
; now do canonical ordering of commutable sounds
|
||
;
|
||
(dolist (lis (get-slot alg 'commutative))
|
||
;--------------------
|
||
; /* sort commuative signals: s1 s2 ... */
|
||
; snd_sort_<n>
|
||
; (...)
|
||
;--------------------
|
||
(format stream " /* sort commutative signals: ~A */~%" lis)
|
||
(format stream " snd_sort_~A" (length lis))
|
||
(write-parameter-list stream ""
|
||
(append (mapcar
|
||
'(lambda (snd)
|
||
(strcat "&" (cdr (assoc snd sound-to-name))))
|
||
lis)
|
||
'("sr")))
|
||
(format stream ";~%~%"))
|
||
|
||
; figure scale factor -- if signal is linear wrt some interpolated or
|
||
; ramped signal (which do the multiply anyway), then put the scale
|
||
; factor there.
|
||
;--------------------
|
||
; /* combine scale factors of linear inputs <linear> */
|
||
;--------------------
|
||
|
||
(cond (linear
|
||
(format stream
|
||
" /* combine scale factors of linear inputs ~A */~%" linear)))
|
||
;--------------------
|
||
; scale_factor *= NAME ->scale;
|
||
; NAME ->scale = 1.0F;
|
||
;--------------------
|
||
|
||
(dolist (snd linear)
|
||
(let ((name (cdr (assoc snd sound-to-name))))
|
||
(format stream " scale_factor *= ~A->scale;~%" name)
|
||
(format stream " ~A->scale = 1.0F;~%" name)))
|
||
|
||
;--------------------
|
||
; /* try to push scale_factor back to a low sr input */
|
||
;--------------------
|
||
|
||
(cond (linear
|
||
(format stream
|
||
"~% /* try to push scale_factor back to a low sr input */~%")))
|
||
|
||
;--------------------
|
||
; if (NAME ->sr < sr) {
|
||
; NAME ->scale = scale_factor; scale_factor = 1.0F; }
|
||
;--------------------
|
||
|
||
(dolist (snd linear)
|
||
(let ((name (cdr (assoc snd sound-to-name))))
|
||
(format stream
|
||
" ~Aif (~A->sr < sr) { ~A->scale = scale_factor; scale_factor = 1.0F; }~%"
|
||
else-prefix name name)
|
||
(setf else-prefix "else ")))
|
||
(if linear (format stream "~%"))
|
||
|
||
;-------------------
|
||
; insert TYPE-CHECK code here
|
||
;-------------------
|
||
; (display "write-make" type-check)
|
||
(if type-check
|
||
(format stream type-check))
|
||
|
||
;--------------------
|
||
; falloc_generic(susp, NAME_susp_node, "fn-name");
|
||
;--------------------
|
||
(format stream
|
||
" falloc_generic(susp, ~A_susp_node, \"snd_make_~A\");~%" name name)
|
||
|
||
;; initialize state: the state list has (type field initialization [temp])
|
||
;--------------------
|
||
; susp-> <state[i]> = <value[i]>
|
||
;--------------------
|
||
;; if TEMP is present, generate:
|
||
;--------------------
|
||
; <state[i]> = <value[i]>
|
||
;--------------------
|
||
|
||
(dolist (state state-list)
|
||
(let ((prefix "susp->"))
|
||
(cond ((and (cdddr state)
|
||
(cadddr state)
|
||
(eq (cadddr state) 'TEMP))
|
||
(setf prefix "")))
|
||
(format stream " ~A~A = ~A;~%"
|
||
prefix (cadr state) (caddr state))))
|
||
|
||
;---------------------
|
||
; /* make sure no sample rate is too high */
|
||
; if (***->sr > sr) {
|
||
; sound_unref(***);
|
||
; snd_badsr();
|
||
; } [maybe there will be an else part here]
|
||
;---------------------
|
||
; where *** is any sound input that is not in the max clause of
|
||
; the SAMPLE-RATE attribute
|
||
;
|
||
(setf first-time t)
|
||
(dolist (name sound-names)
|
||
(let (too-high-test ;; did we test for sr too high (follow with else)
|
||
(srate-determiner (in-set-of-srate-determiners name sr)))
|
||
(cond ((not srate-determiner)
|
||
(cond (first-time
|
||
(setf first-time nil)
|
||
(format stream
|
||
"~% /* make sure no sample rate is too high */~%")))
|
||
(format stream " if (~A->sr > sr) {~%" name)
|
||
(format stream " sound_unref(~A);~%" name)
|
||
(format stream " snd_badsr();~%" name)
|
||
(format stream " }")
|
||
(setf too-high-test t)
|
||
;---------------------
|
||
; Add this if signal needs out-of-line resampling
|
||
; else if (***->sr < sr) *** = snd_make_up(sr, ***);
|
||
;---------------------
|
||
(cond ((out-of-line-interpolation alg name)
|
||
(format stream (if too-high-test " else " " "))
|
||
(format stream "if (~A->sr < sr) " name)
|
||
(format stream "~A = snd_make_up(sr, ~A);" name name)))
|
||
(format stream "~%")))
|
||
;---------------------
|
||
; Add this if signal needs out-of-line rescaling
|
||
; if (***->scale != 1.0) *** = snd_make_normalize(***);
|
||
;---------------------
|
||
(cond ((needs-out-of-line-scaling alg name)
|
||
(format t "WARNING: out-of-line scaling possible for ~A\n" name)
|
||
(format stream " if (~A->scale != 1.0F) " name)
|
||
(format stream "~A = snd_make_normalize(~A);~%" name name)))))
|
||
|
||
; (display "write-make select implementation" interpolation-list)
|
||
; if we have a choice of implementations, select one
|
||
(cond ((< 1 (length interpolation-list))
|
||
|
||
;--------------------
|
||
; /* select a susp fn based on sample rates */
|
||
;--------------------
|
||
; build a descriptor
|
||
(format stream
|
||
"~% /* select a susp fn based on sample rates */~%")
|
||
|
||
;------------------------
|
||
; interp_desc = (interp_desc << 2) + interp_style( NAME, sr);
|
||
;------------------------
|
||
(dolist (snd sound-names)
|
||
(format stream
|
||
" interp_desc = (interp_desc << 2) + interp_style(~A, sr);~%"
|
||
snd))
|
||
|
||
;--------------------
|
||
; switch (interp_desc) {
|
||
;--------------------
|
||
(cond (interpolation-list
|
||
(format stream " switch (interp_desc) {~%")))
|
||
|
||
;--------------------------
|
||
; case INTERP_<encoding>: susp->susp.fetch =
|
||
; NAME_<encoding>_fetch; break;
|
||
;--------------------------
|
||
(setf encoding-list (mapcar #'encode interpolation-list))
|
||
(dolist (encoding encoding-list)
|
||
(check-for-no-interpolation encoding interpolation-rationale stream)
|
||
(format stream "susp->susp.fetch = ~A_~A_fetch; break;~%"
|
||
name encoding))
|
||
;--------------------------
|
||
; default: snd_badsr(); break;
|
||
;--------------------------
|
||
(format stream " default: snd_badsr(); break;~%")
|
||
;--------------------
|
||
; } /* initialize susp state */
|
||
;-------------------------
|
||
(format stream " }~%~%"))
|
||
(interpolation-list
|
||
(format stream " susp->susp.fetch = ~A_~A_fetch;~%"
|
||
name (encode (car interpolation-list))))
|
||
(t
|
||
;-------------------------
|
||
; susp->susp.fetch = NAME__fetch;
|
||
;-------------------------
|
||
(format stream " susp->susp.fetch = ~A__fetch;~%~%" name)))
|
||
|
||
;----------------
|
||
; /* compute terminate count */
|
||
;----------------
|
||
(cond ((terminate-check-needed terminate alg)
|
||
(cond ((eq (car terminate) 'AT)
|
||
(let ((time-expr (cadr terminate)))
|
||
;----------------
|
||
; susp->terminate_cnt = check_terminate_cnt(ROUNDBIG(((TIME-EXPR) - t0) * sr));
|
||
;----------------
|
||
(format stream
|
||
" susp->terminate_cnt = check_terminate_cnt(ROUNDBIG(((~A) - t0) * sr));~%"
|
||
time-expr)))
|
||
((eq (car terminate) 'AFTER)
|
||
(let ((dur-expr (cadr terminate)))
|
||
;----------------
|
||
; susp->terminate_cnt = check_terminate_cnt(ROUNDBIG((DUR-EXPR) * sr));
|
||
;----------------
|
||
(format stream
|
||
" susp->terminate_cnt = check_terminate_cnt(ROUNDBIG((~A) * sr));~%"
|
||
dur-expr)))
|
||
(t
|
||
;----------------
|
||
; susp->terminate_cnt = UNKNOWN;
|
||
;----------------
|
||
(format stream " susp->terminate_cnt = UNKNOWN;~%")))))
|
||
|
||
;----------------
|
||
; /* handle unequal start times, if any */
|
||
;----------------
|
||
(if sound-names
|
||
(format stream " /* handle unequal start times, if any */~%"))
|
||
;----------------
|
||
; for each sound argument:
|
||
; if (t0 < NAME->t0) sound_prepend_zeros(NAME, t0);
|
||
;----------------
|
||
(dolist (name sound-names)
|
||
(format stream
|
||
" if (t0 < ~A->t0) sound_prepend_zeros(~A, t0);~%" name name))
|
||
;----------------
|
||
; t0_min = min(NAME1->t0, min(NAME2->t0, ... NAMEn->t0, t0)...);
|
||
;----------------
|
||
(cond (sound-names
|
||
(format stream " /* minimum start time over all inputs: */~%")
|
||
(format stream " t0_min = ")
|
||
(dolist (name sound-names)
|
||
(format stream "min(~A->t0, " name))
|
||
(format stream "t0")
|
||
(dolist (name sound-names)
|
||
(format stream ")"))
|
||
(format stream ";~%")))
|
||
|
||
;----------------
|
||
; /* how many samples to toss before t0: */
|
||
; susp->susp.toss_cnt = (long) ((t0 - t0_min) * sr + <DELAY>.5);
|
||
; if (susp->susp.toss_cnt > 0) {
|
||
; susp->susp.keep_fetch = susp->susp.fetch;
|
||
; susp->susp.fetch = NAME_toss_fetch;
|
||
; t0 = t0_min; -- DELETED 3MAY99 by RBD
|
||
; }
|
||
;----------------
|
||
(cond (sound-names
|
||
(format stream " /* how many samples to toss before t0: */\n")
|
||
(if delay
|
||
(format stream " /* Toss an extra ~A samples to make up for internal buffering: */\n" delay))
|
||
(format stream " susp->susp.toss_cnt = (long) ((t0 - t0_min) * sr + ~A.5);\n"
|
||
(if delay delay 0))
|
||
(format stream " if (susp->susp.toss_cnt > 0) {\n")
|
||
(format stream " susp->susp.keep_fetch = susp->susp.fetch;\n")
|
||
(format stream " susp->susp.fetch = ~A_toss_fetch;~%" name)
|
||
; (format stream " t0 = t0_min;~% }\n\n")))
|
||
(format stream " }\n\n")))
|
||
|
||
;--------------------
|
||
; /* initialize susp state */
|
||
; susp->susp.free = NAME_free;
|
||
; susp->susp.sr = sr;
|
||
; susp->susp.t0 = t0;
|
||
;--------------------
|
||
(format stream " /* initialize susp state */~%")
|
||
(format stream " susp->susp.free = ~A_free;~%" name)
|
||
(format stream " susp->susp.sr = sr;~%")
|
||
(format stream " susp->susp.t0 = t0;~%")
|
||
|
||
;----------------
|
||
; if there are sound arguments:
|
||
; susp->susp.mark = NAME_mark;
|
||
; otherwise...
|
||
; susp->susp.mark = NULL;
|
||
;----------------
|
||
(let ((value "NULL"))
|
||
(cond ((needs-mark-routine alg)
|
||
(setf value (strcat name "_mark"))))
|
||
(format stream " susp->susp.mark = ~A;~%" value))
|
||
|
||
;----------------
|
||
; for debugging...
|
||
; susp->susp.print_tree = NAME_print_tree;
|
||
; susp->susp.name = "NAME";
|
||
;----------------
|
||
(format stream " susp->susp.print_tree = ~A_print_tree;~%" name)
|
||
(format stream " susp->susp.name = \"~A\";~%" name)
|
||
|
||
;----------------
|
||
; if there is a logical stop attribute:
|
||
; susp->logically_stopped = false;
|
||
; susp->susp.log_stop_cnt = UNKNOWN;
|
||
;----------------
|
||
(cond ((logical-stop-check-needed logical-stop)
|
||
(format stream
|
||
" susp->logically_stopped = false;\n")))
|
||
(write-initial-logical-stop-cnt alg stream)
|
||
|
||
;--------------------
|
||
; ramped or interpolated:
|
||
;
|
||
; susp->started = false;
|
||
;--------------------
|
||
(cond ((any-ramp-or-interp-in interpolation-list)
|
||
(format stream " susp->started = false;~%")))
|
||
|
||
;--------------------
|
||
; susp->susp.current = 0;
|
||
;--------------------
|
||
(format stream " susp->susp.current = 0;~%")
|
||
|
||
;----------------------------
|
||
; For each sound arg:
|
||
;
|
||
; susp-> <arg> = <arg>;
|
||
; susp-> <arg>_cnt = 0;
|
||
;----------------------------
|
||
|
||
(dotimes (n (length (get alg 'sound-args)))
|
||
(let ((interpolation (union-of-nth interpolation-list n)))
|
||
(setf arg (nth n sound-names)) ; get name of signal
|
||
(format stream " susp->~A = ~A;~%" arg arg)
|
||
(format stream " susp->~A_cnt = 0;~%" arg)
|
||
;-----------------------------------------------
|
||
; Interpolation:
|
||
;
|
||
; susp-> <arg>_pHaSe = 0.0;
|
||
; susp-> <arg>_pHaSe_iNcR = <arg> ->sr
|
||
;-----------------------------------------------
|
||
(cond ((member 'INTERP interpolation)
|
||
(format stream " susp->~A_pHaSe = 0.0;~%" arg)
|
||
(format stream " susp->~A_pHaSe_iNcR = ~A->sr / sr;~%"
|
||
arg arg)))
|
||
;-----------------------------------------------
|
||
; Ramp:
|
||
;
|
||
; susp->output_per_<arg> = <arg> ->sr;
|
||
;-----------------------------------------------
|
||
|
||
(cond ((member 'RAMP interpolation)
|
||
(format stream " susp->~A_n = 0;~%" arg)
|
||
(format stream " susp->output_per_~A = sr / ~A->sr;~%"
|
||
arg arg)))))
|
||
|
||
;----------------------------
|
||
; return sound_create (snd_susp_type)susp, t0, sr, scale_factor);
|
||
;----------------------------
|
||
|
||
(format stream
|
||
" return sound_create((snd_susp_type)susp, t0, sr, scale_factor);~%}~%")))
|
||
|
||
|
||
(print 'write-make)
|
||
|
||
;;************
|
||
;; write-parameter-list -- with comma separator, open and close parens
|
||
;;
|
||
;;************
|
||
|
||
(defun write-parameter-list (stream prefix strings)
|
||
(let ((comma ""))
|
||
(format stream "(")
|
||
(dolist (parm strings)
|
||
(format stream "~A~A~A" comma prefix parm)
|
||
(setf comma ", "))
|
||
(format stream ")")))
|
||
|
||
;;************
|
||
;; write-ansi-prototype-list -- with comma separator, open and close parens
|
||
;;
|
||
;; Inputs:
|
||
;; stream - output stream
|
||
;; prefix - arg prefix, perhaps ""
|
||
;; args - argument type/name pairs of the form
|
||
;; ( (type1 name1) (type2 name2) ... )
|
||
;; Effect:
|
||
;; if *ANSI* is set T, writes ANSI-style parameter list of the form
|
||
;; type name, ...
|
||
;; if *ANSI* is set NIL, writes antique-style parameter list of the form
|
||
;; ()
|
||
;;************
|
||
|
||
(defun write-ansi-prototype-list (stream prefix args)
|
||
(let ((comma ""))
|
||
(format stream "(")
|
||
(if *ANSI*
|
||
(dolist (parm args)
|
||
;--------------------
|
||
; for each parameter
|
||
; <comma>type <prefix><parm>
|
||
;--------------------
|
||
(format stream "~A~A ~A~A" comma (car parm) prefix (cadr parm))
|
||
(setf comma ", "))
|
||
)
|
||
(format stream ")")))
|
||
|
||
;;************
|
||
;; write-ansi-parameter-list
|
||
;;
|
||
;; Inputs:
|
||
;; stream - output stream
|
||
;; prefix - arg prefix, perhaps ""
|
||
;; args - argument type/name pairs of the form
|
||
;; ( (type1 name1) (type2 name2) ... )
|
||
;; Effect:
|
||
;; if *ANSI* is set T, writes ANSI-style parameter list of the form
|
||
;; (type name, ...)
|
||
;; if *ANSI* is set NIL, writes antique-style parameter list of the form
|
||
;; (name, ...)
|
||
;; Note:
|
||
;; to get a space between types and arguments, a space is prepended to prefix if
|
||
;; this is an *ANSI* arg list.
|
||
;;************
|
||
|
||
(defun write-ansi-parameter-list (stream prefix args)
|
||
(let ((comma ""))
|
||
(format stream "(")
|
||
(cond (*ANSI*
|
||
(setf prefix (strcat " " prefix))))
|
||
(dolist (parm args)
|
||
(format stream "~A~A~A~A" comma
|
||
(if *ANSI* (car parm) "")
|
||
prefix (cadr parm))
|
||
(setf comma ", ")
|
||
)
|
||
(format stream ")")))
|
||
|
||
;;************
|
||
;; write-sample-rate
|
||
;; Effect:
|
||
;; declare sr and compute the sample rate for the new signal
|
||
;; Notes:
|
||
;; If sr is an input parameter, it is not declared
|
||
;; If (SAMPLE-RATE expr) is specified, declare sr to be initialized
|
||
;; to the expr
|
||
;; If (SAMPLE-RATE (MAX s1 s2 ...)), sr is initialized to the max.
|
||
;; Otherwise, sr is initialized to the max of the sample rates of
|
||
;; all the sound-type arguments
|
||
;;************
|
||
|
||
(defun write-sample-rate (stream sr sound-names arguments)
|
||
;; if sr is "sr" and "sr" is a parameter, then do nothing:
|
||
|
||
; (display "write-sample-rate: " sr sound-names arguments)
|
||
|
||
(cond ( (and (equal sr "sr") (is-argument "sr" arguments))
|
||
;---------------------
|
||
; /* sr specified as input parameter */
|
||
;---------------------
|
||
(format stream " /* sr specified as input parameter */~%")
|
||
)
|
||
;; else if sample rate is specified, use it to initialize sr:
|
||
((stringp sr)
|
||
; (display "write-sample-rate: using specified sr" sr)
|
||
;---------------------
|
||
; rate_type sr = <sr>;
|
||
;---------------------
|
||
(format stream " rate_type sr = ~A;~%" sr)
|
||
)
|
||
;; else look for (MAX ...) expression
|
||
((and (listp sr) (eq (car sr) 'MAX))
|
||
(format stream " rate_type sr = ")
|
||
(write-redux-of-names stream "max"
|
||
(mapcar #'symbol-to-name (cdr sr)) "->sr")
|
||
(format stream ";~%")
|
||
)
|
||
;; else assume sr is max of sr's of all sound arguments
|
||
(sound-names
|
||
;---------------------
|
||
; rate_type sr = max( <arg[0]> ->sr, <arg[i]> ->sr);
|
||
;---------------------
|
||
(format stream " rate_type sr = ") ; jmn
|
||
(write-redux-of-names stream "max" sound-names "->sr")
|
||
(format stream ";~%")
|
||
)
|
||
(t
|
||
(error "Missing SAMPLE-RATE specification."))
|
||
)
|
||
)
|
||
|
||
|
||
(defun write-redux-of-names (stream fn sound-names suffix)
|
||
(dotimes (n (1- (length sound-names)))
|
||
(format stream "~A(" fn))
|
||
(format stream "~A~A" (car sound-names) suffix)
|
||
(dolist (snd (cdr sound-names))
|
||
(format stream ", ~A~A)" snd suffix)))
|
||
|
||
|
||
|
||
;;************
|
||
;; write-start-time
|
||
;; Effect:
|
||
;; declare sr and compute the start time for the new signal
|
||
;; Notes:
|
||
;; If t0 is an input parameter, it is not declared
|
||
;; If (START (AT expr)) is specified, declare t0 to be initialized
|
||
;; to the expr
|
||
;; Otherwise, t0 is initialized to 0
|
||
;;************
|
||
|
||
(defun write-start-time (stream start arguments)
|
||
;; if t0 is "t0" and "t0" is a parameter, then do nothing:
|
||
; (display "write-start time:" start arguments)
|
||
(cond ((is-argument "t0" arguments)
|
||
;---------------------
|
||
; /* t0 specified as input parameter */
|
||
;---------------------
|
||
(format stream " /* t0 specified as input parameter */~%"))
|
||
;; else if start time is specified, use it to initialize sr:
|
||
(t (cond (start
|
||
;---------------
|
||
; (START (AT <expr>)) specified:
|
||
;
|
||
; time_type t0 = <expr>;
|
||
;---------------
|
||
(setf start (car start))
|
||
(cond ((eq (car start) 'AT)
|
||
(format stream " time_type t0 = ~A;~%" (cadr start)))
|
||
((eq (car start) 'MIN)
|
||
(format stream " time_type t0 = ")
|
||
(write-redux-of-names stream "min"
|
||
(c-names (cdr start)) "->t0")
|
||
(format stream ";~%"))
|
||
((eq (car start) 'MAX)
|
||
(format stream " time_type t0 = ")
|
||
(write-redux-of-names stream "max"
|
||
(c-names (cdr start)) "->t0")
|
||
(format stream ";~%"))
|
||
(t (error (format nil
|
||
"Unrecognized START specification ~A" start)))))
|
||
;---------------
|
||
; time_type t0 = 0.0;
|
||
;---------------
|
||
(t (format stream " time_type t0 = 0.0;~%"))))))
|
||
|
||
|
||
;; c-names -- get the C names corresponding to list of symbols
|
||
;;
|
||
(defun c-names (syms) (mapcar '(lambda (sym) (string-downcase (symbol-name sym))) syms))
|
||
|
||
(defun is-table (alg snd)
|
||
(dolist (table (get-slot alg 'table))
|
||
(cond ((equal snd table)
|
||
; (display "is-table" snd table)
|
||
(return t)))))
|
||
|
||
|
||
;; write-xlmake -- write out a function snd_NAME to be called by xlisp
|
||
;
|
||
; this function copies any sound arguments and passes them on to snd_make_NAME
|
||
;
|
||
(defun write-xlmake (alg stream)
|
||
(let ((name (get-slot alg 'name))
|
||
(sound-names (get-slot alg 'sound-names))
|
||
(arguments (get-slot alg 'arguments))
|
||
comma)
|
||
;--------------------
|
||
; sound_type snd_NAME
|
||
;--------------------
|
||
|
||
(format stream "~%~%sound_type snd_~A" name)
|
||
|
||
;--------------------
|
||
; ( type name, ...)
|
||
; {
|
||
;--------------------
|
||
|
||
(write-ansi-parameter-list stream "" arguments)
|
||
(format stream "~%")
|
||
(if (not *ANSI*)
|
||
(dolist (arg arguments)
|
||
(format stream " ~A ~A;~%" (car arg) (cadr arg))))
|
||
(format stream "{~%")
|
||
|
||
;----------------
|
||
; for each sound argument that is not a table
|
||
; sound_type SND_copy = sound_copy(SND);
|
||
;----------------
|
||
|
||
(dolist (arg arguments)
|
||
(cond ((equal (car arg) "sound_type")
|
||
(let ((snd (cadr arg)))
|
||
(cond ((not (is-table alg snd))
|
||
(format stream
|
||
" sound_type ~A_copy = sound_copy(~A);~%"
|
||
snd snd)))))))
|
||
|
||
;----------------
|
||
; now call snd_make_ALG. When SND is a sound_type that is not a table,
|
||
; substitute SND_copy for SND.
|
||
;----------------
|
||
|
||
(format stream " return snd_make_~A(" name)
|
||
(setf comma "")
|
||
(dolist (arg arguments)
|
||
(let ((suffix ""))
|
||
(cond ((and (equal (car arg) "sound_type")
|
||
(not (is-table alg (cadr arg))))
|
||
(setf suffix "_copy")))
|
||
(format stream "~A~A~A" comma (cadr arg) suffix)
|
||
(setf comma ", ")))
|
||
(format stream ");~%}~%")))
|