ref: 48282e9cf5e3ed139bdf5b355213d22623e6c300
parent: 7b8c07617896add470f0bbfb0045e2844d1f0ec2
author: robs <robs>
date: Sun Jun 10 10:07:06 EDT 2007
tidying
--- a/src/effects.c
+++ b/src/effects.c
@@ -307,6 +307,29 @@
return flow_status;
}
+sox_size_t sox_effects_clips(void)
+{
+ unsigned i, f;
+ sox_size_t clips = 0;
+ for (i = 1; i < sox_neffects - 1; ++i)
+ for (f = 0; f < sox_effects[i][0].flows; ++f)
+ clips += sox_effects[i][f].clips;
+ return clips;
+}
+
+sox_size_t sox_stop_effect(sox_size_t e)
+{
+ unsigned f;
+ sox_effect_t * effp = &sox_effects[e][0];
+ sox_size_t clips = 0;
+
+ for (f = 0; f < effp->flows; ++f) {
+ effp->handler.stop(&sox_effects[e][f]);
+ clips += sox_effects[e][f].clips;
+ }
+ return clips;
+}
+
/* Remove all effects from the chain */
void sox_delete_effects(void)
{
--- a/src/skeleff.c
+++ b/src/skeleff.c
@@ -101,7 +101,7 @@
*osamp = 0;
/* Return SOX_EOF when drain
* will not output any more samples.
- * *osamp == 0 * also indicates that.
+ * *osamp == 0 also indicates that.
*/
return SOX_EOF;
}
--- a/src/sox.c
+++ b/src/sox.c
@@ -1338,18 +1338,12 @@
static void sox_stop_effects(void)
{
- unsigned e, f;
- for (e = 0; e < sox_neffects; ++e) {
- sox_effect_t * effp = &sox_effects[e][0];
- sox_size_t clips = 0;
+ sox_size_t e, clips;
- for (f = 0; f < effp->flows; ++f) {
- effp->handler.stop(&sox_effects[e][f]);
- clips += sox_effects[e][f].clips;
- }
- if (clips != 0)
- sox_warn("clipped %u samples; decrease volume?", clips);
- }
+ for (e = 0; e < sox_neffects; ++e)
+ if ((clips = sox_stop_effect(e)) != 0)
+ sox_warn("%s clipped %u samples; decrease volume?",
+ sox_effects[e][0].handler.name, clips);
}
/*
@@ -1442,11 +1436,7 @@
sox_size_t clips = 0;
for (i = 0; i < file_count; ++i)
clips += files[i]->ft->clips + files[i]->volume_clips;
- clips += mixing_clips;
- for (i = 1; i < sox_neffects - 1; ++i)
- for (f = 1; f < sox_effects[i][0].flows; ++f)
- clips += sox_effects[i][f].clips;
- return clips;
+ return clips + mixing_clips + sox_effects_clips();
}
static char const * sigfigs3(sox_size_t number)
--- a/src/sox_i.h
+++ b/src/sox_i.h
@@ -273,7 +273,7 @@
int sox_rawseek(sox_format_t * ft, sox_size_t offset);
/* The following functions can be used to simply return success if
- * a file handler or effect doesn't need to do anything special
+ * a file handler doesn't need to do anything special
*/
int sox_format_nothing(sox_format_t * ft);
sox_size_t sox_format_nothing_read(sox_format_t * ft, sox_ssample_t *buf, sox_size_t len);
--- a/src/trim.c
+++ b/src/trim.c
@@ -7,18 +7,10 @@
* the consequences of using this software.
*/
-/*
- * libSoX skeleton effect file.
- */
-
#include "sox_i.h"
#include <string.h>
-/* Time resolutin one millisecond */
-#define TIMERES 1000
-
-typedef struct
-{
+typedef struct {
/* options here */
char *start_str;
char *length_str;