ref: e04634b7b1322e431ebe7207784dd252a1a2ba86
parent: c36e8b40a14fb11d07095b4221b217b4a130b049
author: robs <robs>
date: Sun Apr 22 02:14:47 EDT 2007
output length determination
--- a/src/chorus.c
+++ b/src/chorus.c
@@ -342,7 +342,7 @@
static sox_effect_t sox_chorus_effect = {
"chorus",
"Usage: chorus gain-in gain-out delay decay speed depth [ -s | -t ]",
- 0,
+ SOX_EFF_LENGTH,
sox_chorus_getopts,
sox_chorus_start,
sox_chorus_flow,
--- a/src/earwax.c
+++ b/src/earwax.c
@@ -167,7 +167,7 @@
static sox_effect_t sox_earwax_effect = {
"earwax",
"Usage: The earwax filtering effect takes no options",
- SOX_EFF_MCHAN,
+ SOX_EFF_MCHAN|SOX_EFF_LENGTH,
sox_effect_nothing_getopts,
sox_earwax_start,
sox_earwax_flow,
--- a/src/echo.c
+++ b/src/echo.c
@@ -269,7 +269,7 @@
static sox_effect_t sox_echo_effect = {
"echo",
"Usage: echo gain-in gain-out delay decay [ delay decay ... ]",
- 0,
+ SOX_EFF_LENGTH,
sox_echo_getopts,
sox_echo_start,
sox_echo_flow,
--- a/src/echos.c
+++ b/src/echos.c
@@ -273,7 +273,7 @@
static sox_effect_t sox_echos_effect = {
"echos",
"Usage: echos gain-in gain-out delay decay [ delay decay ... ]",
- 0,
+ SOX_EFF_LENGTH,
sox_echos_getopts,
sox_echos_start,
sox_echos_flow,
--- a/src/noiseprof.c
+++ b/src/noiseprof.c
@@ -212,7 +212,7 @@
static sox_effect_t sox_noiseprof_effect = {
"noiseprof",
"Usage: noiseprof [filename]",
- SOX_EFF_MCHAN | SOX_EFF_REPORT,
+ SOX_EFF_MCHAN,
sox_noiseprof_getopts,
sox_noiseprof_start,
sox_noiseprof_flow,
--- a/src/noisered.c
+++ b/src/noisered.c
@@ -331,7 +331,7 @@
static sox_effect_t sox_noisered_effect = {
"noisered",
"Usage: noiseprof profile-file [threshold]",
- SOX_EFF_MCHAN,
+ SOX_EFF_MCHAN|SOX_EFF_LENGTH,
sox_noisered_getopts,
sox_noisered_start,
sox_noisered_flow,
--- a/src/pad.c
+++ b/src/pad.c
@@ -141,7 +141,7 @@
sox_effect_t const * sox_pad_effect_fn(void)
{
static sox_effect_t driver = {
- "pad", "Usage: pad {length[@position]}", SOX_EFF_MCHAN,
+ "pad", "Usage: pad {length[@position]}", SOX_EFF_MCHAN|SOX_EFF_LENGTH,
create, start, flow, drain, stop, kill
};
return &driver;
--- a/src/phaser.c
+++ b/src/phaser.c
@@ -265,7 +265,7 @@
static sox_effect_t sox_phaser_effect = {
"phaser",
"Usage: phaser gain-in gain-out delay decay speed [ -s | -t ]",
- 0,
+ SOX_EFF_LENGTH,
sox_phaser_getopts,
sox_phaser_start,
sox_phaser_flow,
--- a/src/pitch.c
+++ b/src/pitch.c
@@ -579,7 +579,7 @@
"Usage: pitch shift width interpole fade\n"
" (in cents, in ms, cub/lin, cos/ham/lin/trap)"
" (defaults: 0 20 c c)",
- 0,
+ SOX_EFF_LENGTH,
sox_pitch_getopts,
sox_pitch_start,
sox_pitch_flow,
--- a/src/repeat.c
+++ b/src/repeat.c
@@ -199,7 +199,7 @@
static sox_effect_t sox_repeat_effect = {
"repeat",
"Usage: repeat count",
- 0,
+ SOX_EFF_LENGTH,
sox_repeat_getopts,
sox_repeat_start,
sox_repeat_flow,
--- a/src/reverb.c
+++ b/src/reverb.c
@@ -287,7 +287,7 @@
static sox_effect_t sox_reverb_effect = {
"reverb",
"Usage: reverb gain-out reverb-time delay [ delay ... ]",
- 0,
+ SOX_EFF_LENGTH,
sox_reverb_getopts,
sox_reverb_start,
sox_reverb_flow,
--- a/src/sox.h
+++ b/src/sox.h
@@ -348,10 +348,10 @@
#define SOX_EFF_CHAN 1 /* Effect can mix channels up/down */
#define SOX_EFF_RATE 2 /* Effect can alter data rate */
-#define SOX_EFF_MCHAN 4 /* Effect can handle multi-channel */
-#define SOX_EFF_REPORT 8 /* Effect does not affect the audio */
-#define SOX_EFF_DEPRECATED 16 /* Effect is living on borrowed time */
-#define SOX_EFF_NULL 32 /* Effect does nothing */
+#define SOX_EFF_LENGTH 4 /* Effect can alter audio length */
+#define SOX_EFF_MCHAN 8 /* Effect can handle multi-channel */
+#define SOX_EFF_NULL 16 /* Effect does nothing */
+#define SOX_EFF_DEPRECATED 32 /* Effect is living on borrowed time */
/*
* Handler structure for each effect.
@@ -403,6 +403,7 @@
const sox_signalinfo_t *info,
const char *filetype,
const char *comment,
+ sox_size_t length,
const sox_instrinfo_t *instr,
const sox_loopinfo_t *loops);
extern sox_size_t sox_read(ft_t ft, sox_ssample_t *buf, sox_size_t len);
--- a/src/soxio.c
+++ b/src/soxio.c
@@ -188,6 +188,7 @@
const sox_signalinfo_t *info,
const char *filetype,
const char *comment,
+ sox_size_t length,
const sox_instrinfo_t *instr,
const sox_loopinfo_t *loops)
{
@@ -197,7 +198,6 @@
ft->filename = xstrdup(path);
- /* Let auto effect do the work if user is not overriding. */
if (!filetype) {
char *chop;
int len;
@@ -280,6 +280,7 @@
if (instr)
ft->instr = *instr;
+ ft->length = length;
set_endianness_if_not_already_set(ft);
/* Read and write starters can change their formats. */
--- a/src/speed.c
+++ b/src/speed.c
@@ -54,6 +54,7 @@
sox_effect_t const *sox_speed_effect_fn(void)
{
static sox_effect_t driver = {
- "speed", "Usage: speed factor[c]", SOX_EFF_NULL, getopts, 0, 0, 0, 0, 0};
+ "speed", "Usage: speed factor[c]", SOX_EFF_NULL|SOX_EFF_LENGTH,
+ getopts, 0, 0, 0, 0, 0};
return &driver;
}
--- a/src/stat.c
+++ b/src/stat.c
@@ -321,7 +321,7 @@
static sox_effect_t sox_stat_effect = {
"stat",
"Usage: [ -s N ] [ -rms ] [-freq] [ -v ] [ -d ]",
- SOX_EFF_MCHAN | SOX_EFF_REPORT,
+ SOX_EFF_MCHAN,
sox_stat_getopts,
sox_stat_start,
sox_stat_flow,
--- a/src/stretch.c
+++ b/src/stretch.c
@@ -361,7 +361,7 @@
"Usage: stretch factor [window fade shift fading]\n"
" (expansion, frame in ms, lin/..., unit<1.0, unit<0.5)\n"
" (defaults: 1.0 20 lin ...)",
- 0,
+ SOX_EFF_LENGTH,
sox_stretch_getopts,
sox_stretch_start,
sox_stretch_flow,
--- a/src/trim.c
+++ b/src/trim.c
@@ -204,7 +204,7 @@
static sox_effect_t sox_trim_effect = {
"trim",
"Usage: trim start [length]",
- SOX_EFF_MCHAN,
+ SOX_EFF_MCHAN|SOX_EFF_LENGTH,
sox_trim_getopts,
sox_trim_start,
sox_trim_flow,