mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-15 08:07:41 +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
654 lines
22 KiB
C
654 lines
22 KiB
C
/* sound.h -- new nyquist sound data type */
|
|
|
|
/* CHANGE LOG
|
|
* --------------------------------------------------------------------
|
|
* 28Apr03 dm changes for portability: moved some defns out of here
|
|
*/
|
|
|
|
#include <math.h>
|
|
#include "stdefs.h"
|
|
|
|
/* used for *AUDIO-MARKERS* */
|
|
extern long sound_frames;
|
|
extern double sound_srate;
|
|
|
|
extern long max_sample_blocks;
|
|
|
|
#if OSC
|
|
extern int nosc_enabled; /* enable polling for OSC messages */
|
|
#endif
|
|
|
|
#if USE_PRINTF
|
|
#define nyquist_printf printf
|
|
#endif
|
|
|
|
#define PERMS 0644 /* -rw-r--r-- */
|
|
|
|
/* default stop sample count (for clipping) */
|
|
#define MAX_STOP 0x7FFFFFFF
|
|
|
|
/* default stop time (for clipping) */
|
|
#define MAX_STOP_TIME 10E20
|
|
/* LISP-SRC: (SETF MAX-STOP-TIME 10E20) */
|
|
#define MIN_START_TIME -10E20
|
|
/* LISP-SRC: (SETF MIN-START-TIME -10E20) */
|
|
|
|
/* conversion from float to integer */
|
|
#define SCALE_FACTOR_TO_BYTE 127
|
|
#define SCALE_FACTOR_TO_SHORT 32767
|
|
#define SCALE_FACTOR_TO_24BIT 0x7FFFFF
|
|
#define SCALE_FACTOR_TO_LONG 2147483647
|
|
|
|
/* Note that the values assigned here are not arbitrary, but represent
|
|
a dominance relationship among the interpolation types.
|
|
*/
|
|
#define INTERP_n 0
|
|
#define INTERP_s 1
|
|
#define INTERP_i 2
|
|
#define INTERP_r 3
|
|
|
|
#define INTERP_nn 0
|
|
#define INTERP_ns 1
|
|
#define INTERP_ni 2
|
|
#define INTERP_nr 3
|
|
#define INTERP_sn 4
|
|
#define INTERP_ss 5
|
|
#define INTERP_si 6
|
|
#define INTERP_sr 7
|
|
#define INTERP_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
|
|
#define INTERP_nni 2
|
|
#define INTERP_nnr 3
|
|
#define INTERP_nsn 4
|
|
#define INTERP_nss 5
|
|
#define INTERP_nsi 6
|
|
#define INTERP_nsr 7
|
|
#define INTERP_nin 8
|
|
#define INTERP_nis 9
|
|
#define INTERP_nii 10
|
|
#define INTERP_nir 11
|
|
#define INTERP_nrn 12
|
|
#define INTERP_nrs 13
|
|
#define INTERP_nri 14
|
|
#define INTERP_nrr 15
|
|
#define INTERP_snn 16
|
|
#define INTERP_sns 17
|
|
#define INTERP_sni 18
|
|
#define INTERP_snr 19
|
|
#define INTERP_ssn 20
|
|
#define INTERP_sss 21
|
|
#define INTERP_ssi 22
|
|
#define INTERP_ssr 23
|
|
#define INTERP_sin 24
|
|
#define INTERP_sis 25
|
|
#define INTERP_sii 26
|
|
#define INTERP_sir 27
|
|
#define INTERP_srn 28
|
|
#define INTERP_srs 29
|
|
#define INTERP_sri 30
|
|
#define INTERP_srr 31
|
|
|
|
#define INTERP_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
|
|
#define INTERP_nnss 5
|
|
#define INTERP_nsnn 16
|
|
#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
|
|
#define INTERP_snss 69
|
|
#define INTERP_ssnn 80
|
|
#define INTERP_ssns 81
|
|
#define INTERP_sssn 84
|
|
#define INTERP_ssss 85
|
|
#define INTERP_niii 42
|
|
#define INTERP_siii 106
|
|
#define INTERP_srrr 127
|
|
#define INTERP_iiii 170
|
|
#define INTERP_rrrr 255
|
|
|
|
#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
|
|
|
|
|
|
#define INTERP_MASK 3
|
|
#define INTERP_SHIFT 2
|
|
|
|
LVAL snd_badsr(void);
|
|
long check_terminate_cnt(long tc);
|
|
|
|
typedef double time_type;
|
|
typedef double rate_type;
|
|
typedef float sample_type;
|
|
typedef double promoted_sample_type;
|
|
|
|
/* use radians or degrees for phase? */
|
|
#define ANGLEBASE 360.0
|
|
|
|
/* used by sndwrite.c for output buffers. This should be
|
|
* eliminated:
|
|
*/
|
|
#define MAX_SND_CHANNELS 24
|
|
|
|
#define max_table_len 100000000
|
|
/* Set to 4 for debugging block allocation stuff, 1012? for
|
|
production
|
|
*/
|
|
/* leave a few words short of 1024 in case we allocate powers of 2 */
|
|
#define max_sample_block_len 1020
|
|
/* #define max_sample_block_len 4 */
|
|
|
|
/* 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)))
|
|
|
|
typedef short SFDataType, *SFDataPtr;
|
|
|
|
typedef sample_type sample_block_values[max_sample_block_len],
|
|
*sample_block_values_type;
|
|
|
|
typedef struct {
|
|
long refcnt; /* reference count */
|
|
sample_block_values samples;
|
|
} sample_block_node, *sample_block_type;
|
|
|
|
|
|
/* forward declaration for circular type dependencies */
|
|
typedef struct snd_list_struct *snd_list_type;
|
|
|
|
typedef struct snd_susp_struct {
|
|
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;
|
|
|
|
|
|
typedef struct snd_list_struct {
|
|
sample_block_type block; /* pointer to block of samples */
|
|
union {
|
|
struct snd_list_struct *next;
|
|
snd_susp_type susp;
|
|
} u;
|
|
short refcnt;
|
|
short block_len;
|
|
boolean logically_stopped;
|
|
} snd_list_node; /* , *snd_list_type; -- defined above */
|
|
|
|
extern snd_list_type list_watch; //DBY
|
|
|
|
|
|
typedef struct table_struct {
|
|
long refcount; /* reference count */
|
|
double length; /* number of samples in table
|
|
(double allows fractional length)*/
|
|
sample_type samples[1]; /* arbitrary length array of sample */
|
|
} table_node, *table_type;
|
|
|
|
|
|
/* some counts are biased by -max_sample_block_len, so UNKNOWN can't be -1
|
|
* Any number less than -max_sample_block should do
|
|
*/
|
|
#define UNKNOWN (-10-max_sample_block_len)
|
|
|
|
typedef struct sound_struct {
|
|
sample_block_type (*get_next)(struct sound_struct *snd, long *cnt);
|
|
time_type time; /* logical starting time */
|
|
time_type t0; /* quantized time of first sample */
|
|
long stop; /* stop (clipping) sample no. */
|
|
time_type true_t0; /* exact time of first sample */
|
|
rate_type sr; /* sample rate */
|
|
long current; /* current sample number,
|
|
if negative, then the first
|
|
-current samples must be dropped
|
|
in order to find the first sample */
|
|
long logical_stop_cnt; /* log stop sample no, -1=unknwn */
|
|
snd_list_type list; /* sample block list, starting at curr. samp */
|
|
sample_type scale; /* scale factor for the result */
|
|
long prepend_cnt; /* how many zeros to prepend */
|
|
/* function to use as get_next after prepended zeros are generated: */
|
|
sample_block_type (*after_prepend)
|
|
(struct sound_struct * snd, long * cnt);
|
|
table_type table; /* pointer to table-ized version of this sound */
|
|
long *extra; /* used for extra state information, first word of extra
|
|
state should be the length of the extra state
|
|
(see sound_unref()) */
|
|
} sound_node, *sound_type;
|
|
|
|
/* convert number of samples to memory size: */
|
|
#define table_size_in_bytes(n) \
|
|
(sizeof(table_node) + sizeof(sample_type) * ((n) - 1))
|
|
|
|
extern sample_block_type zero_block;
|
|
extern sample_block_type internal_zero_block;
|
|
|
|
extern snd_list_type zero_snd_list;
|
|
|
|
extern sound_type printing_this_sound; /* debugging global */
|
|
|
|
long snd_set_max_audio_mem(long m);
|
|
/* LISP: (SND-SET-MAX-AUDIO-MEM FIXNUM) */
|
|
|
|
extern double sound_latency; /* controls output latency */
|
|
double snd_set_latency(double latency);
|
|
/* LISP: (SND-SET-LATENCY FLONUM) */
|
|
|
|
double compute_phase(double phase, double key, long n, double srate,
|
|
double new_srate, double freq, double *incr_ptr);
|
|
|
|
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(sound_type);
|
|
extern LVAL a_sound;
|
|
|
|
sample_block_type SND_get_next(sound_type snd, long * cnt);
|
|
sample_block_type SND_get_first(sound_type snd, long * cnt);
|
|
sample_block_type SND_get_zeros(sound_type snd, long * cnt);
|
|
sample_block_type SND_flush(sound_type snd, long * cnt);
|
|
|
|
double hz_to_step(double); /* LISP: (HZ-TO-STEP ANYNUM) */
|
|
int interp_style(sound_type s, rate_type sr);
|
|
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) */
|
|
snd_list_type snd_list_create(snd_susp_type susp);
|
|
void snd_list_terminate(snd_list_type snd_list);
|
|
void snd_sort_2(sound_type * s1_ptr, sound_type * s2_ptr, rate_type sr);
|
|
|
|
double snd_sref(sound_type s, time_type t);
|
|
/* LISP: (SND-SREF SOUND ANYNUM) */
|
|
|
|
double snd_sref_inverse(sound_type s, double val);
|
|
/* LISP: (SREF-INVERSE SOUND ANYNUM) */
|
|
|
|
double snd_stop_time(sound_type s); /* LISP: (SND-STOP-TIME SOUND) */
|
|
#define snd_time(s) (s)->time
|
|
/* LISP: double (SND-TIME SOUND) */
|
|
|
|
#define snd_srate(s) (s)->sr
|
|
/* LISP: double (SND-SRATE SOUND) */
|
|
#define snd_t0(s) (s)->t0
|
|
/* LISP: double (SND-T0 SOUND) */
|
|
|
|
sound_type snd_xform(sound_type snd, rate_type sr, time_type time,
|
|
time_type start_time, time_type stop_time, promoted_sample_type scale);
|
|
/* LISP: (SND-XFORM SOUND ANYNUM ANYNUM ANYNUM ANYNUM ANYNUM) */
|
|
sound_type sound_create(snd_susp_type susp, time_type t0, rate_type sr,
|
|
promoted_sample_type scale);
|
|
|
|
void min_cnt(long *cnt_ptr, sound_type sound, snd_susp_type susp, long cnt);
|
|
void indent(int n);
|
|
void sound_prepend_zeros(sound_type snd, time_type t0);
|
|
|
|
|
|
|
|
#ifndef GCBUG
|
|
#define blocks_to_watch_max 50
|
|
extern long blocks_to_watch_len;
|
|
extern sample_block_type blocks_to_watch[blocks_to_watch_max];
|
|
|
|
void block_watch(long sample_block);
|
|
/* LISP: (BLOCK-WATCH FIXNUM) */
|
|
long sound_nth_block(sound_type snd, long n);
|
|
/* LISP: (SOUND-NTH-BLOCK SOUND FIXNUM) */
|
|
#endif
|
|
|
|
sound_type sound_copy(sound_type snd);
|
|
/* LISP: (SND-COPY SOUND) */
|
|
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);
|
|
/* LISP: (STATS) */
|
|
void sound_print_tree(sound_type snd);
|
|
/* LISP: (SND-PRINT-TREE SOUND) */
|
|
|
|
void mark_audio_time(void);
|
|
|
|
void sound_print_tree_1(sound_type snd, int n);
|
|
|
|
sound_type sound_scale(double factor, sound_type snd);
|
|
/* LISP: (SND-SCALE ANYNUM SOUND) */
|
|
void sound_init(void);
|
|
|
|
void sound_symbols(void);
|
|
|
|
table_type sound_to_table(sound_type s);
|
|
|
|
void table_unref(table_type table);
|
|
|
|
sound_type sound_zero(time_type t0, rate_type sr);
|
|
/* LISP: (SND-ZERO ANYNUM ANYNUM) */
|
|
|
|
#define sound_get_next(s, n) ((*(s->get_next))(s, n))
|
|
|
|
#define susp_print_tree(s, n) (*((s)->print_tree))(s, n)
|
|
|
|
double step_to_hz(double);
|
|
/* LISP: (STEP-TO-HZ ANYNUM) */
|
|
|
|
/* macros for access to samples within a suspension */
|
|
/* NOTE: assume suspension structure is named "susp" */
|
|
|
|
/* susp_check_samples points sample_ptr to a new sample block if necessary */
|
|
#define susp_check_samples(sound, sample_ptr, sample_cnt) \
|
|
if (susp->sample_cnt == 0) \
|
|
susp_get_samples(sound, sample_ptr, sample_cnt)
|
|
|
|
/* susp_check_samples_break is similar to susp_check_samples - "_break"
|
|
* normally means that this code will break out of the inner loop, but in
|
|
* this case, there is no reason (neither log nor term) to break.
|
|
* x2_sample is taken from sound
|
|
*/
|
|
#define susp_check_samples_break(sound, sample_ptr, sample_cnt, x2_sample) \
|
|
if (susp->sample_cnt == 0) { \
|
|
susp_get_samples(sound, sample_ptr, sample_cnt); \
|
|
x2_sample = susp_current_sample(sound, sample_ptr); }
|
|
|
|
|
|
/* susp_get_samples always gets next block (useful only in initialization code) */
|
|
#define susp_get_samples(sound, sample_ptr, sample_cnt) \
|
|
susp->sample_ptr = sound_get_next(susp->sound, &(susp->sample_cnt))->samples
|
|
|
|
/* susp_get_block_samples always gets next block (useful only in initialization code) */
|
|
#define susp_get_block_samples(sound, sample_block_ptr, sample_ptr, sample_cnt) \
|
|
susp->sample_block_ptr = sound_get_next(susp->sound, &susp->sample_cnt); \
|
|
susp->sample_ptr = susp->sample_block_ptr->samples
|
|
|
|
/* susp_took is called after you've taken n samples */
|
|
#define susp_took(sample_cnt, n) susp->sample_cnt -= n
|
|
|
|
/* susp_fetch_sample is used to grab just one sample, doesn't check for samples!,
|
|
* but applies scale factor: */
|
|
#define susp_fetch_sample(sound, sample_ptr, sample_cnt) \
|
|
(susp->sound->scale * (susp->sample_cnt--, *(susp->sample_ptr++)))
|
|
|
|
/* susp_current_sample grabs sample without advancing to next, applies scale
|
|
* factor: */
|
|
#define susp_current_sample(sound, sample_ptr) \
|
|
(susp->sound->scale * (*(susp->sample_ptr)))
|
|
|
|
/* susp_check_term_samples checks for samples; if new ones are fetched, then
|
|
* run termination test on signal and record result.
|
|
*/
|
|
#define susp_check_term_samples(sound, sample_ptr, sample_cnt) \
|
|
if (susp->sample_cnt == 0) { \
|
|
susp_get_samples(sound, sample_ptr, sample_cnt); \
|
|
terminate_test(sample_ptr, sound, susp->sample_cnt); }
|
|
|
|
/* susp_check_term_log_samples checks for samples
|
|
* if new ones are fetched, then run termination test and logical stop
|
|
* test on signal and record results.
|
|
*/
|
|
#define susp_check_term_log_samples(sound, sample_ptr, sample_cnt) \
|
|
if (susp->sample_cnt == 0) { \
|
|
susp_get_samples(sound, sample_ptr, sample_cnt); \
|
|
logical_stop_test(sound, susp->sample_cnt); \
|
|
terminate_test(sample_ptr, sound, susp->sample_cnt); }
|
|
|
|
/* susp_check_term_log_block_samples checks for samples
|
|
* if new ones are fetched, then run termination test and logical stop
|
|
* test on signal and record results. In this case, termination and logical
|
|
* stop happen at the MAXIMUM of termination and logical stop times, resp.
|
|
*
|
|
* Originally, this code assumed that logical stops occurred on block boundaries,
|
|
* but because of the SET-LOGICAL-STOP function, which just writes a stop time
|
|
* into the sound_struct, the logical stop can be anywhere. As soon as the
|
|
* logical stop is known, we want to propagate the value from the sound being
|
|
* read into the sound being computed. The propagation should set the logical
|
|
* stop of the computed sound to the MAX of any current value and the new
|
|
* value. When the bit fields indicate that all logical stop times have been
|
|
* encountered, then the sound being computed will make the logical stop happen
|
|
* on a block boundary and set the flag on the block of samples where the stop
|
|
* occurs.
|
|
*/
|
|
#define susp_check_term_log_block_samples(sound, sample_block_ptr, sample_ptr, sample_cnt, bit, all) \
|
|
if (susp->sample_cnt == 0) { \
|
|
susp_get_block_samples(sound, sample_block_ptr, sample_ptr, sample_cnt); \
|
|
/*OLD if (susp->sound->logical_stop_cnt == \
|
|
susp->sound->current - susp->sample_cnt) { \
|
|
*/ \
|
|
if (susp->sound->logical_stop_cnt != UNKNOWN && \
|
|
!(susp->logical_stop_bits & bit)) { \
|
|
susp->logical_stop_bits |= bit; \
|
|
/*OLD \
|
|
if (susp->logical_stop_bits == all) { \
|
|
susp->susp.log_stop_cnt = (long) \
|
|
((((susp->sound->current - susp->sample_cnt) / \
|
|
susp->sound->sr + susp->sound->t0) - \
|
|
susp->susp.t0) * susp->susp.sr + 0.5); \
|
|
assert(susp->susp.log_stop_cnt >= 0); } } \
|
|
*/ \
|
|
susp->susp.log_stop_cnt = max(susp->susp.log_stop_cnt, \
|
|
(((susp->sound->logical_stop_cnt / \
|
|
susp->sound->sr + susp->sound->t0) - \
|
|
susp->susp.t0) * susp->susp.sr + 0.5)); } \
|
|
if (susp->sample_ptr == zero_block->samples) { \
|
|
susp->terminate_bits |= bit; \
|
|
if (susp->terminate_bits == all) { \
|
|
susp->terminate_cnt = (long) \
|
|
((((susp->sound->current - susp->sample_cnt) / \
|
|
susp->sound->sr + susp->sound->t0) - \
|
|
susp->susp.t0) * susp->susp.sr + 0.5); \
|
|
} } }
|
|
|
|
|
|
/* logical_stop_cnt_cvt is used to convert from the logical stop count
|
|
* at one sample rate to that of another sample rate -- this macro is
|
|
* used by the snd_make_<op> routine in every <op>.c file, and assumes
|
|
* the target sample rate is susp->susp.sr.
|
|
*
|
|
* NOTE: this macro does not take into account the possibility of different
|
|
* start times - maybe it should.
|
|
*/
|
|
#define logical_stop_cnt_cvt(sound) \
|
|
(sound->logical_stop_cnt == UNKNOWN ? UNKNOWN : \
|
|
ROUND32((sound->logical_stop_cnt / sound->sr) * susp->susp.sr))
|
|
|
|
|
|
/* logical_stop_test tests to see if sound has logically stopped; if so,
|
|
* sets susp->susp.log_stop_cnt. The resulting logical_stop_cnt will reflect
|
|
* the minimum logical_stop time of all sounds to which this test is applied.
|
|
*/
|
|
#define logical_stop_test(sound, cnt) \
|
|
if (susp->sound->logical_stop_cnt == susp->sound->current - (cnt)) {\
|
|
min_cnt(&susp->susp.log_stop_cnt, susp->sound, (snd_susp_type) susp, cnt); }
|
|
|
|
/* terminate_test checks to see if sound has terminated; if so,
|
|
* sets susp->terminate_cnt. The resulting terminate_cnt will reflect
|
|
* the minimum termination time of all sounds to which this test is applied.
|
|
*/
|
|
#define terminate_test(sample_ptr, sound, cnt) \
|
|
if (susp->sample_ptr == zero_block->samples) { \
|
|
min_cnt(&susp->terminate_cnt, susp->sound, (snd_susp_type) susp, cnt); }
|
|
|
|
|
|
/* susp_check_log_samples checks for new samples then checks for
|
|
* termination and logical stop conditions
|
|
*/
|
|
#define susp_check_log_samples(sound, sample_ptr, sample_cnt) \
|
|
if (susp->sample_cnt == 0) { \
|
|
susp_get_samples(sound, sample_ptr, sample_cnt); \
|
|
logical_stop_test(sound, susp->sample_cnt); }
|
|
|
|
/* susp_check_term_samples_break checks for new samples then checks for
|
|
* termination condition; breaks from inner loop
|
|
*/
|
|
#define susp_check_term_samples_break( \
|
|
sound, sample_ptr, sample_cnt, x2_sample) \
|
|
if (susp->sample_cnt == 0) { \
|
|
susp_get_samples(sound, sample_ptr, sample_cnt); \
|
|
x2_sample = susp_current_sample(sound, sample_ptr); \
|
|
terminate_test(sample_ptr, sound, susp->sample_cnt); \
|
|
if (susp->terminate_cnt < susp->susp.current + cnt + togo) { \
|
|
break; }} \
|
|
else x2_sample = susp_current_sample(sound, sample_ptr);
|
|
|
|
/* susp_check_log_samples_break checks for new samples then checks for
|
|
* logical stop conditions; breaks from inner loop
|
|
*/
|
|
#define susp_check_log_samples_break( \
|
|
sound, sample_ptr, sample_cnt, x2_sample) \
|
|
if (susp->sample_cnt == 0) { \
|
|
susp_get_samples(sound, sample_ptr, sample_cnt); \
|
|
x2_sample = susp_current_sample(sound, sample_ptr); \
|
|
logical_stop_test(sound, susp->sample_cnt); \
|
|
if (!susp->logically_stopped && susp->susp.log_stop_cnt != UNKNOWN && \
|
|
(susp->susp.log_stop_cnt < susp->susp.current + cnt + togo)) { \
|
|
break; }} \
|
|
else x2_sample = susp_current_sample(sound, sample_ptr);
|
|
|
|
|
|
/* susp_check_term_log_samples_break checks for new samples then checks for
|
|
* termination and logical stop conditions; breaks from inner loop
|
|
*/
|
|
#define susp_check_term_log_samples_break( \
|
|
sound, sample_ptr, sample_cnt, x2_sample) \
|
|
if (susp->sample_cnt == 0) { \
|
|
susp_get_samples(sound, sample_ptr, sample_cnt); \
|
|
x2_sample = susp_current_sample(sound, sample_ptr); \
|
|
terminate_test(sample_ptr, sound, susp->sample_cnt); \
|
|
logical_stop_test(sound, susp->sample_cnt); \
|
|
if ((susp->terminate_cnt != UNKNOWN && \
|
|
susp->terminate_cnt < susp->susp.current + cnt + togo) || \
|
|
(!susp->logically_stopped && susp->susp.log_stop_cnt != UNKNOWN && \
|
|
susp->susp.log_stop_cnt < susp->susp.current + cnt + togo)) { \
|
|
break; }} \
|
|
else x2_sample = susp_current_sample(sound, sample_ptr);
|
|
|
|
|