ref: 1d09da3a87e43eee7a345f970378c37312a71895
parent: ca201805c6603ddcb2617976a40566f4b58703cb
author: cbagwell <cbagwell>
date: Thu Nov 11 22:04:35 EST 1999
A few dos updates and some cleanups.
--- a/INSTALL
+++ b/INSTALL
@@ -31,14 +31,9 @@
several canned "Makefile"'s that you can use. The following systems
have a canned Makefile:
- AMIGA Makefile.ami (hasn't been verified lately)
- DOS Makefile.dos (Borland and Turbo C)
- or Makefile.unx (using GCC compatible compiler)
- OS/2 Makefile.unx (using EMX GCC compiler)
- OS9 Makefile.os9
- UNIX Makefile.unx (or most platforms using GCC compatible compiler)
- WIN95/NT Makefile.unx (using Cynus GCC for Win32)
- or Makefile.dos (with a little modifying for Visual C++)
+ DOS Makefile.dos (Borland or Turbo C)
+ WIN95/NT Makefile.dos (Needs modifying for Visual C++)
+ OS/2 Makefile.gcc (using EMX GCC compiler)
You can run the makefile on most systems by using the following
command line:
--- a/Makefile.ami
+++ /dev/null
@@ -1,140 +1,0 @@
-##
-## Sound Tools Makefile for AMIGA with SAS/C 6.1
-## builds libst.lib and sox
-##
-## This must be redone to compile with DICE, GCC, etc.
-##
-## Choose the version you wish to compile with:
-## <make-tool> -f Makefile.ami (for basic version)
-## <make-tool> -f Makefile.ami CPU=030 (for 68030 version)
-## <make-tool> -f Makefile.ami FPU=881 (for 68881 FPU version)
-## <make-tool> -f Makefile.ami CPU=030 FPU=881 (for 030/881 version)
-##
-## Note: This makefile does not work with SAS's 'smake' utility, because
-## 'smake' is weak. Get yourself a real 'make' tool, such as the port of
-## 'dmake'. If you can't find one, use the commented-out section below to
-## rewrite this makefile for 'smake'.
-##
-
-FSRC = 8svx.c aiff.c alsa.c au.c auto.c avr.c cdr.c cvsd.c dat.c \
- g721.c g723_24.c g723_40.c g72x.c gsm.c hcom.c maud.c oss.c raw.c \
- sf.c smp.c sndrtool.c sunaudio.c tx16w.c voc.c wav.c wve.c
-
-ESRC = avg.c band.c chorus.c compandc copy.c cut.c deemphas.c dyn.c echo.c \
- echos.c filter.c flanger.c highp.c lowp.c map.c mask.c phaser.c \
- pick.c polyphas.c rate.c resample.c reverb.c reverse.c split.c \
- stat.c swap.c vibro.c
-
-PSRC= sox.c
-
-SOURCES = $(PSRC) $(FSRC) $(ESRC) handlers.c libst.c misc.c getopt.c util.c
-
-HEADERS = st.h libst.h sfheader.h version.h patchlvl.h
-
-TESTS = tests.sh testall.sh monkey.au monkey.voc
-
-MISC = README INSTALL TODO TIPS CHEAT CHEAT.eft Changelog sox.1 sox.txt \
- libst.3 libst.txt play.1 Makefile.unx Makefile.dos Makefile.b30 \
- Makefile.c70 soxeffect play rec
-
-SKEL = skel.c skeleff.c
-
-AMIGA = Makefile.ami amiga.h
-
-DOS = tests.bat testall.bat
-
-FILES = $(MISC) $(HEADERS) $(SOURCES) $(AMIGA) $(DOS) \
- $(SKEL) $(TESTS)
-
-FOBJ = 8svx.o aiff.o alsa.o au.o auto.o avr.o cdr.o cvsd.o dat.o \
- g721.o g723_24.o g723_40.o g72x.o gsm.o hcom.o maud.o oss.o raw.o \
- sf.o smp.o sndrtool.o sunaudio.o tx16w.o voc.o wav.o wve.o
-
-EOBJ = avg.o band.o chorus.o compand.o copy.o cut.o deemphas.o dyn.o echo.o \
- echos.o filter.o flanger.o highp.o lowp.o map.o mask.o phaser.o \
- pick.o polyphas.o rate.o resample.o reverb.o reverse.o split.o \
- stat.o swap.o vibro.o
-
-##SOUNDLIB is defined below
-LIBOBJS = $(FOBJ) $(EOBJ) handlers.o libst.o misc.o getopt.o util.o
-
-##
-## System dependency parameters
-##
-##
-## Amiga vars for SAS 6.1.
-## Lots of funky stuff here. Unnecessary, but keeps it neat.
-## Also matches unix makefile more closely.
-##
-CC = sc DEF=__STDC__ DEF=AMIGA
-##IGNore some warnings due to lack of prototyping in SOX code
-O = IGN=85 IGN=93 IGN=100 IGN=154 IGN=161 OPTIMIZE OPTIMIZERINLINELOCAL OPTIMIZERTIME OPTIMIZERALIAS
-AR = oml
-AR_ARGS = a
-RM = delete
-MATH =
-MATH881 = MATH=68881
-CPUF =
-CPUF030 = CPU=68030
-MATHLIB = lib:scm.lib
-MATHLIB881 = lib:scm881.lib
-DEFS =
-DEFS881 = DEF=AMIGA_MC68881
-DEFS030 = DEF=AMIGA_MC68030
-##
-SOX = sox$(CPU)$(FPU)
-SOUNDLIB= libst$(CPU)$(FPU).lib
-CFLAGS += $(O) DEF=AMIGA $(DEFS$(FPU)) $(DEFS$(CPU)) $(MATH$(FPU)) $(CPUF$(CPU))
-LIBS = $(MATHLIB$(FPU)) lib:sc.lib lib:amiga.lib
-##
-
-###################################################
-##This is unnecessary if you have a serious 'make'.
-##If you don't, use it as a guide to building your
-##own makefile.
-###################################################
-##
-## 68000, no FPU
-#SOX = sox
-#SOUNDLIB= libst.lib
-#MATHLIB = lib:scm.lib
-#CFLAGS += $(O) DEF=AMIGA
-##
-## 68000, 68881 FPU
-#SOX = sox881
-#SOUNDLIB= libst881.lib
-#MATHLIB = lib:scm881.lib lib:scm.lib
-#CFLAGS += $(O) MATH=68881 DEF=AMIGA DEF=AMIGA_MC68881
-##
-## 68030, no FPU
-#SOX = sox030
-#SOUNDLIB= libst030.lib
-#MATHLIB = lib:scm.lib
-#CFLAGS += $(O) CPU=68030 DEF=AMIGA
-##
-## 68030, 68881 FPU
-#SOX = sox030881
-#SOUNDLIB= libst030881.lib
-#MATHLIB = lib:scm881.lib lib:scm.lib
-#CFLAGS += $(O) MATH=68881 CPU=68030 DEF=AMIGA DEF=AMIGA_MC68881
-
-##
-## start your engines
-##
-all: $(SOX)
-
-$(SOX): sox.o $(SOUNDLIB)
- slink lib:c.o sox.o to $(SOX) lib $(SOUNDLIB) $(LIBS) SMALLCODE SMALLDATA STRIPDEBUG NOICONS
-
-$(SOUNDLIB): $(LIBOBJS)
- $(AR) $(SOUNDLIB) $(AR_ARGS) $(LIBOBJS)
-
-sox.o: sox.c st.h
-
-sox.txt: sox.man
- $(RM) sox.txt
- nroff -man sox.man > sox.txt
- nroff -man st.man > st.txt
-
-clean:
- $(RM) #?.o
--- a/amiga.h
+++ /dev/null
@@ -1,61 +1,0 @@
-#ifdef AMIGA
-
-#include <fcntl.h>
-
-#ifdef AMIGA_MC68881
-#include <m68881.h>
-#endif /* AMIGA_MC68881 */
-
-#include "patchlvl.h" /* yeah, I know it's not really a header...but why not? */
-
-/* Following is a really screwy way of incorporating compile-time info into *
- * the binary as an Amiga version string. Unfortunately, it was the only *
- * method I could find. --dgc, 13 Jan 93 */
-
-#define AmiVerChars1 {'$', 'V', 'E', 'R', ':', ' ', 'S', 'o', 'u', 'n', 'd', ' ', 'E', 'x', 'c', 'h', 'a', 'n', 'g', 'e', ' ',
-#define AmiVerChars2 '6', '8', '0', '3', '0',
-#define AmiVerChars3 '/',
-#define AmiVerChars4 '6', '8', '8', '8', '1',
-#define AmiVerChars5 ' ', 'P', 'a', 't', 'c', 'h', 'l', 'e', 'v', 'e', 'l',
- ' ', '0'+(PATCHLEVEL/10), '0'+(PATCHLEVEL%10), '\0'}
-
-#ifdef AMIGA_MC68881
-#ifdef AMIGA_MC68030
-#define AmiVerChars AmiVerChars1 AmiVerChars2 AmiVerChars3 AmiVerChars4 AmiVerChars5
-#else
-#define AmiVerChars AmiVerChars1 AmiVerChars4 AmiVerChars5
-#endif /* AMIGA_MC68030 */
-#else
-#ifdef AMIGA_MC68030
-#define AmiVerChars AmiVerChars1 AmiVerChars2 AmiVerChars5
-#else
-#define AmiVerChars AmiVerChars1 AmiVerChars5
-#endif /* AMIGA_MC68030 */
-#endif /*AMIGA_MC68881*/
-
-/* if you change these strings, be sure to change the size here! */
-/* (and remember, sizeof() won't work) */
-#define AmiVerSize 46
-
-/* stdarg adjustments */
-#ifndef va_dcl
-#define va_dcl int va_alist;
-#endif /* !va_dcl*/
-
-/* BSD compat */
-#include <string.h>
-/* SAS/C does these; other might not */
-#ifndef bcopy
-#define bcopy(from, to, len) memmove(to, from, len)
-#endif
-
-/* SAS/C library code includes unlink(). *
- * If your compiler doesn't have unlink(), *
- * uncomment this section. */
-/*
-#ifndef unlink
-#define unlink DeleteFile
-#endif
-*/
-
-#endif /*AMIGA*/
--- a/src/compand.c
+++ b/src/compand.c
@@ -187,7 +187,7 @@
* value, the attack rate and decay rate
*/
-static inline void doVolume(double *v, double samp, compand_t l, int chan)
+static void doVolume(double *v, double samp, compand_t l, int chan)
{
double s = samp/(~((LONG)1<<31));
double delta = s - *v;
--- a/src/polyphas.c
+++ b/src/polyphas.c
@@ -265,6 +265,7 @@
memcpy(b2,m2,u*sizeof(int));
}
fail:
+ ;;
}
if (u_min) break;
}
@@ -502,7 +503,7 @@
}
}
-static inline void update_hist(Float *hist, int hist_size, int in_size)
+static void update_hist(Float *hist, int hist_size, int in_size)
{
Float *p, *p1, *q;
p = hist;
--- a/src/resample.c
+++ b/src/resample.c
@@ -226,7 +226,7 @@
LONG i, last, Nout, Nx, Nproc;
/* constrain amount we actually process */
- //fprintf(stderr,"Xp %d, Xread %d, isamp %d, ",r->Xp, r->Xread,*isamp);
+ /*fprintf(stderr,"Xp %d, Xread %d, isamp %d, ",r->Xp, r->Xread,*isamp); */
Nproc = r->Xsize - r->Xp;
@@ -239,7 +239,7 @@
fail("Nx not positive: %d", Nx);
if (Nx > *isamp)
Nx = *isamp;
- //fprintf(stderr,"Nx %d\n",Nx);
+ /*fprintf(stderr,"Nx %d\n",Nx);*/
if (ibuf == NULL) {
for(i = r->Xread; i < Nx + r->Xread ; i++)
@@ -259,7 +259,7 @@
return;
}
Nout = SrcUD(r, Nproc);
- //fprintf(stderr,"Nproc %d --> %d\n",Nproc,Nout);
+ /*fprintf(stderr,"Nproc %d --> %d\n",Nproc,Nout);*/
/* Move converter Nproc samples back in time */
r->Time -= Nproc;
/* Advance by number of samples processed */
@@ -279,7 +279,7 @@
LONG i,k;
/* Copy back portion of input signal that must be re-used */
k = r->Xp - r->Xoff;
- //fprintf(stderr,"k %d, last %d\n",k,last);
+ /*fprintf(stderr,"k %d, last %d\n",k,last);*/
for (i=0; i<last - k; i++)
r->X[i] = r->X[i+k];
@@ -307,7 +307,7 @@
resample_t r = (resample_t) effp->priv;
LONG i, Nout, Nx;
- //fprintf(stderr,"Xp %d, Xread %d <--- DRAIN\n",r->Xp, r->Xread);
+ /*fprintf(stderr,"Xp %d, Xread %d <--- DRAIN\n",r->Xp, r->Xread);*/
if (r->Xsize - r->Xread < r->Xoff)
fail("resample_drain: Problem!\n");
@@ -322,7 +322,7 @@
/* Resample stuff in input buffer */
Nout = SrcUD(r, Nx);
- //fprintf(stderr,"Nproc %d --> %d\n",Nx,Nout);
+ /*fprintf(stderr,"Nproc %d --> %d\n",Nx,Nout);*/
for(i = 0; i < Nout; i++)
*obuf++ = r->Y[i] * ISCALE;
--- a/src/sox.c
+++ b/src/sox.c
@@ -67,11 +67,6 @@
* Rewrite for multiple effects: Aug 24, 1994.
*/
-#ifdef AMIGA
-/* This is the Amiga version string */
-char amiversion[AmiVerSize]=AmiVerChars;
-#endif /* AMIGA */
-
int clipped = 0; /* Volume change clipping errors */
static LONG ibufl[BUFSIZ/2]; /* Left/right interleave buffers */
--- a/src/st.h
+++ b/src/st.h
@@ -1,15 +1,19 @@
#ifndef ST_H
#define ST_H
-
/*
- * July 5, 1991
- * Copyright 1991 Lance Norskog And Sundry Contributors
+ * Sound Tools Library - October 11, 1999
+ *
+ * Copyright 1999 Chris Bagwell
+ *
* This source code is freely redistributable and may be used for
* any purpose. This copyright notice must be maintained.
- * Lance Norskog And Sundry Contributors are not responsible for
+ * Chris Bagwell And Sundry Contributors are not responsible for
* the consequences of using this software.
*/
+/* FIXME: The following are not ST library related. Move to a seperate
+ * file that internal formats can use.
+ */
#ifdef VAXC
#define IMPORT globalref
#define EXPORT globaldef
@@ -33,6 +37,7 @@
#include <stdio.h>
+/* FIXME: Move to seperate header */
#ifdef __alpha__
#include <sys/types.h> /* To get defines for 32-bit integers */
#define LONG int32_t
@@ -42,10 +47,6 @@
#define ULONG unsigned long
#endif
-#ifdef AMIGA
-#include "amiga.h"
-#endif /* AMIGA */
-
/*
* Handler structure for each format.
*/
@@ -61,10 +62,12 @@
void (*stopwrite)();
} format_t;
+/* FIXME: Does this need to be here? */
IMPORT format_t formats[];
/* Signal parameters */
+/* FIXME: Change to typedef */
struct signalinfo {
LONG rate; /* sampling rate */
int size; /* word length of data */
@@ -74,6 +77,7 @@
/* Loop parameters */
+/* FIXME: Change to typedef */
struct loopinfo {
int start; /* first sample */
int length; /* length */
@@ -85,6 +89,7 @@
/* vague attempt at generic information for sampler-specific info */
+/* FIXME: Change to typedef */
struct instrinfo {
char MIDInote; /* for unity pitch playback */
char MIDIlow, MIDIhi;/* MIDI pitch-bend range */
@@ -107,6 +112,7 @@
* File buffer info. Holds info so that data can be read in blocks.
*/
+/* FIXME: Change to typedef */
struct fileinfo {
char *buf; /* Pointer to data buffer */
int size; /* Size of buffer */
@@ -136,12 +142,16 @@
FILE *fp; /* File stream pointer */
struct fileinfo file; /* File data block */
format_t *h; /* format struct for this file */
+ /* FIXME: I perfer void * or char * */
double priv[PRIVSIZE/8]; /* format's private data area */
};
+/* This shoul not be here. Only needed in sox.c */
IMPORT struct soundstream informat, outformat;
+
typedef struct soundstream *ft_t;
+/* FIXME: Prefix all #defines with ST_ */
/* flags field */
#define FILE_STEREO 1 /* does file format support stereo? */
#define FILE_LOOPS 2 /* does file format support loops? */
@@ -163,6 +173,9 @@
#define ADPCM 5 /* Compressed PCM */
#define GSM 6 /* GSM 6.10 33-byte frame lossy compression */
+/* FIXME: This shouldn't be defined inside library. Only needed
+ * by sox.c itself. Delete from raw.c and misc.c.
+ */
IMPORT char *sizes[], *styles[];
/*
@@ -200,6 +213,7 @@
typedef struct effect *eff_t;
+/* FIXME: Move to internal st header */
#if defined(__STDC__)
#define P1(a) a
#define P2(a,b) a, b
@@ -224,27 +238,21 @@
#define P10(a,b,c,d,e,f,g,h,i,j)
#endif
-/* Utilities to read and write shorts and longs little-endian and big-endian */
-unsigned short rlshort(P1(ft_t ft)); /* short little-end */
-unsigned short rbshort(P1(ft_t ft)); /* short big-end */
-unsigned short wlshort(P2(ft_t ft, unsigned short us)); /* short little-end */
-unsigned short wbshort(P2(ft_t ft, unsigned short us)); /* short big-end */
-ULONG rllong(P1(ft_t ft)); /* long little-end */
-ULONG rblong(P1(ft_t ft)); /* long big-end */
-ULONG wllong(P2(ft_t ft, ULONG ul)); /* long little-end */
-ULONG wblong(P2(ft_t ft, ULONG ul)); /* long big-end */
-/* Read and write words and longs in "machine format". Swap if indicated. */
+/* Read and write basic data types from "ft" stream. Uses ft->swap for
+ * possible byte swapping.
+ */
unsigned short rshort(P1(ft_t ft));
unsigned short wshort(P2(ft_t ft, unsigned short us));
-ULONG rlong(P1(ft_t ft));
-ULONG wlong(P2(ft_t ft, ULONG ul));
+ULONG rlong(P1(ft_t ft));
+ULONG wlong(P2(ft_t ft, ULONG ul));
float rfloat(P1(ft_t ft));
void wfloat(P2(ft_t ft, double f));
double rdouble(P1(ft_t ft));
void wdouble(P2(ft_t ft, double d));
-/* raw routines are used by so many people their prototypes are defined
- * here for convience.
+/* FIXME: raw routines are used by so many formats their prototypes are defined
+ * here for convience. This wont last for long so application software
+ * shouldn't make use of it.
*/
void rawstartread(P1(ft_t ft));
void rawstartwrite(P1(ft_t ft));
@@ -268,8 +276,14 @@
IMPORT void checkformat(P1(ft_t));
IMPORT void copyformat(P2(ft_t, ft_t));
IMPORT void cmpformats(P2(ft_t, ft_t));
+
+/* FIXME: Recording hacks shouldn't display a "sigint" style interface.
+ * Instead we should provide a function to call when done playing/recording.
+ * sox.c should be responsible for registering to sigint.
+ */
IMPORT void sigintreg(P1(ft_t));
+/* FIXME: Move to sox header file. */
typedef unsigned int u_i;
typedef ULONG u_l;
typedef unsigned short u_s;
@@ -289,8 +303,10 @@
IMPORT int soxpreview; /* Preview mode: be fast and ugly */
+/* FIXME: Not externally visible currently. Its a per-effect value. */
#define MAXRATE 50L * 1024 /* maximum sample rate */
+/* FIXME: Move to internal st header */
#define RIGHT(datum, bits) ((datum) >> bits)
#define LEFT(datum, bits) ((datum) << bits)
@@ -298,6 +314,7 @@
#define M_PI 3.14159265358979323846
#endif
+/* FIXME: Move to sox.h */
#ifdef VMS
#define READBINARY "r", "mbf=16", "ctx=stm"
#define WRITEBINARY "w", "ctx=stm"