ref: b944867d473bf74869e282e28fdc25f134b6d6d9
parent: c68357d8aa94c426f7d1791ea11d3da70b208288
author: cbagwell <cbagwell>
date: Fri Apr 2 22:01:50 EST 1999
updating docs and examples
--- a/TODO
+++ b/TODO
@@ -25,10 +25,7 @@
same device in duplex.
o Internally sox can handle multiple effects on a given sound file.
- Add support for this from the command line. Will probably need to
- break out the MCHAN to MCHAN and VCHAN to distingish effects that
- can handle Multiple channels and effects that can change the number
- of resulting channels to Various values.
+ Add support for this from the command line.
o Enhance sox for better interactive support. This includes updating
effect parameters in real time and ablity to start/stop/scan
@@ -49,12 +46,6 @@
forward, and an to add new ones would be handy.
o Update auto file type to include detection of .wve and .smp files.
-
- o An effect loop for mixing mono -> stereo -> quad with sound
- placement features: differential volume, phasing, and Doppler
- shifting when the sound moves. Static placement would work as
- a SOX effect loop, but dynamic placement involves some scripting
- feature, or joystick input etc.
o This software wants to be a dataflow system with signal
sources, sinks, and processors. It wants to be class-based.
--- a/src/skeleff.c
+++ b/src/skeleff.c
@@ -1,24 +1,22 @@
-
/*
- * July 5, 1991
- * Copyright 1991 Lance Norskog And Sundry Contributors
+ * skeleff - Skelton Effect. Use as sample for new effects.
+ *
+ * Written by Chris Bagwell (cbagwell@sprynet.com) - March 16, 1999
+ *
+ * Copyright 1999 Chris Bagwell And Sundry Contributors
* 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.
*/
-/*
- * Sound Tools skeleton effect file.
- */
-#include <math.h>
#include "st.h"
/* Private data for SKEL file */
-typedef struct skelstuff {
- int rest; /* bytes remaining in current block */
-} *skel_t;
+typedef struct skelleffstuff {
+ int localdata;
+} *skeleff_t;
/*
* Process options
@@ -26,13 +24,20 @@
* Don't do initialization now.
* The 'info' fields are not yet filled in.
*/
-void skel_getopts(effp, n, argv)
+void skeleff_getopts(effp, n, argv)
eff_t effp;
int n;
char **argv;
{
- if (n)
- fail("Copy effect takes no options.");
+ skeleff_t skeleff = (skeleff_t) effp->priv;
+
+ if (n)
+ {
+ if (n != 1)
+ {
+ fail("Usage: skeleff [option]");
+ }
+ }
}
/*
@@ -39,11 +44,11 @@
* Prepare processing.
* Do all initializations.
*/
-skel_start(effp)
+skeleff_start(effp)
eff_t effp;
{
- /* nothing to do */
- /* stuff data into delaying effects here */
+ if (effp->outinfo.channels == 1)
+ fail("Can't run skeleff on mono data.");
}
/*
@@ -51,33 +56,36 @@
* Return number of samples processed.
*/
-void skel_flow(effp, ibuf, obuf, isamp, osamp)
+void skeleff_flow(effp, ibuf, obuf, isamp, osamp)
eff_t effp;
LONG *ibuf, *obuf;
int *isamp, *osamp;
{
- skel_t skel = (skel_t) effp->priv;
- int len, done;
-
- char c;
- unsigned char uc;
- short s;
- unsigned short us;
- LONG l;
- ULONG ul;
- float f;
- double d;
+ skeleff_t skeleff = (skeleff_t) effp->priv;
+ int len, done;
- len = ((*isamp > *osamp) ? *osamp : *isamp);
- for(done = 0; done < len; done++) {
- if no more samples
- break
- get a sample
- l = sample converted to signed long
- *buf++ = l;
+ switch (effp->outinfo.channels)
+ {
+ case 2:
+ /* Length to process will be buffer length / 2 since we
+ * work with two samples at a time.
+ */
+ len = ((*isamp > *osamp) ? *osamp : *isamp) / 2;
+ for(done = 0; done < len; done++)
+ {
+ obuf[0] = ibuf[0];
+ obuf[1] = ibuf[1];
+ /* Advance buffer by 2 samples */
+ ibuf += 2;
+ obuf += 2;
}
- *isamp =
- *osamp =
+
+ *isamp = len * 2;
+ *osamp = len * 2;
+
+ break;
+
+ }
}
/*
@@ -84,7 +92,7 @@
* Drain out remaining samples if the effect generates any.
*/
-void skel_drain(effp, obuf, osamp)
+void skeleff_drain(effp, obuf, osamp)
LONG *obuf;
int *osamp;
{
@@ -95,10 +103,8 @@
* Do anything required when you stop reading samples.
* (free allocated memory, etc.)
*/
-void skel_stop(effp)
+void skeleff_stop(effp)
eff_t effp;
{
/* nothing to do */
}
-
-